Skip to content

Commit

Permalink
Merge pull request #13 from turkenf/add-cleanupexamples
Browse files Browse the repository at this point in the history
Add cleanupexamples tool to build process
  • Loading branch information
turkenh authored Sep 20, 2024
2 parents 3cf6663 + 118e1ee commit f8d1bb9
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion makelib/xpkg.mk
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ XPKG_ARCHS := $(subst linux_,,$(filter linux_%,$(PLATFORMS)))
XPKG_PLATFORMS := $(subst _,/,$(subst $(SPACE),$(COMMA),$(filter linux_%,$(PLATFORMS))))
XPKG_PLATFORMS_LIST := $(subst _,/,$(filter linux_%,$(PLATFORMS)))
XPKG_PLATFORM := $(subst _,/,$(PLATFORM))
XPKG_CLEANUP_EXAMPLES_VERSION ?= v0.12.1

# TODO(negz): Update these targets to use the crossplane CLI, not up.
UP ?= up
Expand All @@ -70,17 +71,20 @@ UP ?= up
# 1: xpkg
define xpkg.build.targets
xpkg.build.$(1):
@rm -rf $(WORK_DIR)/xpkg-cleaned-examples
@GOOS=$(HOSTOS) GOARCH=$(TARGETARCH) go run github.com/upbound/uptest/cmd/cleanupexamples@$(XPKG_CLEANUP_EXAMPLES_VERSION) $(XPKG_EXAMPLES_DIR) $(WORK_DIR)/xpkg-cleaned-examples || $(FAIL)
@$(INFO) Building package $(1)-$(VERSION).xpkg for $(PLATFORM)
@mkdir -p $(OUTPUT_DIR)/xpkg/$(PLATFORM)
@controller_arg=$$$$(grep -E '^kind:\s+Provider\s*$$$$' $(XPKG_DIR)/crossplane.yaml > /dev/null && echo "--controller $(BUILD_REGISTRY)/$(1)-$(ARCH)"); \
$(UP) xpkg build \
$$$${controller_arg} \
--package-root $(XPKG_DIR) \
--auth-ext $(XPKG_AUTH_EXT) \
--examples-root $(XPKG_EXAMPLES_DIR) \
--examples-root $(WORK_DIR)/xpkg-cleaned-examples \
--ignore $(XPKG_IGNORE) \
--output $(XPKG_OUTPUT_DIR)/$(PLATFORM)/$(1)-$(VERSION).xpkg || $(FAIL)
@$(OK) Built package $(1)-$(VERSION).xpkg for $(PLATFORM)
@rm -rf $(WORK_DIR)/xpkg-cleaned-examples
xpkg.build: xpkg.build.$(1)
endef
$(foreach x,$(XPKGS),$(eval $(call xpkg.build.targets,$(x))))
Expand Down

0 comments on commit f8d1bb9

Please sign in to comment.