Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 12 additions & 20 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down Expand Up @@ -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')
Expand All @@ -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')
Expand All @@ -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')
Expand All @@ -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
Expand All @@ -274,40 +265,41 @@ 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) {
group = 'documentation'
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
// =============================================================================

Comment on lines +295 to +302
Copy link
Member

Choose a reason for hiding this comment

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

I'll strip these unnecessary comment remnants after merging.

task all(dependsOn: [pdf, html, htmlhelp]) {
group = 'documentation'
description = 'Build all documentation formats (PDF, HTML, HTMLHelp).'
Expand Down
7 changes: 2 additions & 5 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -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