Skip to content

Improve Gradle 9 compatibility#658

Merged
infotexture merged 2 commits into
dita-ot:developfrom
jyjeanne:develop
Jan 19, 2026
Merged

Improve Gradle 9 compatibility#658
infotexture merged 2 commits into
dita-ot:developfrom
jyjeanne:develop

Conversation

@jyjeanne

@jyjeanne jyjeanne commented Jan 15, 2026

Copy link
Copy Markdown
Contributor

Description

@infotexture Upgrade build.gradle to be fully compatible with Gradle 9.0 and Gradle's Configuration Cache.

Key changes:

  • Replace saxon-gradle plugin with an inline XsltTransformTask class (saxon-gradle is not Configuration Cache compatible)
  • Replace deprecated project.exec() with providers.exec() for git commit hash retrieval
  • Replace deprecated buildDir with layout.buildDirectory
  • Use project.layout.projectDirectory.file() in DSL methods for Configuration Cache compatibility
  • Replace internal org.gradle.internal.os.OperatingSystem API with System.getProperty('os.name')
  • Add proper error handling, task groups, and descriptions

Motivation and Context

Gradle 9.0 removes several deprecated APIs and makes Configuration Cache the recommended execution mode. The previous build had two incompatibilities:

  1. exec deprecation: project.exec() was deprecated in Gradle 8.x and removed in Gradle 9.0
  2. Saxon-Gradle incompatibility: The eerohele/saxon-gradle plugin stores non-serializable XmlSlurper objects, breaking Configuration Cache

This change ensures the documentation build continues to work with Gradle 9.0+.

How Has This Been Tested?

Test Gradle 8.14.3 Gradle 9.0.0
./gradlew help --warning-mode all PASS PASS
./gradlew help --warning-mode fail PASS PASS
./gradlew --configuration-cache (store) PASS PASS
./gradlew --configuration-cache (reuse) PASS PASS
./gradlew generatePlatformFilter gitMetadata PASS PASS

Note: Full dist build requires DITA-OT installation and was not tested in isolation.

Type of Changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)

Documentation and Compatibility

  • What documentation changes are needed for this feature?
    • None required - this is a build infrastructure change only
  • Will this change affect backwards compatibility or other users' overrides?
    • No impact on documentation output
    • Maintains backward compatibility with Gradle 8.x
    • Enables forward compatibility with Gradle 9.x
    • The XsltTransformTask DSL is identical to the previous SaxonXsltTask

Comment thread build.gradle
@infotexture infotexture linked an issue Jan 18, 2026 that may be closed by this pull request
Jeremy Jeanne added 2 commits January 19, 2026 00:34
Signed-off-by: Jeremy Jeanne <jeremy.jeanne@4dconcept.fr>
Signed-off-by: Jeremy Jeanne <jeremy.jeanne@4dconcept.fr>

@infotexture infotexture left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Tested distribution build with feature/gradle9 branch from dita-ot/dita-ot#4740.

✅ Works, no more deprecation messages from Gradle 9. 🎉

Thanks @jyjeanne! 🙏

Merging…

@infotexture
infotexture merged commit 2a83b19 into dita-ot:develop Jan 19, 2026
4 checks passed
infotexture added a commit that referenced this pull request Jan 19, 2026
Run the Gradle `wrapper` task twice to update the distribution version & regenerate wrapper to pick up
recent changes per https://docs.gradle.org/current/userguide/gradle_wrapper.html#sec:upgrading_wrapper

    ./gradlew wrapper --gradle-version latest
    ./gradlew wrapper --gradle-version latest

https://docs.gradle.org/9.3.0/release-notes.html

Followup to #658

Signed-off-by: Roger Sheen <roger@infotexture.net>
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.

Solution to solve compatibility issue with Gradle 9

2 participants