Skip to content

Commit

Permalink
build: create separate target for templates.tgz
Browse files Browse the repository at this point in the history
  • Loading branch information
lkingland committed May 7, 2021
1 parent 4db07b4 commit 11164bf
Showing 1 changed file with 9 additions and 13 deletions.
22 changes: 9 additions & 13 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,14 @@ LDFLAGS := -X main.date=$(DATE) -X main.vers=$(VERS) -X main.hash=$(HASH)
build: all
all: $(BIN)

clean-templates:
templates.tgz:
# ensure no cached dependencies are added to the binary
rm -rf templates/node/events/node_modules
rm -rf templates/node/http/node_modules
rm -rf templates/python/events/__pycache__
rm -rf templates/python/http/__pycache__
# see generate.go for details
go generate

cross-platform: $(DARWIN) $(LINUX) $(WINDOWS)

Expand All @@ -34,26 +36,21 @@ linux: $(LINUX) ## Build for Linux

windows: $(WINDOWS) ## Build for Windows

$(BIN): $(CODE) ## Build using environment defaults
go generate
$(BIN): templates.tgz $(CODE) ## Build using environment defaults
env CGO_ENABLED=0 go build -ldflags "$(LDFLAGS)" ./cmd/$(BIN)

$(DARWIN):
go generate
$(DARWIN): templates.tgz
env CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -o $(DARWIN) -ldflags "$(LDFLAGS)" ./cmd/$(BIN)

$(LINUX):
go generate
$(LINUX): templates.tgz
env CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o $(LINUX) -ldflags "$(LDFLAGS)" ./cmd/$(BIN)

$(WINDOWS):
go generate
$(WINDOWS): templates.tgz
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-binary:
go generate
test-binary: templates.tgz
go test -race -cover -coverprofile=coverage.out ./...

test-node:
Expand All @@ -72,8 +69,7 @@ test-go:
cd templates/go/events && go test
cd templates/go/http && go test

test-integration:
go generate
test-integration: templates.tgz
go test -tags integration ./...

image: Dockerfile
Expand Down

0 comments on commit 11164bf

Please sign in to comment.