Skip to content

Comments

Adds Zig version validation for publishing task#306

Merged
muditchaudhary merged 3 commits intocedar-policy:mainfrom
muditchaudhary:addsZigValidation
Mar 13, 2025
Merged

Adds Zig version validation for publishing task#306
muditchaudhary merged 3 commits intocedar-policy:mainfrom
muditchaudhary:addsZigValidation

Conversation

@muditchaudhary
Copy link
Contributor

Description

This PR adds explicit Zig version (0.11) validation during the publishing process to ensure consistent artifact compatibility.

Changes:

  • Adds version check during package publishing
  • Does not enforce version check during normal build processes

Rationale:
Without version validation, artifacts could be published using different Zig versions, causing compatibility issues. By validating only during publishing, we ensure consistent releases while allowing developers to build from source using their preferred Zig version.

Testing

  1. Running validateZigVersion task with incorrect Zig Version:
$> gradle validateZigVersion

> Task :validateZigVersion FAILED
Detected Zig version: 0.13.0

[Incubating] Problems report is available at: file:///workplace/chmudit/CedarJavaUpgradePublic/cedar-java/CedarJava/build/reports/problems/problems-report.html

FAILURE: Build failed with an exception.

* Where:
Build file '/workplace/chmudit/CedarJavaUpgradePublic/cedar-java/CedarJava/build.gradle' line: 141

* What went wrong:
Execution failed for task ':validateZigVersion'.
> Zig version must be 0.11 but found: 0.13.0

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.

Deprecated Gradle features were used in this build, making it incompatible with Gradle 9.0.

You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.

For more on this, please refer to https://docs.gradle.org/8.12.1/userguide/command_line_interface.html#sec:command_line_warnings in the Gradle documentation.

BUILD FAILED in 460ms
  1. Running validateZigVersion task with correct Zig Version:
$> gradle validateZigVersion

> Task :validateZigVersion
Detected Zig version: 0.11.0
Zig version validation successful

[Incubating] Problems report is available at: file:///workplace/chmudit/CedarJavaUpgradePublic/cedar-java/CedarJava/build/reports/problems/problems-report.html

Deprecated Gradle features were used in this build, making it incompatible with Gradle 9.0.

You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.

For more on this, please refer to https://docs.gradle.org/8.12.1/userguide/command_line_interface.html#sec:command_line_warnings in the Gradle documentation.

BUILD SUCCESSFUL in 483ms
  1. Publish dry run
$> gradle publish --dry-run
info: override toolchain for '/workplace/chmudit/CedarJavaUpgradePublic/cedar-java/CedarJavaFFI' set to '1.83-x86_64-unknown-linux-gnu'
:compileJava SKIPPED
:processResources SKIPPED
:classes SKIPPED
:jar SKIPPED
:javadoc SKIPPED
:javadocJar SKIPPED
:sourcesJar SKIPPED
:generateMetadataFileForMavenJavaPublication SKIPPED
:generatePomFileForMavenJavaPublication SKIPPED
:installRequiredRustVersion SKIPPED
:installCargoZigbuild SKIPPED
:compileFFI SKIPPED
:uberJar SKIPPED
:signMavenJavaPublication SKIPPED
:publishMavenJavaPublicationToMavenRepository SKIPPED
:validateZigVersion SKIPPED
:publish SKIPPED

Signed-off-by: Mudit Chaudhary <chmudit@amazon.com>
Signed-off-by: Mudit Chaudhary <chmudit@amazon.com>
@muditchaudhary muditchaudhary marked this pull request as ready for review March 12, 2025 20:16
Signed-off-by: Mudit Chaudhary <chmudit@amazon.com>
@muditchaudhary muditchaudhary merged commit 6129c03 into cedar-policy:main Mar 13, 2025
4 checks passed
muditchaudhary added a commit to muditchaudhary/cedar-java that referenced this pull request Mar 13, 2025
Signed-off-by: Mudit Chaudhary <chmudit@amazon.com>
@muditchaudhary muditchaudhary mentioned this pull request Mar 13, 2025
muditchaudhary added a commit that referenced this pull request Mar 13, 2025
Signed-off-by: Mudit Chaudhary <chmudit@amazon.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants