| plugins { |
| id "application" |
| id "java" |
| id "maven-publish" |
| |
| id "com.google.protobuf" |
| } |
| |
| description = "gRPC: Integration Testing" |
| startScripts.enabled = false |
| |
| configurations { |
| alpnagent |
| } |
| |
| evaluationDependsOn(project(':grpc-context').path) |
| |
| dependencies { |
| compile project(':grpc-alts'), |
| project(':grpc-auth'), |
| project(':grpc-census'), |
| project(':grpc-core'), |
| project(':grpc-netty'), |
| project(':grpc-okhttp'), |
| project(':grpc-protobuf'), |
| project(':grpc-stub'), |
| project(':grpc-testing'), |
| libraries.google_auth_oauth2_http, |
| libraries.junit, |
| libraries.truth |
| compileOnly libraries.javax_annotation |
| runtime libraries.opencensus_impl, |
| libraries.netty_tcnative, |
| project(':grpc-grpclb') |
| testCompile project(':grpc-context').sourceSets.test.output, |
| libraries.mockito |
| alpnagent libraries.jetty_alpn_agent |
| } |
| |
| configureProtoCompilation() |
| |
| import net.ltgt.gradle.errorprone.CheckSeverity |
| |
| compileJava { |
| // This isn't a library; it can use beta APIs |
| options.errorprone.check("BetaApi", CheckSeverity.OFF) |
| } |
| |
| test { |
| // For the automated tests, use Jetty ALPN. |
| jvmArgs "-javaagent:" + configurations.alpnagent.asPath |
| } |
| |
| // For the generated scripts, use Netty tcnative (i.e. OpenSSL). |
| // Note that OkHttp currently only supports ALPN, so OpenSSL version >= 1.0.2 is required. |
| |
| task test_client(type: CreateStartScripts) { |
| mainClassName = "io.grpc.testing.integration.TestServiceClient" |
| applicationName = "test-client" |
| defaultJvmOpts = [ |
| "-javaagent:JAVAAGENT_APP_HOME" + configurations.alpnagent.singleFile.name |
| ] |
| outputDir = new File(project.buildDir, 'tmp') |
| classpath = jar.outputs.files + configurations.runtime |
| dependencies { runtime configurations.alpnagent } |
| doLast { |
| unixScript.text = unixScript.text.replace('JAVAAGENT_APP_HOME', '\$APP_HOME/lib/') |
| windowsScript.text = windowsScript.text.replace('JAVAAGENT_APP_HOME', '%APP_HOME%\\lib\\') |
| } |
| } |
| |
| task test_server(type: CreateStartScripts) { |
| mainClassName = "io.grpc.testing.integration.TestServiceServer" |
| applicationName = "test-server" |
| outputDir = new File(project.buildDir, 'tmp') |
| classpath = jar.outputs.files + configurations.runtime |
| } |
| |
| task reconnect_test_client(type: CreateStartScripts) { |
| mainClassName = "io.grpc.testing.integration.ReconnectTestClient" |
| applicationName = "reconnect-test-client" |
| outputDir = new File(project.buildDir, 'tmp') |
| classpath = jar.outputs.files + configurations.runtime |
| } |
| |
| task stresstest_client(type: CreateStartScripts) { |
| mainClassName = "io.grpc.testing.integration.StressTestClient" |
| applicationName = "stresstest-client" |
| outputDir = new File(project.buildDir, 'tmp') |
| classpath = jar.outputs.files + configurations.runtime |
| defaultJvmOpts = [ |
| "-verbose:gc", |
| "-XX:+PrintFlagsFinal" |
| ] |
| } |
| |
| task http2_client(type: CreateStartScripts) { |
| mainClassName = "io.grpc.testing.integration.Http2Client" |
| applicationName = "http2-client" |
| outputDir = new File(project.buildDir, 'tmp') |
| classpath = jar.outputs.files + configurations.runtime |
| } |
| |
| task grpclb_long_lived_affinity_test_client(type: CreateStartScripts) { |
| mainClassName = "io.grpc.testing.integration.GrpclbLongLivedAffinityTestClient" |
| applicationName = "grpclb-long-lived-affinity-test-client" |
| outputDir = new File(project.buildDir, 'tmp') |
| classpath = jar.outputs.files + configurations.runtime |
| defaultJvmOpts = [ |
| "-Dio.grpc.internal.DnsNameResolverProvider.enable_grpclb=true", |
| "-Dio.grpc.internal.DnsNameResolverProvider.enable_service_config=true" |
| ] |
| } |
| |
| task xds_test_client(type: CreateStartScripts) { |
| // Use task dependsOn instead of depending on project(':grpc-xds') in configurations because |
| // grpc-xds is not published yet and we don't want grpc-interop-testin to depend on it in maven. |
| dependsOn ':grpc-xds:shadowJar' |
| // Add all other dependencies that grpc-xds needs. |
| dependencies { compile project(':grpc-services'), libraries.netty_epoll } |
| mainClassName = "io.grpc.testing.integration.XdsTestClient" |
| applicationName = "xds-test-client" |
| outputDir = new File(project.buildDir, 'tmp') |
| classpath = startScripts.classpath + fileTree("${project(':grpc-xds').buildDir}/libs") |
| doLast { |
| unixScript.text = unixScript.text.replace( |
| '\$APP_HOME/lib/grpc-xds', "${project(':grpc-xds').buildDir}/libs/grpc-xds") |
| windowsScript.text = windowsScript.text.replace( |
| '%APP_HOME%\\lib\\grpc-xds', "${project(':grpc-xds').buildDir}\\libs\\grpc-xds") |
| } |
| } |
| |
| task xds_test_server(type: CreateStartScripts) { |
| mainClassName = "io.grpc.testing.integration.XdsTestServer" |
| applicationName = "xds-test-server" |
| outputDir = new File(project.buildDir, 'tmp') |
| classpath = jar.outputs.files + configurations.runtime |
| } |
| |
| applicationDistribution.into("bin") { |
| from(test_client) |
| from(test_server) |
| from(reconnect_test_client) |
| from(stresstest_client) |
| from(http2_client) |
| from(grpclb_long_lived_affinity_test_client) |
| from(xds_test_client) |
| from(xds_test_server) |
| fileMode = 0755 |
| } |
| |
| publishing { |
| publications { |
| maven(MavenPublication) { |
| artifact distZip |
| artifact distTar |
| } |
| } |
| } |