You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@polaris.apache.org by yz...@apache.org on 2025/09/18 03:48:43 UTC

(polaris) branch main updated: Add client build to Gradle (#2590)

This is an automated email from the ASF dual-hosted git repository.

yzheng pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/polaris.git


The following commit(s) were added to refs/heads/main by this push:
     new 149c19e06 Add client build to Gradle (#2590)
149c19e06 is described below

commit 149c19e0605519bc1b7ff6f77dc748fb49eaadec
Author: Yong Zheng <yo...@gmail.com>
AuthorDate: Wed Sep 17 22:48:39 2025 -0500

    Add client build to Gradle (#2590)
    
    * Add client build to Gradle
    
    * Add overwrite option for python build
    
    * Match client build behavior
---
 Makefile         | 15 +++++++++++++--
 build.gradle.kts | 10 ++++++++++
 2 files changed, 23 insertions(+), 2 deletions(-)

diff --git a/Makefile b/Makefile
index 9211d791f..0a4c29802 100644
--- a/Makefile
+++ b/Makefile
@@ -169,11 +169,22 @@ client-license-check: client-setup-env ## Run license compliance check
 	@echo "--- License compliance check complete ---"
 
 .PHONY: client-build
-client-build: client-setup-env ## Build client distribution
+client-build: client-setup-env ## Build client distribution. Pass FORMAT=sdist or FORMAT=wheel to build a specific format.
 	@echo "--- Building client distribution ---"
-	@$(ACTIVATE_AND_CD) && poetry build
+	@if [ -n "$(FORMAT)" ]; then \
+		if [ "$(FORMAT)" != "sdist" ] && [ "$(FORMAT)" != "wheel" ]; then \
+			echo "Error: Invalid format '$(FORMAT)'. Supported formats are 'sdist' and 'wheel'." >&2; \
+			exit 1; \
+		fi; \
+		echo "Building with format: $(FORMAT)"; \
+		$(ACTIVATE_AND_CD) && poetry build --format $(FORMAT); \
+	else \
+		echo "Building default distribution (sdist and wheel)"; \
+		$(ACTIVATE_AND_CD) && poetry build; \
+	fi
 	@echo "--- Client distribution build complete ---"
 
+
 .PHONY: client-cleanup
 client-cleanup: ## Cleanup virtual environment and Python cache files
 	@echo "--- Cleaning up virtual environment and Python cache files ---"
diff --git a/build.gradle.kts b/build.gradle.kts
index 06fa84c61..0b70dee98 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -135,6 +135,16 @@ tasks.named<RatTask>("rat").configure {
   excludes.add("**/*.png")
 }
 
+tasks.register<Exec>("buildPythonClient") {
+  description = "Build the python client"
+
+  workingDir = project.projectDir
+  if (project.hasProperty("python.format")) {
+    environment("FORMAT", project.property("python.format") as String)
+  }
+  commandLine("make", "client-build")
+}
+
 // Pass environment variables:
 //    ORG_GRADLE_PROJECT_apacheUsername
 //    ORG_GRADLE_PROJECT_apachePassword