Skip to content

Commit

Permalink
Migrate deprecated buildDir
Browse files Browse the repository at this point in the history
  • Loading branch information
Goooler committed Jan 30, 2024
1 parent 213819b commit 376071d
Show file tree
Hide file tree
Showing 10 changed files with 16 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down
2 changes: 1 addition & 1 deletion build-logic/src/main/groovy/org.apache.groovy-core.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()}"
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}

Expand Down
2 changes: 1 addition & 1 deletion gradle/eclipse.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
6 changes: 3 additions & 3 deletions subprojects/binary-compatibility/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 376071d

Please sign in to comment.