diff --git a/build.gradle b/build.gradle index 729ad205..8bffbffa 100644 --- a/build.gradle +++ b/build.gradle @@ -8,7 +8,7 @@ buildscript { } plugins { - id 'io.github.jyjeanne.dita-ot-gradle' version '2.3.2' + id 'io.github.jyjeanne.dita-ot-gradle' version '2.8.2' // Removed: 'com.github.eerohele.saxon-gradle' - not Configuration Cache compatible // Replaced with: inline XsltTransformTask class below } @@ -187,14 +187,12 @@ task autoGenerate(dependsOn: [messages, params, extensionPoints, generatePlatfor task pdf(type: DitaOtTask, dependsOn: autoGenerate) { group = 'documentation' description = 'Build PDF documentation.' - // Set DITA-OT directory: pass as parameter -PditaHome or fall back to parent when run in core repo. ditaOt file(findProperty('ditaHome') ?: ditaHome) input "${projectDirPath}/userguide-book.ditamap" output outputDir transtype 'pdf' filter "${projectDirPath}/resources/pdf.ditaval" - // Use ditaProperties MapProperty directly for v2.3.0 compatibility ditaProperties.put('args.chapter.layout', 'BASIC') ditaProperties.put('args.gen.task.lbl', 'YES') ditaProperties.put('include.rellinks', '#default external') @@ -205,14 +203,12 @@ task pdf(type: DitaOtTask, dependsOn: autoGenerate) { task html(type: DitaOtTask, dependsOn: autoGenerate) { group = 'documentation' description = 'Build HTML5 documentation.' - // Set DITA-OT directory: pass as parameter -PditaHome or fall back to parent when run in core repo. ditaOt file(findProperty('ditaHome') ?: ditaHome) input "${projectDirPath}/userguide.ditamap" output outputDir transtype 'html5' filter "${projectDirPath}/resources/html.ditaval" - // Use ditaProperties MapProperty directly for v2.3.0 compatibility ditaProperties.put('args.copycss', 'yes') ditaProperties.put('args.css', 'dita-ot-doc.css') ditaProperties.put('args.csspath', 'css') @@ -227,14 +223,12 @@ task html(type: DitaOtTask, dependsOn: autoGenerate) { task htmlhelp(type: DitaOtTask, dependsOn: autoGenerate) { group = 'documentation' description = 'Build HTML Help (.chm) documentation.' - // Set DITA-OT directory: pass as parameter -PditaHome or fall back to parent when run in core repo. ditaOt file(findProperty('ditaHome') ?: ditaHome) input "${projectDirPath}/userguide.ditamap" output outputDir transtype 'htmlhelp' filter ditavalFile - // Use ditaProperties MapProperty directly for v2.3.0 compatibility ditaProperties.put('args.copycss', 'yes') ditaProperties.put('args.css', 'dita-ot-doc.css') ditaProperties.put('args.csspath', 'css') @@ -256,16 +250,13 @@ task htmlhelp(type: DitaOtTask, dependsOn: autoGenerate) { } } -task cleanOutput { +task cleanOutput(type: Delete) { group = 'build' description = 'Delete the output directory.' - doLast { - delete outputDir - } + delete file(outputDir) } // Get git commit hash using Gradle 9 compatible Provider API -// Uses providers.exec() instead of deprecated project.exec() def gitCommitHash = providers.exec { commandLine 'git', 'rev-parse', 'HEAD' ignoreExitValue = true @@ -274,13 +265,10 @@ def gitCommitHash = providers.exec { task gitMetadata { group = 'build' description = 'Log git commit metadata.' - // This task just logs the git commit for reference doLast { logger.lifecycle("Git commit: ${gitCommitHash}") } - - // Mark outputs to help with up-to-date checking - outputs.upToDateWhen { false } // Always run since git commit changes frequently + outputs.upToDateWhen { false } } task site(type: DitaOtTask) { @@ -288,26 +276,30 @@ task site(type: DitaOtTask) { description = 'Build website documentation.' dependsOn 'messages', 'params', 'extensionPoints', 'gitMetadata' - // Set DITA-OT directory: pass as parameter -PditaHome or fall back to parent when run in core repo. ditaOt file(findProperty('ditaHome') ?: ditaHome) input file("${projectDirPath}/site.ditamap") output getPropertyOrDefault('outputDir', layout.buildDirectory.dir("site").get().asFile.path) filter "${projectDirPath}/resources/site.ditaval" - transtype 'org.dita-ot.html' // Evaluate the noCommitMeta flag at configuration time def includeCommitMeta = !providers.gradleProperty('noCommitMeta').map { Boolean.parseBoolean(it) }.getOrElse(false) - // Use ditaProperties MapProperty directly for v2.3.0 compatibility ditaProperties.put('args.gen.task.lbl', 'YES') ditaProperties.put('args.rellinks', 'noparent') if (includeCommitMeta) { - // Use the git commit hash obtained at configuration time ditaProperties.put('commit', gitCommitHash) } } +// ============================================================================= +// Verification Tasks (v2.8.1 features) +// ============================================================================= + +// ============================================================================= +// Aggregate Tasks +// ============================================================================= + task all(dependsOn: [pdf, html, htmlhelp]) { group = 'documentation' description = 'Build all documentation formats (PDF, HTML, HTMLHelp).' diff --git a/gradle.properties b/gradle.properties index f8f1fc68..f4ad7c61 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,10 +1,7 @@ # Fix Java memory errors with Gradle 5.2 org.gradle.jvmargs = -Xmx1024m -# Gradle 8 features for better performance and caching -# ↓ Not supported by eerohele/dita-ot-gradle ↓ -# org.gradle.configuration-cache=true -# org.gradle.configuration-cache.problems=warn -# ↑ Not supported by eerohele/dita-ot-gradle ↑ +# Gradle 9 features for better performance and caching +org.gradle.configuration-cache=true org.gradle.parallel=true org.gradle.caching=true