Skip to content

Commit 9dce4fc

Browse files
committed
build: fix deprecated project references in Gradle tasks
Replaced deprecated project.buildDir and project.projectDir with layout.buildDirectory and layout.projectDirectory to avoid execution-time access. This fixes Gradle 8.x deprecation warnings and ensures compatibility with future Gradle versions that will enforce configuration cache.
1 parent 3f123ce commit 9dce4fc

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

docs/build.gradle

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ node {
2222
version = nodeVersion
2323
npmVersion = project.ext.npmVersion
2424
download = true
25-
nodeProjectDir = file("${project.projectDir}")
25+
nodeProjectDir = layout.projectDirectory.asFile
2626
}
2727

2828
// Install Antora CLI and generator
@@ -42,11 +42,11 @@ task copyJavadocs(type: Copy) {
4242
dependsOn ':aggregateJavadoc', ':generateModuleJavadocs'
4343

4444
from rootProject.layout.buildDirectory.dir('docs/javadoc')
45-
into "${project.projectDir}/content/modules/ROOT/attachments/javadoc"
45+
into layout.projectDirectory.dir("content/modules/ROOT/attachments/javadoc")
4646

4747
doFirst {
48-
mkdir "${project.projectDir}/content/modules/ROOT/attachments"
49-
mkdir "${project.projectDir}/content/modules/ROOT/attachments/javadoc"
48+
mkdir layout.projectDirectory.dir("content/modules/ROOT/attachments").asFile
49+
mkdir layout.projectDirectory.dir("content/modules/ROOT/attachments/javadoc").asFile
5050
logger.lifecycle("Copying Javadoc documentation to Antora attachments...")
5151
}
5252
}
@@ -65,12 +65,10 @@ task generateSite(type: NodeTask) {
6565
'--to-dir=build/site'
6666
]
6767

68-
// Capture buildDir at configuration time to avoid execution-time project access
69-
def buildDirectory = project.buildDir
70-
outputs.dir("${buildDirectory}/site")
68+
outputs.dir(layout.buildDirectory.dir("site"))
7169

7270
doFirst {
73-
mkdir "${buildDirectory}/site"
71+
mkdir layout.buildDirectory.dir("site").get().asFile
7472
logger.lifecycle("Building multi-version documentation with Antora...")
7573
}
7674
}
@@ -82,7 +80,7 @@ assemble.dependsOn generateSite
8280
// Clean up Antora-related directories when cleaning the project
8381
clean {
8482
delete 'node_modules'
85-
delete project.buildDir
86-
delete "${project.projectDir}/content/modules/ROOT/assets/javadoc"
87-
delete "${project.projectDir}/content/modules/ROOT/attachments/javadoc"
83+
delete layout.buildDirectory
84+
delete layout.projectDirectory.dir("content/modules/ROOT/assets/javadoc")
85+
delete layout.projectDirectory.dir("content/modules/ROOT/attachments/javadoc")
8886
}

0 commit comments

Comments
 (0)