From bbcc297e37079dbc9e63cd1887c70a1fe31a1625 Mon Sep 17 00:00:00 2001 From: Ken Huang Date: Sun, 5 Jan 2025 21:18:27 +0800 Subject: [PATCH] KAFKA-18358: Replace Deprecated $buildDir variable in build.gradle (#18343) Reviewers: Divij Vaidya --- build.gradle | 94 ++++++++++++++++++++++++++-------------------------- 1 file changed, 47 insertions(+), 47 deletions(-) diff --git a/build.gradle b/build.gradle index fa0931b675926..012bb4fb0ac1b 100644 --- a/build.gradle +++ b/build.gradle @@ -248,7 +248,7 @@ static def projectToJUnitXmlPath(project) { projectNames.push(p.name) p = p.parent if (p.name == "kafka") { - break; + break } } return projectNames.join("/") @@ -991,7 +991,7 @@ project(':server') { } task createVersionFile() { - def receiptFile = file("$buildDir/kafka/$buildVersionFileName") + def receiptFile = file("${layout.buildDirectory.get().asFile.path}/kafka/$buildVersionFileName") inputs.property "commitId", commitId inputs.property "version", version outputs.file receiptFile @@ -1011,13 +1011,13 @@ project(':server') { jar { dependsOn createVersionFile - from("$buildDir") { + from("${layout.buildDirectory.get().asFile.path}") { include "kafka/$buildVersionFileName" } } clean.doFirst { - delete "$buildDir/kafka/" + delete "${layout.buildDirectory.get().asFile.path}/kafka/" } checkstyle { @@ -1187,7 +1187,7 @@ project(':core') { from (configurations.runtimeClasspath) { exclude('kafka-clients*') } - into "$buildDir/dependant-libs-${versions.scala}" + into "${layout.buildDirectory.get().asFile.path}/dependant-libs-${versions.scala}" duplicatesStrategy 'exclude' } @@ -1346,10 +1346,10 @@ project(':core') { from (configurations.testRuntimeClasspath) { include('*.jar') } - into "$buildDir/dependant-testlibs" + into "${layout.buildDirectory.get().asFile.path}/dependant-testlibs" //By default gradle does not handle test dependencies between the sub-projects //This line is to include clients project test jar to dependant-testlibs - from (project(':clients').testJar ) { "$buildDir/dependant-testlibs" } + from (project(':clients').testJar ) { "${layout.buildDirectory.get().asFile.path}/dependant-testlibs" } duplicatesStrategy 'exclude' } @@ -1463,7 +1463,7 @@ project(':group-coordinator:group-coordinator-api') { } task createVersionFile() { - def receiptFile = file("$buildDir/kafka/$buildVersionFileName") + def receiptFile = file("${layout.buildDirectory.get().asFile.path}/kafka/$buildVersionFileName") inputs.property "commitId", commitId inputs.property "version", version outputs.file receiptFile @@ -1483,13 +1483,13 @@ project(':group-coordinator:group-coordinator-api') { jar { dependsOn createVersionFile - from("$buildDir") { + from("${layout.buildDirectory.get().asFile.path}") { include "kafka/$buildVersionFileName" } } clean.doFirst { - delete "$buildDir/kafka/" + delete "${layout.buildDirectory.get().asFile.path}/kafka/" } javadoc { @@ -1934,7 +1934,7 @@ project(':clients') { } task createVersionFile() { - def receiptFile = file("$buildDir/kafka/$buildVersionFileName") + def receiptFile = file("${layout.buildDirectory.get().asFile.path}/kafka/$buildVersionFileName") inputs.property "commitId", commitId inputs.property "version", version outputs.file receiptFile @@ -1974,7 +1974,7 @@ project(':clients') { exclude "**/google/protobuf/*.proto" } - from("$buildDir") { + from("${layout.buildDirectory.get().asFile.path}") { include "kafka/$buildVersionFileName" } @@ -1988,7 +1988,7 @@ project(':clients') { } clean.doFirst { - delete "$buildDir/kafka/" + delete "${layout.buildDirectory.get().asFile.path}/kafka/" } task processMessages(type:JavaExec) { @@ -2101,7 +2101,7 @@ project(':raft') { } task createVersionFile() { - def receiptFile = file("$buildDir/kafka/$buildVersionFileName") + def receiptFile = file("${layout.buildDirectory.get().asFile.path}/kafka/$buildVersionFileName") inputs.property "commitId", commitId inputs.property "version", version outputs.file receiptFile @@ -2151,7 +2151,7 @@ project(':raft') { jar { dependsOn createVersionFile - from("$buildDir") { + from("${layout.buildDirectory.get().asFile.path}") { include "kafka/$buildVersionFileName" } } @@ -2163,7 +2163,7 @@ project(':raft') { } clean.doFirst { - delete "$buildDir/kafka/" + delete "${layout.buildDirectory.get().asFile.path}/kafka/" } javadoc { @@ -2196,7 +2196,7 @@ project(':server-common') { } task createVersionFile() { - def receiptFile = file("$buildDir/kafka/$buildVersionFileName") + def receiptFile = file("${layout.buildDirectory.get().asFile.path}/kafka/$buildVersionFileName") inputs.property "commitId", commitId inputs.property "version", version outputs.file receiptFile @@ -2216,13 +2216,13 @@ project(':server-common') { jar { dependsOn createVersionFile - from("$buildDir") { + from("${layout.buildDirectory.get().asFile.path}") { include "kafka/$buildVersionFileName" } } clean.doFirst { - delete "$buildDir/kafka/" + delete "${layout.buildDirectory.get().asFile.path}/kafka/" } checkstyle { @@ -2256,7 +2256,7 @@ project(':storage:storage-api') { } task createVersionFile() { - def receiptFile = file("$buildDir/kafka/$buildVersionFileName") + def receiptFile = file("${layout.buildDirectory.get().asFile.path}/kafka/$buildVersionFileName") inputs.property "commitId", commitId inputs.property "version", version outputs.file receiptFile @@ -2276,13 +2276,13 @@ project(':storage:storage-api') { jar { dependsOn createVersionFile - from("$buildDir") { + from("${layout.buildDirectory.get().asFile.path}") { include "kafka/$buildVersionFileName" } } clean.doFirst { - delete "$buildDir/kafka/" + delete "${layout.buildDirectory.get().asFile.path}/kafka/" } javadoc { @@ -2336,7 +2336,7 @@ project(':storage') { } task createVersionFile() { - def receiptFile = file("$buildDir/kafka/$buildVersionFileName") + def receiptFile = file("${layout.buildDirectory.get().asFile.path}/kafka/$buildVersionFileName") inputs.property "commitId", commitId inputs.property "version", version outputs.file receiptFile @@ -2401,13 +2401,13 @@ project(':storage') { jar { dependsOn createVersionFile - from("$buildDir") { + from("${layout.buildDirectory.get().asFile.path}") { include "kafka/$buildVersionFileName" } } clean.doFirst { - delete "$buildDir/kafka/" + delete "${layout.buildDirectory.get().asFile.path}/kafka/" } javadoc { @@ -2431,7 +2431,7 @@ project(':tools:tools-api') { } task createVersionFile() { - def receiptFile = file("$buildDir/kafka/$buildVersionFileName") + def receiptFile = file("${layout.buildDirectory.get().asFile.path}/kafka/$buildVersionFileName") inputs.property "commitId", commitId inputs.property "version", version outputs.file receiptFile @@ -2451,13 +2451,13 @@ project(':tools:tools-api') { jar { dependsOn createVersionFile - from("$buildDir") { + from("${layout.buildDirectory.get().asFile.path}") { include "kafka/$buildVersionFileName" } } clean.doFirst { - delete "$buildDir/kafka/" + delete "${layout.buildDirectory.get().asFile.path}/kafka/" } javadoc { @@ -2542,7 +2542,7 @@ project(':tools') { from (configurations.runtimeClasspath) { exclude('kafka-clients*') } - into "$buildDir/dependant-libs-${versions.scala}" + into "${layout.buildDirectory.get().asFile.path}/dependant-libs-${versions.scala}" duplicatesStrategy 'exclude' } @@ -2601,7 +2601,7 @@ project(':trogdor') { from (configurations.runtimeClasspath) { exclude('kafka-clients*') } - into "$buildDir/dependant-libs-${versions.scala}" + into "${layout.buildDirectory.get().asFile.path}/dependant-libs-${versions.scala}" duplicatesStrategy 'exclude' } @@ -2651,7 +2651,7 @@ project(':shell') { from (configurations.runtimeClasspath) { include('jline-*jar') } - into "$buildDir/dependant-libs-${versions.scala}" + into "${layout.buildDirectory.get().asFile.path}/dependant-libs-${versions.scala}" duplicatesStrategy 'exclude' } @@ -2741,12 +2741,12 @@ project(':streams') { from (configurations.runtimeClasspath) { exclude('kafka-clients*') } - into "$buildDir/dependant-libs-${versions.scala}" + into "${layout.buildDirectory.get().asFile.path}/dependant-libs-${versions.scala}" duplicatesStrategy 'exclude' } task createStreamsVersionFile() { - def receiptFile = file("$buildDir/kafka/$buildStreamsVersionFileName") + def receiptFile = file("${layout.buildDirectory.get().asFile.path}/kafka/$buildStreamsVersionFileName") inputs.property "commitId", commitId inputs.property "version", version outputs.file receiptFile @@ -2765,7 +2765,7 @@ project(':streams') { jar { dependsOn 'createStreamsVersionFile' - from("$buildDir") { + from("${layout.buildDirectory.get().asFile.path}") { include "kafka/$buildStreamsVersionFileName" } dependsOn 'copyDependantLibs' @@ -2848,7 +2848,7 @@ project(':streams:streams-scala') { from (configurations.runtimeClasspath) { exclude('kafka-streams*') } - into "$buildDir/dependant-libs-${versions.scala}" + into "${layout.buildDirectory.get().asFile.path}/dependant-libs-${versions.scala}" duplicatesStrategy 'exclude' } @@ -2946,7 +2946,7 @@ project(':streams:test-utils') { from (configurations.runtimeClasspath) { exclude('kafka-streams*') } - into "$buildDir/dependant-libs-${versions.scala}" + into "${layout.buildDirectory.get().asFile.path}/dependant-libs-${versions.scala}" duplicatesStrategy 'exclude' } @@ -2985,7 +2985,7 @@ project(':streams:examples') { from (configurations.runtimeClasspath) { exclude('kafka-streams*') } - into "$buildDir/dependant-libs-${versions.scala}" + into "${layout.buildDirectory.get().asFile.path}/dependant-libs-${versions.scala}" duplicatesStrategy 'exclude' } @@ -3427,7 +3427,7 @@ project(':connect:api') { exclude('kafka-clients*') exclude('connect-*') } - into "$buildDir/dependant-libs" + into "${layout.buildDirectory.get().asFile.path}/dependant-libs" duplicatesStrategy 'exclude' } @@ -3463,7 +3463,7 @@ project(':connect:transforms') { exclude('kafka-clients*') exclude('connect-*') } - into "$buildDir/dependant-libs" + into "${layout.buildDirectory.get().asFile.path}/dependant-libs" duplicatesStrategy 'exclude' } @@ -3504,7 +3504,7 @@ project(':connect:json') { exclude('kafka-clients*') exclude('connect-*') } - into "$buildDir/dependant-libs" + into "${layout.buildDirectory.get().asFile.path}/dependant-libs" duplicatesStrategy 'exclude' } @@ -3599,7 +3599,7 @@ project(':connect:runtime') { exclude('kafka-clients*') exclude('connect-*') } - into "$buildDir/dependant-libs" + into "${layout.buildDirectory.get().asFile.path}/dependant-libs" duplicatesStrategy 'exclude' } @@ -3651,7 +3651,7 @@ project(':connect:runtime') { task setVersionInOpenAPISpec(type: Copy) { from "$rootDir/gradle/openapi.template" - into "$buildDir/resources/docs" + into "${layout.buildDirectory.get().asFile.path}/resources/docs" rename ('openapi.template', 'openapi.yaml') expand(kafkaVersion: "$rootProject.version") } @@ -3664,7 +3664,7 @@ project(':connect:runtime') { outputFormat = 'YAML' prettyPrint = 'TRUE' sortOutput = 'TRUE' - openApiFile = file("$buildDir/resources/docs/openapi.yaml") + openApiFile = file("${layout.buildDirectory.get().asFile.path}/resources/docs/openapi.yaml") resourcePackages = ['org.apache.kafka.connect.runtime.rest.resources'] if( !generatedDocsDir.exists() ) { generatedDocsDir.mkdirs() } outputDir = file(generatedDocsDir) @@ -3705,7 +3705,7 @@ project(':connect:file') { exclude('kafka-clients*') exclude('connect-*') } - into "$buildDir/dependant-libs" + into "${layout.buildDirectory.get().asFile.path}/dependant-libs" duplicatesStrategy 'exclude' } @@ -3746,7 +3746,7 @@ project(':connect:basic-auth-extension') { exclude('kafka-clients*') exclude('connect-*') } - into "$buildDir/dependant-libs" + into "${layout.buildDirectory.get().asFile.path}/dependant-libs" duplicatesStrategy 'exclude' } @@ -3815,7 +3815,7 @@ project(':connect:mirror') { exclude('kafka-clients*') exclude('connect-*') } - into "$buildDir/dependant-libs" + into "${layout.buildDirectory.get().asFile.path}/dependant-libs" duplicatesStrategy 'exclude' } @@ -3878,7 +3878,7 @@ project(':connect:mirror-client') { exclude('kafka-clients*') exclude('connect-*') } - into "$buildDir/dependant-libs" + into "${layout.buildDirectory.get().asFile.path}/dependant-libs" duplicatesStrategy 'exclude' }