-
Notifications
You must be signed in to change notification settings - Fork 99
Test jyjeanne/dita-ot-gradle 2.2.0
#645
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: feature/gradle-9-compatibility
Are you sure you want to change the base?
Test jyjeanne/dita-ot-gradle 2.2.0
#645
Conversation
Per https://github.com/jyjeanne/dita-ot-gradle#quick-migration-tldr Signed-off-by: Roger Sheen <[email protected]>
|
|
||
| // Set DITA-OT directory: pass as parameter -PditaHome or fall back to parent when run in core repo. | ||
| ditaOt.dir ditaHome | ||
| // > Could not get unknown property 'ditaOt' for root project 'docs' of type org.gradle.api.Project. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jyjeanne I usually run the default docs build task and pass the path to DITA-OT on the CLI like this:
./gradlew -PditaHome=../dita-ot/src/main
Any idea why this is failing? 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@infotexture The migration from the eerohele Gradle plugin to the new Gradle plugin introduced an API incompatibility. The two plugins have different configuration approaches:
eerohele Plugin (v0.7.1) - Old API
plugins {
id 'com.github.eerohele.dita-ot-gradle' version '0.7.1'
}
// Global DITA-OT directory configuration
ditaOt.dir ditaHomejyjeanne Plugin (v2.2.2) - New API
plugins {
id 'io.github.jyjeanne.dita-ot-gradle' version '2.2.2'
}
// DITA-OT must be configured per-task, not globally
task pdf(type: DitaOtTask) {
ditaOt file(findProperty('ditaHome') ?: ditaHome)
input 'my.ditamap'
transtype 'pdf'
}The Issue: Line 45 of build.gradle was still using the old eerohele API (ditaOt.dir), but the new jyjeanne plugin doesn't provide a root-level ditaOt extension.The ditaOt extension is no longer available at the root level. Each DitaOtTask must now explicitly configure its own DITA-OT directory..The ditaOt property expects a File object, not a String. The jyjeanne plugin is stricter about types than the old eerohele plugin.
Solution
File: build.gradle
Updated all four DitaOtTasks with the correct File type conversion:
1. pdf task (line 100):
task pdf(type: DitaOtTask, dependsOn: autoGenerate) {
ditaOt file(findProperty('ditaHome') ?: ditaHome)
input "${projectDirPath}/userguide-book.ditamap"
output outputDir
transtype 'pdf'
filter "${projectDirPath}/resources/pdf.ditaval"
// ... properties ...
}2. html task (line 116):
task html(type: DitaOtTask, dependsOn: autoGenerate) {
ditaOt file(findProperty('ditaHome') ?: ditaHome)
input "${projectDirPath}/userguide.ditamap"
output outputDir
transtype 'html5'
filter "${projectDirPath}/resources/html.ditaval"
// ... properties ...
}3. htmlhelp task (line 136):
task htmlhelp(type: DitaOtTask, dependsOn: autoGenerate) {
ditaOt file(findProperty('ditaHome') ?: ditaHome)
input "${projectDirPath}/userguide.ditamap"
output outputDir
transtype 'htmlhelp'
filter ditavalFile
// ... properties ...
}4. site task (line 202):
task site(type: DitaOtTask) {
ditaOt file(findProperty('ditaHome') ?: ditaHome)
dependsOn 'messages', 'params', 'extensionPoints', 'gitMetadata'
input file("${projectDirPath}/site.ditamap")
output getPropertyOrDefault('outputDir', "${buildDir}/site")
filter "${projectDirPath}/resources/site.ditaval"
// ... properties ...
}Verification & Testing Results
Test 1: Configuration Validation ✅
$ ./gradlew build --dry-run
✅ BUILD SUCCESSFUL in 5sConfirmed that Gradle configuration is correct and all tasks are recognized.
Test 2: With Gradle Property Parameter ✅
$ ./gradlew -PditaHome="C:\dita-ot\dita-ot-4.3.5" build --dry-run
✅ BUILD SUCCESSFUL in 4sConfirmed that the file() wrapper correctly converts the string path to a File object.
Test 3: Full Build Execution ✅
$ ./gradlew -PditaHome="C:\dita-ot\dita-ot-4.3.5" --no-configuration-cache
✅ Configuration: SUCCESSFUL ✅
✅ autoGenerate task: SUCCESSFUL ✅
✅ pdf task: Started correctly
✅ html task: Started correctly (reached DITA-OT execution)Why This Matters
The migration to new plugin was necessary to support Gradle 8 & 9 compatibility with proper deprecation fixes. The new plugin has a more explicit, per-task configuration model which is:
- More flexible: Different tasks can use different DITA-OT versions if needed
- More transparent: Each task clearly declares its dependencies
NB : i still have some imcompatibility on gradle cache configuration
@infotexture I have tested directly on docs project this bug fix , can you hear me if it works on your side ?
|
@infotexture i made some improvment on latest version 2.30 and solve problem on cache configuration , can you try with this new version of the plugin : https://github.com/jyjeanne/dita-ot-gradle/releases/tag/v2.3.0 ? |
Description
Test
jyjeanne/dita-ot-gradleper dita-ot/discussions/4722 & jyjeanne/dita-ot-gradle#quick-migration-tldr.Motivation and Context
Confirm whether the new jyjeanne/dita-ot-gradle Gradle plugin works in our environment to take advantage of recent Gradle features that are not supported by the original eerohele/dita-ot-gradle plugin.
How Has This Been Tested?
Result
❌ Build fails: