From 6ed8c01ef6a091363f7bb7580612b1755b1ced2b Mon Sep 17 00:00:00 2001 From: Tomo Suzuki Date: Tue, 29 Jun 2021 23:59:21 -0400 Subject: [PATCH] [BEAM-12422] Locally-installing vendored gRPC 1.36.0-0.2 This commit is not intended to be merged into master. This commit installs the vendored gRPC 1.36.0-0.2 to local Maven repository and runs the tests against the version. --- .test-infra/validate-runner/build.gradle | 2 ++ build.gradle.kts | 34 +++++++++++++++++++ .../beam/gradle/BeamModulePlugin.groovy | 2 +- 3 files changed, 37 insertions(+), 1 deletion(-) diff --git a/.test-infra/validate-runner/build.gradle b/.test-infra/validate-runner/build.gradle index 072184891b42..c1a1da5f6a5e 100644 --- a/.test-infra/validate-runner/build.gradle +++ b/.test-infra/validate-runner/build.gradle @@ -32,6 +32,8 @@ repositories { maven { url "https://packages.confluent.io/maven/" } + // Maven local is not needed. Just for vendored gRPC testing + mavenLocal() } dependencies { diff --git a/build.gradle.kts b/build.gradle.kts index 849f1f6f9b03..ed829e8c7bc4 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -15,6 +15,8 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +import org.apache.tools.ant.taskdefs.condition.Os +import java.nio.file.Paths plugins { base @@ -358,6 +360,38 @@ release { } } +// TODO: Do not merge this to master +task("installVendoredGrpc") { + dependsOn(":vendor:grpc-1_36_0:shadowJar") + + doLast { + val jenkinsMvn = "/home/jenkins/tools/maven/apache-maven-3.5.4/bin/mvn" + val executable = if (file(jenkinsMvn).canExecute()) jenkinsMvn else ( + if (Os.isFamily(Os.FAMILY_WINDOWS)) "mvn.cmd" else "mvn" + ) + val jar = Paths.get("vendor","grpc-1_36_0","build","libs","beam-vendor-grpc-1_36_0-0.2.jar") + project.exec { + commandLine = listOf( + executable, "--batch-mode", + "install:install-file", "-Dpackaging=jar", + "-DgroupId=org.apache.beam", "-DartifactId=beam-vendor-grpc-1_36_0", + "-Dversion=0.2", "-Dfile=$jar" + ) + } + } +} + +// Because :model:job-management:runtimeClasspath requires the vendored gRPC at configuration phase +// (before execution phase), we cannot rely on task dependencies. +if (!project.hasProperty("installVendoredGrpcFlag")) { + val executable = if (Os.isFamily(Os.FAMILY_WINDOWS)) "gradlew.bat" else "./gradlew" + project.exec { + commandLine = listOf( + executable, ":installVendoredGrpc", "-PinstallVendoredGrpcFlag", "--info", "--stacktrace" + ) + } +} + // Reports linkage errors across multiple Apache Beam artifact ids. // // To use (from the root of project): diff --git a/buildSrc/src/main/groovy/org/apache/beam/gradle/BeamModulePlugin.groovy b/buildSrc/src/main/groovy/org/apache/beam/gradle/BeamModulePlugin.groovy index 58b1670d69b3..84c16ec904a5 100644 --- a/buildSrc/src/main/groovy/org/apache/beam/gradle/BeamModulePlugin.groovy +++ b/buildSrc/src/main/groovy/org/apache/beam/gradle/BeamModulePlugin.groovy @@ -647,7 +647,7 @@ class BeamModulePlugin implements Plugin { testcontainers_postgresql : "org.testcontainers:postgresql:$testcontainers_version", testcontainers_gcloud : "org.testcontainers:gcloud:$testcontainers_version", vendored_bytebuddy_1_11_0 : "org.apache.beam:beam-vendor-bytebuddy-1_11_0:0.1", - vendored_grpc_1_36_0 : "org.apache.beam:beam-vendor-grpc-1_36_0:0.1", + vendored_grpc_1_36_0 : "org.apache.beam:beam-vendor-grpc-1_36_0:0.2", vendored_guava_26_0_jre : "org.apache.beam:beam-vendor-guava-26_0-jre:0.1", vendored_calcite_1_20_0 : "org.apache.beam:beam-vendor-calcite-1_20_0:0.1", woodstox_core_asl : "org.codehaus.woodstox:woodstox-core-asl:4.4.1",