Skip to content

Conversation

@jyjeanne
Copy link

@jyjeanne jyjeanne commented Jan 15, 2026

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 on lines +2 to +4
repositories {
mavenCentral()
}
Copy link
Member

Choose a reason for hiding this comment

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

@jyjeanne This seems to duplicate the existing repositories entry on lines 8–10/16–18 below. Should we remove that, or do we need both?

Copy link
Author

Choose a reason for hiding this comment

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

@infotexture I've verified that the project-level repositories block is not needed:

  • The buildscript { repositories { } } is only required for Saxon-HE (used by the inline XsltTransformTask)
  • The dita-ot-gradle plugin doesn't require project-level repositories

I've removed the duplicate block. The build still works correctly with Gradle 8.x and 9.x.

@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
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