diff --git a/build-logic/src/main/groovy/org.apache.groovy-asciidoctor.gradle b/build-logic/src/main/groovy/org.apache.groovy-asciidoctor.gradle index aa6be76ebcc..7c15f854a4f 100644 --- a/build-logic/src/main/groovy/org.apache.groovy-asciidoctor.gradle +++ b/build-logic/src/main/groovy/org.apache.groovy-asciidoctor.gradle @@ -53,14 +53,14 @@ asciidoctor { sources { include '*.adoc' } - outputDir = "$buildDir/asciidoc/html5" + outputDir = layout.buildDirectory.dir("asciidoc/html5") resources { duplicatesStrategy = DuplicatesStrategy.WARN from("${rootProject.projectDir}/src/spec/doc/assets") { include 'css/style.css' } - from("$buildDir/tmp/asciidoctor-assets") + from layout.buildDirectory.dir("tmp/asciidoctor-assets") into 'assets' } forkOptions { @@ -126,7 +126,7 @@ asciidoctor.onlyIf { project.file('src/spec/doc').exists() } def asciidoctorAssets = tasks.register("asciidoctorAssets", Copy) { from project.fileTree('src/spec/doc/assets') - into "$buildDir/tmp/asciidoctor-assets" + into layout.buildDirectory.dir("tmp/asciidoctor-assets") } asciidoctor.dependsOn asciidoctorAssets diff --git a/build-logic/src/main/groovy/org.apache.groovy-common.gradle b/build-logic/src/main/groovy/org.apache.groovy-common.gradle index 4665e3cffc1..a8bfd47c9c1 100644 --- a/build-logic/src/main/groovy/org.apache.groovy-common.gradle +++ b/build-logic/src/main/groovy/org.apache.groovy-common.gradle @@ -34,7 +34,7 @@ plugins { } if (project == rootProject) { - def sharedConfiguration = project.extensions.create('sharedConfiguration', SharedConfiguration, project.objects, rootProject.layout, project.providers, rootProject.buildDir, rootProject.logger, gradle.startParameter) + def sharedConfiguration = project.extensions.create('sharedConfiguration', SharedConfiguration, project.objects, rootProject.layout, project.providers, rootProject.layout.buildDirectory.get().asFile, rootProject.logger, gradle.startParameter) project.extensions.create('versions', Versions, sharedConfiguration, project.providers, project.layout) } diff --git a/build-logic/src/main/groovy/org.apache.groovy-core.gradle b/build-logic/src/main/groovy/org.apache.groovy-core.gradle index ed7be8ef3d4..e0d9526b147 100644 --- a/build-logic/src/main/groovy/org.apache.groovy-core.gradle +++ b/build-logic/src/main/groovy/org.apache.groovy-core.gradle @@ -197,7 +197,7 @@ tasks.withType(Test).configureEach { def generateGrammarSourceTask = tasks.named("generateGrammarSource") { maxHeapSize = '1g' outputs.cacheIf { true } - outputDirectory = file("${buildDir}/generated/sources/antlr4") + outputDirectory = layout.buildDirectory.dir("generated/sources/antlr4").get().asFile final PARSER_PACKAGE_NAME = 'org.apache.groovy.parser.antlr4' arguments += ["-visitor", "-no-listener", "-package", PARSER_PACKAGE_NAME] diff --git a/build-logic/src/main/groovy/org.apache.groovy-distribution.gradle b/build-logic/src/main/groovy/org.apache.groovy-distribution.gradle index 2e4ff94bfcc..86ef78528b1 100644 --- a/build-logic/src/main/groovy/org.apache.groovy-distribution.gradle +++ b/build-logic/src/main/groovy/org.apache.groovy-distribution.gradle @@ -181,7 +181,7 @@ tasks.register('dist') { tasks.register("installGroovy", Sync) { duplicatesStrategy = DuplicatesStrategy.FAIL - def installDir = sharedConfiguration.installationDirectory.orElse(project.layout.buildDir.file("install")) + def installDir = sharedConfiguration.installationDirectory.orElse(layout.buildDirectory.dir("install").get().asFile) description 'Generates a groovy distribution into an install directory' doLast { logger.lifecycle "Groovy installed under ${installDir.get()}" @@ -204,7 +204,7 @@ tasks.named('asciidoctorPdf') { baseDirFollowsSourceFile() logDocuments = true sourceDir = file('src/spec/doc') - outputDir = "$buildDir/asciidocAll/pdf" + outputDir = layout.buildDirectory.dir("asciidocAll/pdf") } // The Groovy distribution module isn't a Java library diff --git a/build-logic/src/main/groovy/org.apache.groovy-doc-aggregator.gradle b/build-logic/src/main/groovy/org.apache.groovy-doc-aggregator.gradle index f949a6744a6..d72ec835a40 100644 --- a/build-logic/src/main/groovy/org.apache.groovy-doc-aggregator.gradle +++ b/build-logic/src/main/groovy/org.apache.groovy-doc-aggregator.gradle @@ -71,7 +71,7 @@ def sourcesAllJar = tasks.register("sourcesAllJar", Jar) { } def javadocAll = tasks.register("javadocAll", Javadoc) { - destinationDir = file("$buildDir/alljavadoc") + destinationDir = layout.buildDirectory.dir("alljavadoc").get().asFile source configurations.allSources classpath = configurations.allSourcesRuntimeClasspath + configurations.allSources docAggregation.excludedFromJavadocs.each { @@ -85,7 +85,7 @@ def javadocAllJar = tasks.register("javadocAllJar", Jar) { } def groovydocAll = tasks.register("groovydocAll", Groovydoc) { - destinationDir = file("${buildDir}/allgroovydoc") + destinationDir = layout.buildDirectory.dir("allgroovydoc").get().asFile source = configurations.allSources classpath = configurations.allSourcesRuntimeClasspath includeAuthor = false diff --git a/build-logic/src/main/groovy/org.apache.groovy-performance.gradle b/build-logic/src/main/groovy/org.apache.groovy-performance.gradle index 7b1f726d45a..10954a444f4 100644 --- a/build-logic/src/main/groovy/org.apache.groovy-performance.gradle +++ b/build-logic/src/main/groovy/org.apache.groovy-performance.gradle @@ -70,7 +70,7 @@ tasks.named('compileJmhGroovy') { tasks.register('displayJmhResults') { doLast { - println file("$buildDir/results/jmh/results.txt").text + println layout.buildDirectory.file("results/jmh/results.txt").get().asFile.text } } diff --git a/build-logic/src/main/groovy/org.apache.groovy-published-library.gradle b/build-logic/src/main/groovy/org.apache.groovy-published-library.gradle index 6b9a028c949..c21e4b33961 100644 --- a/build-logic/src/main/groovy/org.apache.groovy-published-library.gradle +++ b/build-logic/src/main/groovy/org.apache.groovy-published-library.gradle @@ -20,7 +20,7 @@ publishing { repositories { maven { name "LocalFile" - url "${rootProject.buildDir}/repo" + url rootProject.layout.buildDirectory.dir("repo").get().asFile.absolutePath } maven { name "Apache" diff --git a/build.gradle b/build.gradle index 78dad9a0a82..2272c3e9cfe 100644 --- a/build.gradle +++ b/build.gradle @@ -254,7 +254,7 @@ sonarqube { property "sonar.organization", "apache" property "sonar.host.url", "https://sonarcloud.io" property "sonar.cpd.exclusions", "**/*" -// property "sonar.coverage.jacoco.xmlReportPaths", "${rootProject.buildDir}/reports/jacoco/jacocoAllReport/jacocoAllReport.xml" +// property "sonar.coverage.jacoco.xmlReportPaths", layout.buildDirectory.file("reports/jacoco/jacocoAllReport/jacocoAllReport.xml").get().asFile.absolutePath } } diff --git a/gradle/eclipse.gradle b/gradle/eclipse.gradle index 8407596e083..700f9c3cd90 100644 --- a/gradle/eclipse.gradle +++ b/gradle/eclipse.gradle @@ -128,7 +128,7 @@ if (gradle.startParameter.taskNames.any { it =~ /(?i)eclipse/ }) { } } - sourceSets.main.java.srcDirs += "${buildDir}/generated/sources/antlr4" + sourceSets.main.java.srcDirs += layout.buildDirectory.dir('generated/sources/antlr4') eclipseClasspath.dependsOn(generateGrammarSource) } diff --git a/subprojects/binary-compatibility/build.gradle b/subprojects/binary-compatibility/build.gradle index f9f9b641a2c..edfe9b41295 100644 --- a/subprojects/binary-compatibility/build.gradle +++ b/subprojects/binary-compatibility/build.gradle @@ -56,12 +56,12 @@ rootProject.allprojects { packageExcludes = ["**internal**", "groovyjarjar**"] // TODO consider using rich report but we need to add a custom rule first // richReport { -// destinationDir = file("${thisProject.buildDir}/reports/") +// destinationDir = layout.buildDirectory.dir("reports") // reportName = "${taskName}.html" // } - htmlOutputFile = file("${thisProject.buildDir}/reports/${taskName}.html") + htmlOutputFile = layout.buildDirectory.file("reports/${taskName}.html").get().asFile // uncomment below if also wanting text only output -// txtOutputFile = file("${thisProject.buildDir}/reports/${taskName}.txt") +// txtOutputFile = layout.buildDirectory.file("${thisProject.buildDir}/reports/${taskName}.txt").get().asFile } checkBinaryCompatibility.configure { dependsOn(singleProjectCheck)