-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathMakefile
More file actions
66 lines (49 loc) · 2.48 KB
/
Makefile
File metadata and controls
66 lines (49 loc) · 2.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
VERSION=$(shell awk -F'"' '/"version":/ {print $$4}' version.json)
COMMIT=$(shell git rev-parse --short HEAD)
DATE=$(shell date -u -Iseconds)
GOFLAGS=-ldflags="-X github.com/storacha/piri/pkg/build.version=$(VERSION) -X github.com/storacha/piri/pkg/build.Commit=$(COMMIT) -X github.com/storacha/piri/pkg/build.Date=$(DATE) -X github.com/storacha/piri/pkg/build.BuiltBy=make"
TAGS?=
.PHONY: all build install test test-e2e clean calibnet mockgen check-docs-links
all: build
build: piri
# piri depends on Go sources - use shell to check if rebuild needed
piri: FORCE
@if [ ! -f piri ] || \
[ -n "$$(find cmd pkg internal -name '*.go' -type f -newer piri 2>/dev/null)" ]; then \
echo "Building piri..."; \
go build $(GOFLAGS) $(TAGS) -o ./piri github.com/storacha/piri/cmd; \
fi
FORCE:
install:
go install ./cmd/storage
test:
go test ./...
test-e2e:
go test -v -tags e2e -timeout 30m ./smelt-tests/...
clean:
rm -f ./piri
mockgen:
mockgen -source=./pkg/pdp/aggregator/interface.go -destination=./internal/mocks/aggregator.go -package=mocks
mockgen -source=./pkg/pdp/types/api.go -destination=./internal/mocks/pdp_api.go -package=mocks
mockgen -source=./internal/ipldstore/ipldstore.go -destination=./internal/mocks/ipldstore.go -package=mocks
mockgen -source=./pkg/pdp/aggregator/steps.go -destination=./internal/mocks/steps.go -package=mocks
mockgen -destination=./internal/mocks/sender_eth_client.go -package=mocks github.com/storacha/piri/pkg/pdp/tasks SenderETHClient
mockgen -destination=./internal/mocks/message_watcher_eth_client.go -package=mocks github.com/storacha/piri/pkg/pdp/tasks MessageWatcherEthClient
mockgen -destination=./internal/mocks/contract_backend.go -package=mocks github.com/ethereum/go-ethereum/accounts/abi/bind ContractBackend
mockgen -source=./pkg/pdp/smartcontracts/contract.go -destination=./pkg/pdp/smartcontracts/mocks/pdp.go -package=mocks
# Contract generation targets
.PHONY: generate-contracts clean-contracts
generate-contracts:
cd pkg/pdp/smartcontracts && ./generate.sh
clean-contracts:
rm -rf pkg/pdp/smartcontracts/abis
rm -rf pkg/pdp/smartcontracts/bindings
rm -f pkg/pdp/smartcontracts/mocks/*.go
mockgen-contracts: generate-contracts
mockgen -source=./pkg/pdp/smartcontracts/contract.go -destination=./pkg/pdp/smartcontracts/mocks/pdp.go -package=mocks
# special target that sets the calibnet tag and invokes build
calibnet: TAGS=-tags calibnet
calibnet: build
# Check for broken links in documentation
check-docs-links:
@./scripts/check-docs-links.sh