Skip to content

Commit

Permalink
Add file target for provider target
Browse files Browse the repository at this point in the history
If we make the file target depend on _no_deps, it will never be up-to-date. If we make _no_deps depend on the file target it will pull in all dependencies. Instead we extract the build provider command to a variable so it's re-used from both the file target and _no_deps versions.
  • Loading branch information
danielrbradley committed Nov 22, 2024
1 parent b79852f commit 912f23e
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 15 deletions.
9 changes: 6 additions & 3 deletions provider-ci/internal/pkg/templates/bridged-provider/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -174,10 +174,13 @@ lint_provider.fix:
# `make provider_no_deps` builds the provider binary directly, without ensuring that
# `cmd/pulumi-resource-#{{ .Config.Provider }}#/schema.json` is valid and up to date.
# To create a release ready binary, you should use `make provider`.
.PHONY: provider provider_no_deps
build_provider_cmd = cd provider && go build $(PULUMI_PROVIDER_BUILD_PARALLELISM) -o $(WORKING_DIR)/bin/$(PROVIDER) -ldflags "$(LDFLAGS)" $(PROJECT)/$(PROVIDER_PATH)/cmd/$(PROVIDER)
provider: bin/$(PROVIDER)
provider_no_deps:
(cd provider && go build $(PULUMI_PROVIDER_BUILD_PARALLELISM) -o $(WORKING_DIR)/bin/$(PROVIDER) -ldflags "$(LDFLAGS)" $(PROJECT)/$(PROVIDER_PATH)/cmd/$(PROVIDER))

provider: tfgen provider_no_deps
$(call build_provider_cmd)
bin/$(PROVIDER): .make/schema
$(call build_provider_cmd)

test: export PATH := $(WORKING_DIR)/bin:$(PATH)
test:
Expand Down
9 changes: 6 additions & 3 deletions provider-ci/test-providers/acme/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -138,10 +138,13 @@ lint_provider.fix:
# `make provider_no_deps` builds the provider binary directly, without ensuring that
# `cmd/pulumi-resource-acme/schema.json` is valid and up to date.
# To create a release ready binary, you should use `make provider`.
.PHONY: provider provider_no_deps
build_provider_cmd = cd provider && go build $(PULUMI_PROVIDER_BUILD_PARALLELISM) -o $(WORKING_DIR)/bin/$(PROVIDER) -ldflags "$(LDFLAGS)" $(PROJECT)/$(PROVIDER_PATH)/cmd/$(PROVIDER)
provider: bin/$(PROVIDER)
provider_no_deps:
(cd provider && go build $(PULUMI_PROVIDER_BUILD_PARALLELISM) -o $(WORKING_DIR)/bin/$(PROVIDER) -ldflags "$(LDFLAGS)" $(PROJECT)/$(PROVIDER_PATH)/cmd/$(PROVIDER))

provider: tfgen provider_no_deps
$(call build_provider_cmd)
bin/$(PROVIDER): .make/schema
$(call build_provider_cmd)

test: export PATH := $(WORKING_DIR)/bin:$(PATH)
test:
Expand Down
9 changes: 6 additions & 3 deletions provider-ci/test-providers/aws/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -148,10 +148,13 @@ lint_provider.fix:
# `make provider_no_deps` builds the provider binary directly, without ensuring that
# `cmd/pulumi-resource-aws/schema.json` is valid and up to date.
# To create a release ready binary, you should use `make provider`.
.PHONY: provider provider_no_deps
build_provider_cmd = cd provider && go build $(PULUMI_PROVIDER_BUILD_PARALLELISM) -o $(WORKING_DIR)/bin/$(PROVIDER) -ldflags "$(LDFLAGS)" $(PROJECT)/$(PROVIDER_PATH)/cmd/$(PROVIDER)
provider: bin/$(PROVIDER)
provider_no_deps:
(cd provider && go build $(PULUMI_PROVIDER_BUILD_PARALLELISM) -o $(WORKING_DIR)/bin/$(PROVIDER) -ldflags "$(LDFLAGS)" $(PROJECT)/$(PROVIDER_PATH)/cmd/$(PROVIDER))

provider: tfgen provider_no_deps
$(call build_provider_cmd)
bin/$(PROVIDER): .make/schema
$(call build_provider_cmd)

test: export PATH := $(WORKING_DIR)/bin:$(PATH)
test:
Expand Down
9 changes: 6 additions & 3 deletions provider-ci/test-providers/cloudflare/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -148,10 +148,13 @@ lint_provider.fix:
# `make provider_no_deps` builds the provider binary directly, without ensuring that
# `cmd/pulumi-resource-cloudflare/schema.json` is valid and up to date.
# To create a release ready binary, you should use `make provider`.
.PHONY: provider provider_no_deps
build_provider_cmd = cd provider && go build $(PULUMI_PROVIDER_BUILD_PARALLELISM) -o $(WORKING_DIR)/bin/$(PROVIDER) -ldflags "$(LDFLAGS)" $(PROJECT)/$(PROVIDER_PATH)/cmd/$(PROVIDER)
provider: bin/$(PROVIDER)
provider_no_deps:
(cd provider && go build $(PULUMI_PROVIDER_BUILD_PARALLELISM) -o $(WORKING_DIR)/bin/$(PROVIDER) -ldflags "$(LDFLAGS)" $(PROJECT)/$(PROVIDER_PATH)/cmd/$(PROVIDER))

provider: tfgen provider_no_deps
$(call build_provider_cmd)
bin/$(PROVIDER): .make/schema
$(call build_provider_cmd)

test: export PATH := $(WORKING_DIR)/bin:$(PATH)
test:
Expand Down
9 changes: 6 additions & 3 deletions provider-ci/test-providers/docker/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -151,10 +151,13 @@ lint_provider.fix:
# `make provider_no_deps` builds the provider binary directly, without ensuring that
# `cmd/pulumi-resource-docker/schema.json` is valid and up to date.
# To create a release ready binary, you should use `make provider`.
.PHONY: provider provider_no_deps
build_provider_cmd = cd provider && go build $(PULUMI_PROVIDER_BUILD_PARALLELISM) -o $(WORKING_DIR)/bin/$(PROVIDER) -ldflags "$(LDFLAGS)" $(PROJECT)/$(PROVIDER_PATH)/cmd/$(PROVIDER)
provider: bin/$(PROVIDER)
provider_no_deps:
(cd provider && go build $(PULUMI_PROVIDER_BUILD_PARALLELISM) -o $(WORKING_DIR)/bin/$(PROVIDER) -ldflags "$(LDFLAGS)" $(PROJECT)/$(PROVIDER_PATH)/cmd/$(PROVIDER))

provider: tfgen provider_no_deps
$(call build_provider_cmd)
bin/$(PROVIDER): .make/schema
$(call build_provider_cmd)

test: export PATH := $(WORKING_DIR)/bin:$(PATH)
test:
Expand Down

0 comments on commit 912f23e

Please sign in to comment.