Skip to content

Comments

Support rust version constraint#29

Merged
andrefigas merged 1 commit intomainfrom
feature/support_rust_version_constraint
Apr 14, 2025
Merged

Support rust version constraint#29
andrefigas merged 1 commit intomainfrom
feature/support_rust_version_constraint

Conversation

@andrefigas
Copy link
Owner

This PR implements support for validating the Rust toolchain version used in the local environment, based on a version constraint defined by the user in the Gradle configuration.

Projects can now declare which Rust version is considered compatible using the rustVersion property inside the rustJni extension block. Supported formats include:

Exact version: "1.86.0"

Minimum version: ">=1.64.0"

Wildcard versions: "1.86.", "1..*"

If the installed Rust version does not match the constraint, the build will fail with a clear and actionable error message.

This validation runs after the project is evaluated, ensuring that any value provided by the user is respected before checking.

📌 Solves: #28

🛠️ Implementation Note
Previously, the plugin accessed values from the rustJni extension immediately during apply(project), which caused it to read default values before the user-defined configuration in build.gradle.kts was applied.

This PR moves all logic that depends on user-defined values (such as version validation) into an afterEvaluate block. This ensures that the plugin uses the final, user-configured values from the build script, avoiding incorrect or premature validation.

@andrefigas andrefigas added the enhancement New feature or request label Apr 11, 2025
@andrefigas andrefigas requested a review from Megadash452 April 11, 2025 23:03
@andrefigas andrefigas self-assigned this Apr 12, 2025
@andrefigas andrefigas merged commit badeb51 into main Apr 14, 2025
1 check passed
@andrefigas andrefigas deleted the feature/support_rust_version_constraint branch April 14, 2025 16:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant