build: create separate target for templates.tgz

This commit is contained in:
Luke Kingland 2021-05-06 11:00:38 +09:00
parent 4db07b412f
commit 11164bf8d9
No known key found for this signature in database
GPG Key ID: 4896F75BAF2E1966
1 changed files with 9 additions and 13 deletions

View File

@ -19,12 +19,14 @@ LDFLAGS := -X main.date=$(DATE) -X main.vers=$(VERS) -X main.hash=$(HASH)
build: all build: all
all: $(BIN) all: $(BIN)
clean-templates: templates.tgz:
# ensure no cached dependencies are added to the binary # ensure no cached dependencies are added to the binary
rm -rf templates/node/events/node_modules rm -rf templates/node/events/node_modules
rm -rf templates/node/http/node_modules rm -rf templates/node/http/node_modules
rm -rf templates/python/events/__pycache__ rm -rf templates/python/events/__pycache__
rm -rf templates/python/http/__pycache__ rm -rf templates/python/http/__pycache__
# see generate.go for details
go generate
cross-platform: $(DARWIN) $(LINUX) $(WINDOWS) cross-platform: $(DARWIN) $(LINUX) $(WINDOWS)
@ -34,26 +36,21 @@ linux: $(LINUX) ## Build for Linux
windows: $(WINDOWS) ## Build for Windows windows: $(WINDOWS) ## Build for Windows
$(BIN): $(CODE) ## Build using environment defaults $(BIN): templates.tgz $(CODE) ## Build using environment defaults
go generate
env CGO_ENABLED=0 go build -ldflags "$(LDFLAGS)" ./cmd/$(BIN) env CGO_ENABLED=0 go build -ldflags "$(LDFLAGS)" ./cmd/$(BIN)
$(DARWIN): $(DARWIN): templates.tgz
go generate
env CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -o $(DARWIN) -ldflags "$(LDFLAGS)" ./cmd/$(BIN) env CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -o $(DARWIN) -ldflags "$(LDFLAGS)" ./cmd/$(BIN)
$(LINUX): $(LINUX): templates.tgz
go generate
env CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o $(LINUX) -ldflags "$(LDFLAGS)" ./cmd/$(BIN) env CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o $(LINUX) -ldflags "$(LDFLAGS)" ./cmd/$(BIN)
$(WINDOWS): $(WINDOWS): templates.tgz
go generate
env CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -o $(WINDOWS) -ldflags "$(LDFLAGS)" ./cmd/$(BIN) env CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -o $(WINDOWS) -ldflags "$(LDFLAGS)" ./cmd/$(BIN)
test: test-binary test-node test-python test-quarkus test-go test: test-binary test-node test-python test-quarkus test-go
test-binary: test-binary: templates.tgz
go generate
go test -race -cover -coverprofile=coverage.out ./... go test -race -cover -coverprofile=coverage.out ./...
test-node: test-node:
@ -72,8 +69,7 @@ test-go:
cd templates/go/events && go test cd templates/go/events && go test
cd templates/go/http && go test cd templates/go/http && go test
test-integration: test-integration: templates.tgz
go generate
go test -tags integration ./... go test -tags integration ./...
image: Dockerfile image: Dockerfile