Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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 ---"
Expand Down
10 changes: 10 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,16 @@ tasks.named<RatTask>("rat").configure {
excludes.add("**/*.png")
}

tasks.register<Exec>("buildPythonClient") {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it hooked up to any "regular" top-level commands?

Should we run it in CI for verification?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like I merged too early. Currently it is not linked with any top level commands, but that is possible if we want to do so. The current CI is using the make command only. There is a WIP PR which needs this.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Linking to top-level commands is not critical... I was just wondering. If we connect it, I'd suggest connecting to the assemble chain.

Validating this new tasks in CI would be really good to have, but it's ok to do that in a follow-up PR, of course :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the feedback. Let me review this later tonight or tomorrow then purpose a new PR.

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")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some thoughts: Shall we add an option to build only sdist? Underlying it would be

poetry build --format=sdist

Could be useful in some case when we only want sdist : )

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some thoughts: Shall we add an option to build only sdist? Underlying it would be

poetry build --format=sdist

Could be useful in some case when we only want sdist : )

Good suggestion. Let me quickly add that.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@HonahX this is added. Instead of hard-coded it, it is now controlled via FORMAT when using the Makefile such as following:

# build both
make client-build
# build sdist
FORMAT=sdist make client-build
# build wheel
FORMAT=wheel make client-build

When using gradle, it is control via python.format:

# build both
./gradlew buildPythonClient
# build sdist
./gradlew buildPythonClient -Ppython.format=sdist
# build wheel
./gradlew buildPythonClient -Ppython.format=wheel

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That looks great! Thanks for adding it!

}

// Pass environment variables:
// ORG_GRADLE_PROJECT_apacheUsername
// ORG_GRADLE_PROJECT_apachePassword
Expand Down