Fix deprecated buildDir warning in gradle scripts (#9472)
This commit is contained in:
parent
50e8d815e2
commit
913bebb979
|
@ -113,7 +113,7 @@ afterEvaluate {
|
|||
// We do fine-grained filtering of the classpath of this codebase's sources since Gradle's
|
||||
// configurations will include transitive dependencies as well, which tests do often need.
|
||||
classpath = classpath.filter {
|
||||
if (file("$buildDir/resources/main").equals(it) || file("$buildDir/classes/java/main").equals(it)) {
|
||||
if (file(layout.buildDirectory.dir("resources/main")).equals(it) || file(layout.buildDirectory.dir("classes/java/main")).equals(it)) {
|
||||
// The sources are packaged into the testing jar, so we need to exclude them from the test
|
||||
// classpath, which automatically inherits them, to ensure our shaded versions are used.
|
||||
return@filter false
|
||||
|
|
|
@ -13,7 +13,7 @@ tasks {
|
|||
reports {
|
||||
xml.required.set(true)
|
||||
csv.required.set(false)
|
||||
html.outputLocation.set(file("$buildDir/reports/jacoco/"))
|
||||
html.outputLocation.set(layout.buildDirectory.dir("reports/jacoco/"))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,8 +25,8 @@ jmh {
|
|||
}
|
||||
|
||||
jmhReport {
|
||||
jmhResultPath = file("$buildDir/results/jmh/results.json").absolutePath
|
||||
jmhReportOutput = file("$buildDir/results/jmh").absolutePath
|
||||
jmhResultPath = layout.buildDirectory.file("results/jmh/results.json").get().asFile.absolutePath
|
||||
jmhReportOutput = layout.buildDirectory.file("results/jmh").get().asFile.absolutePath
|
||||
}
|
||||
|
||||
tasks {
|
||||
|
|
|
@ -89,7 +89,7 @@ tasks {
|
|||
dependsOn(tasks.relocateJavaagentLibs)
|
||||
with isolateClasses(tasks.relocateJavaagentLibs.outputs.files)
|
||||
|
||||
into("$buildDir/isolated/javaagentLibs")
|
||||
into(layout.buildDirectory.dir("isolated/javaagentLibs"))
|
||||
}
|
||||
|
||||
// 3. the relocated and isolated javaagent libs are merged together with the bootstrap libs (which undergo relocation
|
||||
|
|
|
@ -60,7 +60,7 @@ tasks.withType(Test).configureEach {
|
|||
// The sources are packaged into the testing jar so we need to make sure to exclude from the test
|
||||
// classpath, which automatically inherits them, to ensure our shaded versions are used.
|
||||
classpath = classpath.filter {
|
||||
if (it == file("$buildDir/resources/main") || it == file("$buildDir/classes/java/main")) {
|
||||
if (it == file(layout.buildDirectory.dir("resources/main")) || it == file(layout.buildDirectory.dir("classes/java/main"))) {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
|
|
|
@ -86,7 +86,7 @@ tasks {
|
|||
dependsOn(tasks.relocateJavaagentLibs)
|
||||
with isolateClasses(tasks.relocateJavaagentLibs.outputs.files)
|
||||
|
||||
into("$buildDir/isolated/javaagentLibs")
|
||||
into(layout.buildDirectory.dir("isolated/javaagentLibs"))
|
||||
}
|
||||
|
||||
// 3. the relocated and isolated javaagent libs are merged together with the bootstrap libs (which undergo relocation
|
||||
|
|
|
@ -21,7 +21,7 @@ muzzle {
|
|||
sourceSets {
|
||||
create("testapp") {
|
||||
java {
|
||||
destinationDirectory.set(file("$buildDir/testapp/classes"))
|
||||
destinationDirectory.set(layout.buildDirectory.dir("testapp/classes"))
|
||||
}
|
||||
resources {
|
||||
srcDirs("src/webapp")
|
||||
|
@ -54,7 +54,7 @@ dependencies {
|
|||
testImplementation("org.eclipse.jetty:jetty-webapp:9.4.35.v20201120")
|
||||
}
|
||||
|
||||
val warDir = file("$buildDir/testapp/war")
|
||||
val warDir = layout.buildDirectory.dir("testapp/war")
|
||||
|
||||
val launcher = javaToolchains.launcherFor {
|
||||
languageVersion.set(JavaLanguageVersion.of(8))
|
||||
|
@ -63,11 +63,11 @@ val launcher = javaToolchains.launcherFor {
|
|||
class CompilerArgumentsProvider : CommandLineArgumentProvider {
|
||||
override fun asArguments(): Iterable<String> = listOf(
|
||||
"test.gwt.Greeting", // gwt module
|
||||
"-war", "$buildDir/testapp/war",
|
||||
"-war", layout.buildDirectory.dir("testapp/war").get().asFile.absolutePath,
|
||||
"-logLevel", "INFO",
|
||||
"-localWorkers", "2",
|
||||
"-compileReport",
|
||||
"-extra", "$buildDir/testapp/extra",
|
||||
"-extra", layout.buildDirectory.dir("testapp/extra").get().asFile.absolutePath,
|
||||
"-draftCompile", // makes compile a bit faster
|
||||
)
|
||||
}
|
||||
|
@ -94,7 +94,7 @@ tasks {
|
|||
from(file("src/testapp/webapp"))
|
||||
from(warDir)
|
||||
|
||||
into(file("$buildDir/testapp/web"))
|
||||
into(file(layout.buildDirectory.dir("testapp/web")))
|
||||
}
|
||||
|
||||
test {
|
||||
|
@ -102,7 +102,7 @@ tasks {
|
|||
dependsOn(copyTestWebapp)
|
||||
|
||||
// add test app classes to classpath
|
||||
classpath = sourceSets.test.get().runtimeClasspath.plus(files("$buildDir/testapp/classes"))
|
||||
classpath = sourceSets.test.get().runtimeClasspath.plus(files(layout.buildDirectory.dir("testapp/classes")))
|
||||
|
||||
usesService(gradle.sharedServices.registrations["testcontainersBuildService"].service)
|
||||
}
|
||||
|
|
|
@ -32,14 +32,16 @@ tasks {
|
|||
// that breaks deploy on embedded wildfly
|
||||
// create a copy of logback-classic jar that does not have this file
|
||||
val modifyLogbackJar by registering(Jar::class) {
|
||||
destinationDirectory.set(file("$buildDir/tmp"))
|
||||
destinationDirectory.set(layout.buildDirectory.dir("tmp"))
|
||||
archiveFileName.set("logback-classic-modified.jar")
|
||||
exclude("/META-INF/services/javax.servlet.ServletContainerInitializer")
|
||||
doFirst {
|
||||
configurations.configureEach {
|
||||
if (name.lowercase().endsWith("testruntimeclasspath")) {
|
||||
val logbackJar = find { it.name.contains("logback-classic") }
|
||||
from(zipTree(logbackJar))
|
||||
logbackJar?.let {
|
||||
from(zipTree(logbackJar))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -62,7 +64,7 @@ tasks {
|
|||
!it.absolutePath.contains("logback-classic")
|
||||
}
|
||||
// add modified copy of logback-classic to classpath
|
||||
classpath = classpath.plus(files("$buildDir/tmp/logback-classic-modified.jar"))
|
||||
classpath = classpath.plus(files(layout.buildDirectory.file("tmp/logback-classic-modified.jar")))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,14 +33,16 @@ tasks {
|
|||
// that breaks deploy on embedded wildfly
|
||||
// create a copy of logback-classic jar that does not have this file
|
||||
val modifyLogbackJar by registering(Jar::class) {
|
||||
destinationDirectory.set(file("$buildDir/tmp"))
|
||||
destinationDirectory.set(layout.buildDirectory.dir("tmp"))
|
||||
archiveFileName.set("logback-classic-modified.jar")
|
||||
exclude("/META-INF/services/javax.servlet.ServletContainerInitializer")
|
||||
doFirst {
|
||||
configurations.configureEach {
|
||||
if (name.lowercase().endsWith("testruntimeclasspath")) {
|
||||
val logbackJar = find { it.name.contains("logback-classic") }
|
||||
from(zipTree(logbackJar))
|
||||
logbackJar?.let {
|
||||
from(zipTree(logbackJar))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -63,7 +65,7 @@ tasks {
|
|||
!it.absolutePath.contains("logback-classic")
|
||||
}
|
||||
// add modified copy of logback-classic to classpath
|
||||
classpath = classpath.plus(files("$buildDir/tmp/logback-classic-modified.jar"))
|
||||
classpath = classpath.plus(files(layout.buildDirectory.file("tmp/logback-classic-modified.jar")))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -42,14 +42,16 @@ tasks {
|
|||
// that breaks deploy on embedded wildfly
|
||||
// create a copy of logback-classic jar that does not have this file
|
||||
val modifyLogbackJar by registering(Jar::class) {
|
||||
destinationDirectory.set(file("$buildDir/tmp"))
|
||||
destinationDirectory.set(layout.buildDirectory.dir("tmp"))
|
||||
archiveFileName.set("logback-classic-modified.jar")
|
||||
exclude("/META-INF/services/javax.servlet.ServletContainerInitializer")
|
||||
doFirst {
|
||||
configurations.configureEach {
|
||||
if (name.lowercase().endsWith("testruntimeclasspath")) {
|
||||
val logbackJar = find { it.name.contains("logback-classic") }
|
||||
from(zipTree(logbackJar))
|
||||
logbackJar?.let {
|
||||
from(zipTree(logbackJar))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -57,7 +59,7 @@ tasks {
|
|||
|
||||
val copyDependencies by registering(Copy::class) {
|
||||
// test looks for spring jars that are bundled inside deployed application from this directory
|
||||
from(appLibrary).into("$buildDir/app-libs")
|
||||
from(appLibrary).into(layout.buildDirectory.dir("app-libs"))
|
||||
}
|
||||
|
||||
test {
|
||||
|
@ -78,7 +80,7 @@ tasks {
|
|||
!it.absolutePath.contains("logback-classic")
|
||||
}
|
||||
// add modified copy of logback-classic to classpath
|
||||
classpath = classpath.plus(files("$buildDir/tmp/logback-classic-modified.jar"))
|
||||
classpath = classpath.plus(files(layout.buildDirectory.file("tmp/logback-classic-modified.jar")))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@ jib {
|
|||
}
|
||||
|
||||
// windows containers are built manually since jib does not support windows containers yet
|
||||
val backendDockerBuildDir = file("$buildDir/docker-backend")
|
||||
val backendDockerBuildDir = layout.buildDirectory.dir("docker-backend")
|
||||
|
||||
tasks {
|
||||
withType<JavaCompile>().configureEach {
|
||||
|
@ -59,7 +59,7 @@ tasks {
|
|||
inputDir.set(backendDockerBuildDir)
|
||||
|
||||
images.add("ghcr.io/open-telemetry/opentelemetry-java-instrumentation/smoke-test-fake-backend-windows:$extraTag")
|
||||
dockerFile.set(File(backendDockerBuildDir, "windows.dockerfile"))
|
||||
dockerFile.set(File(backendDockerBuildDir.get().asFile, "windows.dockerfile"))
|
||||
}
|
||||
|
||||
val dockerPush by registering(DockerPushImage::class) {
|
||||
|
|
|
@ -136,7 +136,7 @@ fun configureImage(
|
|||
isWindows: Boolean
|
||||
): String {
|
||||
// Using separate build directory for different image
|
||||
val dockerWorkingDir = file("$buildDir/docker-$server-$version-jdk$jdk-$vm-$warProject")
|
||||
val dockerWorkingDir = layout.buildDirectory.dir("docker-$server-$version-jdk$jdk-$vm-$warProject")
|
||||
val dockerFileName = "$dockerfile.${if (isWindows) "windows." else ""}dockerfile"
|
||||
val platformSuffix = if (isWindows) "-windows" else ""
|
||||
|
||||
|
@ -200,7 +200,7 @@ fun configureImage(
|
|||
|
||||
inputDir.set(dockerWorkingDir)
|
||||
images.add(image)
|
||||
dockerFile.set(File(dockerWorkingDir, dockerFileName))
|
||||
dockerFile.set(File(dockerWorkingDir.get().asFile, dockerFileName))
|
||||
buildArgs.set(extraArgs + mapOf("jdk" to jdk, "vm" to vm, "version" to version, "jdkImage" to jdkImage))
|
||||
doLast {
|
||||
matrix.add(image)
|
||||
|
|
Loading…
Reference in New Issue