Prepare Gradle build scripts for Gradle 10#5
Merged
Conversation
Gradle 9.6.1 deprecates the Kotlin DSL property-delegate syntax (removal in
Gradle 10):
- `val x by tasks.registering { }` -> `val x = tasks.register("x") { }`
- `val x: String by settings` -> `providers.gradleProperty("x").get()`
- `val x: String by project` -> `providers.gradleProperty("x").get()`
Switch the task declarations in hello-xtc and the localOnly property reads in
settings.gradle.kts / hello-xtc/build.gradle.kts to the recommended APIs,
matching xtclang/xvm#494. localOnly is always defined in gradle.properties, so
.get() preserves the previous fail-fast behavior.
Verified: `./gradlew build --warning-mode fail` is BUILD SUCCESSFUL with no
deprecation warnings.
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.
Follow-up to the Gradle 9.6.1 upgrade (#4, already merged): remove the Kotlin DSL property-delegate syntax that Gradle 9.6.1 deprecates and Gradle 10 removes, so the build is Gradle-10-ready and warning-free. Same change as xtclang/xvm#494.
Changes
hello-xtc/build.gradle.kts:val printVersionInfo by tasks.registering { }andval greet by tasks.registering { }→val x = tasks.register("x") { }.hello-xtc/build.gradle.kts+settings.gradle.kts: thelocalOnlyproperty reads (val localOnly: String by project/by settings) →providers.gradleProperty("localOnly").get().localOnly=falseis always defined ingradle.properties, so.get()preserves the previous fail-fast behavior and the existingproviders.gradleProperty(...)idiom already used in this file.Verification
./gradlew build --warning-mode fail— BUILD SUCCESSFUL with no deprecation warnings (the flag fails the build on any deprecation).by tasks/configurations/settings/project/extradelegate declarations remain.