Centralize cibuildwheel config and pin macOS deployment target#330
Open
holodorum wants to merge 4 commits intokson-org:mainfrom
Open
Centralize cibuildwheel config and pin macOS deployment target#330holodorum wants to merge 4 commits intokson-org:mainfrom
holodorum wants to merge 4 commits intokson-org:mainfrom
Conversation
The build backend checked for native artifacts using `any()` across all platforms (win32, darwin, linux), so a stale artifact from a different OS (e.g. `libkson.dylib` left over on a Linux builder) would skip the Gradle build, leaving the actually-needed native library uncompiled. Additionally, the artifact check included `kson_api.h` which is not produced by the build—the Gradle `CopyNativeArtifactsTask` produces `jni_simplified.h` and the runtime loads `jni_simplified.h`. This would have caused fresh wheel builds to always trigger a rebuild attempt. Finally, when both artifacts and `kson-sdist` were absent, the function silently returned, producing broken wheels with no error. Fixes: - Check only the native library for *this* platform, plus `jni_simplified.h` (the header actually produced and loaded at runtime) - Add a post-condition that errors clearly when required artifacts are missing, guiding users to install from a pre-built wheel or ensure a JDK is available - Use `subprocess.run(cwd=...)` instead of `os.chdir` for thread safety - Log both stdout and stderr on Gradle build failure for easier debugging - Exclude platform-specific native binaries from `prepareSdistBuildEnvironment` in build.gradle.kts so sdists don't bundle stale cross-platform artifacts Fixes kson-org#307
PixiExecTask only declares inputs (command strings, env vars) but no outputs, so Gradle always considered this task out-of-date and re-ran the full native-image build every time. Add explicit input/output declarations so Gradle can properly cache the task: the project JAR, runtime classpath, and JNI config as inputs, and the native binary as the output. The output is the specific binary file rather than the whole directory, since krossover's generateJniBindingsJvm also writes into that directory.
Move all cibuildwheel configuration from environment variables in the Gradle buildWheel task to pyproject.toml under [tool.cibuildwheel]. This is the canonical location for cibuildwheel config, and centralizing it means the settings apply regardless of how cibuildwheel is invoked. Also pin MACOSX_DEPLOYMENT_TARGET to 11.0 (Big Sur, the first ARM-native macOS) so that builds don't fail when the host macOS version is newer than what the Python packaging tools recognize.
This file is copied from the project root by the copyLicense Gradle task at wheel-build time. It's a build artifact, not a source file.
1a04517 to
edbefb3
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
environment()calls topyproject.tomlunder[tool.cibuildwheel], the canonical location for this configMACOSX_DEPLOYMENT_TARGETto 11.0 so builds don't fail when the host macOS is newer than what the Python packaging tools recognizelib-python/LICENSE(build artifact copied from project root by thecopyLicenseGradle task)