xref: /aosp_15_r20/external/grpc-grpc-java/interop-testing/build.gradle (revision e07d83d3ffcef9ecfc9f7f475418ec639ff0e5fe)
1*e07d83d3SAndroid Build Coastguard Workerplugins {
2*e07d83d3SAndroid Build Coastguard Worker    id "application"
3*e07d83d3SAndroid Build Coastguard Worker    id "java"
4*e07d83d3SAndroid Build Coastguard Worker    id "maven-publish"
5*e07d83d3SAndroid Build Coastguard Worker
6*e07d83d3SAndroid Build Coastguard Worker    id "com.google.protobuf"
7*e07d83d3SAndroid Build Coastguard Worker    id "ru.vyarus.animalsniffer"
8*e07d83d3SAndroid Build Coastguard Worker}
9*e07d83d3SAndroid Build Coastguard Worker
10*e07d83d3SAndroid Build Coastguard Workerdescription = "gRPC: Integration Testing"
11*e07d83d3SAndroid Build Coastguard Worker
12*e07d83d3SAndroid Build Coastguard Workerconfigurations {
13*e07d83d3SAndroid Build Coastguard Worker    alpnagent
14*e07d83d3SAndroid Build Coastguard Worker}
15*e07d83d3SAndroid Build Coastguard Worker
16*e07d83d3SAndroid Build Coastguard Workerdependencies {
17*e07d83d3SAndroid Build Coastguard Worker    implementation project(path: ':grpc-alts', configuration: 'shadow'),
18*e07d83d3SAndroid Build Coastguard Worker            project(':grpc-auth'),
19*e07d83d3SAndroid Build Coastguard Worker            project(':grpc-census'),
20*e07d83d3SAndroid Build Coastguard Worker            project(':grpc-core'),
21*e07d83d3SAndroid Build Coastguard Worker            project(':grpc-googleapis'),
22*e07d83d3SAndroid Build Coastguard Worker            project(':grpc-netty'),
23*e07d83d3SAndroid Build Coastguard Worker            project(':grpc-okhttp'),
24*e07d83d3SAndroid Build Coastguard Worker            project(':grpc-protobuf'),
25*e07d83d3SAndroid Build Coastguard Worker            project(':grpc-rls'),
26*e07d83d3SAndroid Build Coastguard Worker            project(':grpc-services'),
27*e07d83d3SAndroid Build Coastguard Worker            project(':grpc-stub'),
28*e07d83d3SAndroid Build Coastguard Worker            project(':grpc-testing'),
29*e07d83d3SAndroid Build Coastguard Worker            project(path: ':grpc-xds', configuration: 'shadow'),
30*e07d83d3SAndroid Build Coastguard Worker            libraries.hdrhistogram,
31*e07d83d3SAndroid Build Coastguard Worker            libraries.junit,
32*e07d83d3SAndroid Build Coastguard Worker            libraries.truth,
33*e07d83d3SAndroid Build Coastguard Worker            libraries.opencensus.contrib.grpc.metrics,
34*e07d83d3SAndroid Build Coastguard Worker            libraries.google.auth.oauth2Http
35*e07d83d3SAndroid Build Coastguard Worker    compileOnly libraries.javax.annotation
36*e07d83d3SAndroid Build Coastguard Worker    // TODO(sergiitk): replace with com.google.cloud:google-cloud-logging
37*e07d83d3SAndroid Build Coastguard Worker    // Used instead of google-cloud-logging because it's failing
38*e07d83d3SAndroid Build Coastguard Worker    // due to a circular dependency on grpc.
39*e07d83d3SAndroid Build Coastguard Worker    // https://cloud.google.com/logging/docs/setup/java#the_javautillogging_handler
40*e07d83d3SAndroid Build Coastguard Worker    // Error example: "java.util.logging.ErrorManager: 1"
41*e07d83d3SAndroid Build Coastguard Worker    // Latest failing version com.google.cloud:google-cloud-logging:2.1.2
42*e07d83d3SAndroid Build Coastguard Worker    runtimeOnly group: 'io.github.devatherock', name: 'jul-jsonformatter', version: '1.1.0'
43*e07d83d3SAndroid Build Coastguard Worker    runtimeOnly libraries.opencensus.impl,
44*e07d83d3SAndroid Build Coastguard Worker            libraries.netty.tcnative,
45*e07d83d3SAndroid Build Coastguard Worker            libraries.netty.tcnative.classes,
46*e07d83d3SAndroid Build Coastguard Worker            project(':grpc-grpclb'),
47*e07d83d3SAndroid Build Coastguard Worker            project(':grpc-rls')
48*e07d83d3SAndroid Build Coastguard Worker    testImplementation testFixtures(project(':grpc-context')),
49*e07d83d3SAndroid Build Coastguard Worker            testFixtures(project(':grpc-api')),
50*e07d83d3SAndroid Build Coastguard Worker            testFixtures(project(':grpc-core')),
51*e07d83d3SAndroid Build Coastguard Worker            libraries.mockito.core,
52*e07d83d3SAndroid Build Coastguard Worker            libraries.okhttp
53*e07d83d3SAndroid Build Coastguard Worker    alpnagent libraries.jetty.alpn.agent
54*e07d83d3SAndroid Build Coastguard Worker
55*e07d83d3SAndroid Build Coastguard Worker    signature libraries.signature.java
56*e07d83d3SAndroid Build Coastguard Worker    signature libraries.signature.android
57*e07d83d3SAndroid Build Coastguard Worker}
58*e07d83d3SAndroid Build Coastguard Worker
59*e07d83d3SAndroid Build Coastguard WorkerconfigureProtoCompilation()
60*e07d83d3SAndroid Build Coastguard Worker
61*e07d83d3SAndroid Build Coastguard Workerimport net.ltgt.gradle.errorprone.CheckSeverity
62*e07d83d3SAndroid Build Coastguard Worker
63*e07d83d3SAndroid Build Coastguard Workertasks.named("compileJava").configure {
64*e07d83d3SAndroid Build Coastguard Worker    // This isn't a library; it can use beta APIs
65*e07d83d3SAndroid Build Coastguard Worker    options.errorprone.check("BetaApi", CheckSeverity.OFF)
66*e07d83d3SAndroid Build Coastguard Worker}
67*e07d83d3SAndroid Build Coastguard Workertasks.named("test").configure {
68*e07d83d3SAndroid Build Coastguard Worker    // For the automated tests, use Jetty ALPN.
69*e07d83d3SAndroid Build Coastguard Worker    jvmArgs "-javaagent:" + configurations.alpnagent.asPath
70*e07d83d3SAndroid Build Coastguard Worker}
71*e07d83d3SAndroid Build Coastguard Worker
72*e07d83d3SAndroid Build Coastguard Worker// For the generated scripts, use Netty tcnative (i.e. OpenSSL).
73*e07d83d3SAndroid Build Coastguard Worker// Note that OkHttp currently only supports ALPN, so OpenSSL version >= 1.0.2 is required.
74*e07d83d3SAndroid Build Coastguard Worker
75*e07d83d3SAndroid Build Coastguard Workerdef test_client = tasks.register("test_client", CreateStartScripts) {
76*e07d83d3SAndroid Build Coastguard Worker    mainClass = "io.grpc.testing.integration.TestServiceClient"
77*e07d83d3SAndroid Build Coastguard Worker    applicationName = "test-client"
78*e07d83d3SAndroid Build Coastguard Worker    defaultJvmOpts = [
79*e07d83d3SAndroid Build Coastguard Worker        "-javaagent:JAVAAGENT_APP_HOME" + configurations.alpnagent.singleFile.name
80*e07d83d3SAndroid Build Coastguard Worker    ]
81*e07d83d3SAndroid Build Coastguard Worker    outputDir = new File(project.buildDir, 'tmp/scripts/' + name)
82*e07d83d3SAndroid Build Coastguard Worker    classpath = startScripts.classpath
83*e07d83d3SAndroid Build Coastguard Worker    doLast {
84*e07d83d3SAndroid Build Coastguard Worker        unixScript.text = unixScript.text.replace('JAVAAGENT_APP_HOME', '\'"\$APP_HOME"\'/lib/')
85*e07d83d3SAndroid Build Coastguard Worker        windowsScript.text = windowsScript.text.replace('JAVAAGENT_APP_HOME', '%APP_HOME%\\lib\\')
86*e07d83d3SAndroid Build Coastguard Worker    }
87*e07d83d3SAndroid Build Coastguard Worker}
88*e07d83d3SAndroid Build Coastguard Worker
89*e07d83d3SAndroid Build Coastguard Workerdef test_server = tasks.register("test_server", CreateStartScripts) {
90*e07d83d3SAndroid Build Coastguard Worker    mainClass = "io.grpc.testing.integration.TestServiceServer"
91*e07d83d3SAndroid Build Coastguard Worker    applicationName = "test-server"
92*e07d83d3SAndroid Build Coastguard Worker    outputDir = new File(project.buildDir, 'tmp/scripts/' + name)
93*e07d83d3SAndroid Build Coastguard Worker    classpath = startScripts.classpath
94*e07d83d3SAndroid Build Coastguard Worker}
95*e07d83d3SAndroid Build Coastguard Worker
96*e07d83d3SAndroid Build Coastguard Workerdef reconnect_test_client = tasks.register("reconnect_test_client", CreateStartScripts) {
97*e07d83d3SAndroid Build Coastguard Worker    mainClass = "io.grpc.testing.integration.ReconnectTestClient"
98*e07d83d3SAndroid Build Coastguard Worker    applicationName = "reconnect-test-client"
99*e07d83d3SAndroid Build Coastguard Worker    outputDir = new File(project.buildDir, 'tmp/scripts/' + name)
100*e07d83d3SAndroid Build Coastguard Worker    classpath = startScripts.classpath
101*e07d83d3SAndroid Build Coastguard Worker}
102*e07d83d3SAndroid Build Coastguard Worker
103*e07d83d3SAndroid Build Coastguard Workerdef stresstest_client = tasks.register("stresstest_client", CreateStartScripts) {
104*e07d83d3SAndroid Build Coastguard Worker    mainClass = "io.grpc.testing.integration.StressTestClient"
105*e07d83d3SAndroid Build Coastguard Worker    applicationName = "stresstest-client"
106*e07d83d3SAndroid Build Coastguard Worker    outputDir = new File(project.buildDir, 'tmp/scripts/' + name)
107*e07d83d3SAndroid Build Coastguard Worker    classpath = startScripts.classpath
108*e07d83d3SAndroid Build Coastguard Worker    defaultJvmOpts = [
109*e07d83d3SAndroid Build Coastguard Worker        "-verbose:gc",
110*e07d83d3SAndroid Build Coastguard Worker        "-XX:+PrintFlagsFinal"
111*e07d83d3SAndroid Build Coastguard Worker    ]
112*e07d83d3SAndroid Build Coastguard Worker}
113*e07d83d3SAndroid Build Coastguard Worker
114*e07d83d3SAndroid Build Coastguard Workerdef http2_client = tasks.register("http2_client", CreateStartScripts) {
115*e07d83d3SAndroid Build Coastguard Worker    mainClass = "io.grpc.testing.integration.Http2Client"
116*e07d83d3SAndroid Build Coastguard Worker    applicationName = "http2-client"
117*e07d83d3SAndroid Build Coastguard Worker    outputDir = new File(project.buildDir, 'tmp/scripts/' + name)
118*e07d83d3SAndroid Build Coastguard Worker    classpath = startScripts.classpath
119*e07d83d3SAndroid Build Coastguard Worker}
120*e07d83d3SAndroid Build Coastguard Worker
121*e07d83d3SAndroid Build Coastguard Workerdef grpclb_long_lived_affinity_test_client = tasks.register("grpclb_long_lived_affinity_test_client", CreateStartScripts) {
122*e07d83d3SAndroid Build Coastguard Worker    mainClass = "io.grpc.testing.integration.GrpclbLongLivedAffinityTestClient"
123*e07d83d3SAndroid Build Coastguard Worker    applicationName = "grpclb-long-lived-affinity-test-client"
124*e07d83d3SAndroid Build Coastguard Worker    outputDir = new File(project.buildDir, 'tmp/scripts/' + name)
125*e07d83d3SAndroid Build Coastguard Worker    classpath = startScripts.classpath
126*e07d83d3SAndroid Build Coastguard Worker    defaultJvmOpts = [
127*e07d83d3SAndroid Build Coastguard Worker        "-Dio.grpc.internal.DnsNameResolverProvider.enable_service_config=true"
128*e07d83d3SAndroid Build Coastguard Worker    ]
129*e07d83d3SAndroid Build Coastguard Worker}
130*e07d83d3SAndroid Build Coastguard Worker
131*e07d83d3SAndroid Build Coastguard Workerdef grpclb_fallback_test_client = tasks.register("grpclb_fallback_test_client", CreateStartScripts) {
132*e07d83d3SAndroid Build Coastguard Worker    mainClass = "io.grpc.testing.integration.GrpclbFallbackTestClient"
133*e07d83d3SAndroid Build Coastguard Worker    applicationName = "grpclb-fallback-test-client"
134*e07d83d3SAndroid Build Coastguard Worker    outputDir = new File(project.buildDir, 'tmp/scripts/' + name)
135*e07d83d3SAndroid Build Coastguard Worker    classpath = startScripts.classpath
136*e07d83d3SAndroid Build Coastguard Worker    defaultJvmOpts = [
137*e07d83d3SAndroid Build Coastguard Worker        "-Dio.grpc.internal.DnsNameResolverProvider.enable_service_config=true"
138*e07d83d3SAndroid Build Coastguard Worker    ]
139*e07d83d3SAndroid Build Coastguard Worker}
140*e07d83d3SAndroid Build Coastguard Worker
141*e07d83d3SAndroid Build Coastguard Workerdef xds_test_client = tasks.register("xds_test_client", CreateStartScripts) {
142*e07d83d3SAndroid Build Coastguard Worker    mainClass = "io.grpc.testing.integration.XdsTestClient"
143*e07d83d3SAndroid Build Coastguard Worker    applicationName = "xds-test-client"
144*e07d83d3SAndroid Build Coastguard Worker    outputDir = new File(project.buildDir, 'tmp/scripts/' + name)
145*e07d83d3SAndroid Build Coastguard Worker    classpath = startScripts.classpath
146*e07d83d3SAndroid Build Coastguard Worker}
147*e07d83d3SAndroid Build Coastguard Worker
148*e07d83d3SAndroid Build Coastguard Workerdef xds_test_server = tasks.register("xds_test_server", CreateStartScripts) {
149*e07d83d3SAndroid Build Coastguard Worker    mainClass = "io.grpc.testing.integration.XdsTestServer"
150*e07d83d3SAndroid Build Coastguard Worker    applicationName = "xds-test-server"
151*e07d83d3SAndroid Build Coastguard Worker    outputDir = new File(project.buildDir, 'tmp/scripts/' + name)
152*e07d83d3SAndroid Build Coastguard Worker    classpath = startScripts.classpath
153*e07d83d3SAndroid Build Coastguard Worker}
154*e07d83d3SAndroid Build Coastguard Worker
155*e07d83d3SAndroid Build Coastguard Workerdef xds_federation_test_client = tasks.register("xds_federation_test_client", CreateStartScripts) {
156*e07d83d3SAndroid Build Coastguard Worker    mainClass = "io.grpc.testing.integration.XdsFederationTestClient"
157*e07d83d3SAndroid Build Coastguard Worker    applicationName = "xds-federation-test-client"
158*e07d83d3SAndroid Build Coastguard Worker    outputDir = new File(project.buildDir, 'tmp/scripts/' + name)
159*e07d83d3SAndroid Build Coastguard Worker    classpath = startScripts.classpath
160*e07d83d3SAndroid Build Coastguard Worker}
161*e07d83d3SAndroid Build Coastguard Worker
162*e07d83d3SAndroid Build Coastguard WorkerapplicationDistribution.into("bin") {
163*e07d83d3SAndroid Build Coastguard Worker    from(test_client)
164*e07d83d3SAndroid Build Coastguard Worker    from(test_server)
165*e07d83d3SAndroid Build Coastguard Worker    from(reconnect_test_client)
166*e07d83d3SAndroid Build Coastguard Worker    from(stresstest_client)
167*e07d83d3SAndroid Build Coastguard Worker    from(http2_client)
168*e07d83d3SAndroid Build Coastguard Worker    from(grpclb_long_lived_affinity_test_client)
169*e07d83d3SAndroid Build Coastguard Worker    from(grpclb_fallback_test_client)
170*e07d83d3SAndroid Build Coastguard Worker    from(xds_test_client)
171*e07d83d3SAndroid Build Coastguard Worker    from(xds_test_server)
172*e07d83d3SAndroid Build Coastguard Worker    from(xds_federation_test_client)
173*e07d83d3SAndroid Build Coastguard Worker    fileMode = 0755
174*e07d83d3SAndroid Build Coastguard Worker}
175*e07d83d3SAndroid Build Coastguard Worker
176*e07d83d3SAndroid Build Coastguard WorkerapplicationDistribution.into("lib") {
177*e07d83d3SAndroid Build Coastguard Worker    from(configurations.alpnagent)
178*e07d83d3SAndroid Build Coastguard Worker}
179*e07d83d3SAndroid Build Coastguard Worker
180*e07d83d3SAndroid Build Coastguard Workerpublishing {
181*e07d83d3SAndroid Build Coastguard Worker    publications {
182*e07d83d3SAndroid Build Coastguard Worker        maven(MavenPublication) {
183*e07d83d3SAndroid Build Coastguard Worker            artifact distZip
184*e07d83d3SAndroid Build Coastguard Worker            artifact distTar
185*e07d83d3SAndroid Build Coastguard Worker        }
186*e07d83d3SAndroid Build Coastguard Worker    }
187*e07d83d3SAndroid Build Coastguard Worker}
188