Skip to content

Commit 149c19e

Browse files
Add client build to Gradle (apache#2590)
* Add client build to Gradle * Add overwrite option for python build * Match client build behavior
1 parent 8f1614c commit 149c19e

File tree

2 files changed

+23
-2
lines changed

2 files changed

+23
-2
lines changed

Makefile

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,11 +169,22 @@ client-license-check: client-setup-env ## Run license compliance check
169169
@echo "--- License compliance check complete ---"
170170

171171
.PHONY: client-build
172-
client-build: client-setup-env ## Build client distribution
172+
client-build: client-setup-env ## Build client distribution. Pass FORMAT=sdist or FORMAT=wheel to build a specific format.
173173
@echo "--- Building client distribution ---"
174-
@$(ACTIVATE_AND_CD) && poetry build
174+
@if [ -n "$(FORMAT)" ]; then \
175+
if [ "$(FORMAT)" != "sdist" ] && [ "$(FORMAT)" != "wheel" ]; then \
176+
echo "Error: Invalid format '$(FORMAT)'. Supported formats are 'sdist' and 'wheel'." >&2; \
177+
exit 1; \
178+
fi; \
179+
echo "Building with format: $(FORMAT)"; \
180+
$(ACTIVATE_AND_CD) && poetry build --format $(FORMAT); \
181+
else \
182+
echo "Building default distribution (sdist and wheel)"; \
183+
$(ACTIVATE_AND_CD) && poetry build; \
184+
fi
175185
@echo "--- Client distribution build complete ---"
176186

187+
177188
.PHONY: client-cleanup
178189
client-cleanup: ## Cleanup virtual environment and Python cache files
179190
@echo "--- Cleaning up virtual environment and Python cache files ---"

build.gradle.kts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,16 @@ tasks.named<RatTask>("rat").configure {
135135
excludes.add("**/*.png")
136136
}
137137

138+
tasks.register<Exec>("buildPythonClient") {
139+
description = "Build the python client"
140+
141+
workingDir = project.projectDir
142+
if (project.hasProperty("python.format")) {
143+
environment("FORMAT", project.property("python.format") as String)
144+
}
145+
commandLine("make", "client-build")
146+
}
147+
138148
// Pass environment variables:
139149
// ORG_GRADLE_PROJECT_apacheUsername
140150
// ORG_GRADLE_PROJECT_apachePassword

0 commit comments

Comments
 (0)