|
| 1 | +all: \ |
| 2 | + go-stringer \ |
| 3 | + go-mock-gen \ |
| 4 | + testdata \ |
| 5 | + go-lint \ |
| 6 | + go-test \ |
| 7 | + go-mod-tidy \ |
| 8 | + git-verify-nodiff |
| 9 | + |
| 10 | +include build/rules.mk |
| 11 | + |
| 12 | +.PHONY: clean |
| 13 | +clean: |
| 14 | + rm -rf $(FILES_DIR) |
| 15 | + |
| 16 | +.PHONY: go-lint |
| 17 | +go-lint: $(GOLANGCI_LINT) |
| 18 | + # funlen: too strict |
| 19 | + # dupl: allow duplication in tests |
| 20 | + # interfacer: deprecated |
| 21 | + # godox: allow TODOs |
| 22 | + # lll: long go:generate directives |
| 23 | + $(GOLANGCI_LINT) run --enable-all --disable funlen,dupl,interfacer,godox,lll |
| 24 | + |
| 25 | +.PHONY: go-mock-gen |
| 26 | +go-mock-gen: \ |
| 27 | + internal/mocks/mockcanrunner/mocks.go \ |
| 28 | + internal/mocks/mockclock/mocks.go \ |
| 29 | + internal/mocks/mocksocketcan/mocks.go |
| 30 | + |
| 31 | +internal/mocks/mockcanrunner/mocks.go: pkg/canrunner/run.go $(GOBIN) |
| 32 | + $(GOBIN) -m -run github.com/golang/mock/mockgen -destination $@ \ |
| 33 | + -package mockcanrunner go.einride.tech/can/pkg/canrunner \ |
| 34 | + Node,TransmittedMessage,ReceivedMessage,FrameTransmitter,FrameReceiver |
| 35 | + |
| 36 | +internal/mocks/mockclock/mocks.go: internal/clock/clock.go $(GOBIN) |
| 37 | + $(GOBIN) -m -run github.com/golang/mock/mockgen -destination $@ \ |
| 38 | + -package mockclock go.einride.tech/can/internal/clock \ |
| 39 | + Clock,Ticker |
| 40 | + |
| 41 | +internal/mocks/mocksocketcan/mocks.go: pkg/socketcan/fileconn.go $(GOBIN) |
| 42 | + $(GOBIN) -m -run github.com/golang/mock/mockgen -destination $@ \ |
| 43 | + -package mocksocketcan -source $< |
| 44 | + |
| 45 | +.PHONY: go-stringer |
| 46 | +go-stringer: \ |
| 47 | + pkg/descriptor/sendtype_string.go \ |
| 48 | + pkg/socketcan/errorclass_string.go \ |
| 49 | + pkg/socketcan/protocolviolationerrorlocation_string.go \ |
| 50 | + pkg/socketcan/protocolviolationerror_string.go \ |
| 51 | + pkg/socketcan/controllererror_string.go \ |
| 52 | + pkg/socketcan/transceivererror_string.go |
| 53 | + |
| 54 | +%_string.go: %.go |
| 55 | + go generate $< |
| 56 | + |
| 57 | +.PHONY: testdata |
| 58 | +testdata: |
| 59 | + go run cmd/cantool/main.go generate testdata/dbc testdata/gen/go |
| 60 | + |
| 61 | +.PHONY: go-test |
| 62 | +go-test: |
| 63 | + go test -race -cover ./... |
| 64 | + |
| 65 | +.PHONY: go-mod-tidy |
| 66 | +go-mod-tidy: |
| 67 | + go mod tidy -v |
0 commit comments