1apply plugin: 'application'
2
3description = "gRPC: Integration Testing"
4startScripts.enabled = false
5
6// Add dependency on the protobuf plugin
7buildscript {
8    repositories {
9        maven { // The google mirror is less flaky than mavenCentral()
10            url "https://maven-central.storage-download.googleapis.com/repos/central/data/" }
11    }
12    dependencies { classpath libraries.protobuf_plugin }
13}
14
15dependencies {
16    compile project(':grpc-alts'),
17            project(':grpc-auth'),
18            project(':grpc-core'),
19            project(':grpc-netty'),
20            project(':grpc-okhttp'),
21            project(':grpc-protobuf'),
22            project(':grpc-stub'),
23            project(':grpc-testing'),
24            libraries.junit,
25            libraries.mockito,
26            libraries.oauth_client
27    compile (libraries.truth) {
28        // Disable because it uses Java 8 bytecode, which breaks gae-java7
29        exclude group: 'com.google.auto.value', module: 'auto-value-annotations'
30        // Disable because it uses Java 8 bytecode, which breaks gae-java7
31        exclude group: 'org.checkerframework', module: 'checker-qual'
32    }
33    compileOnly libraries.javax_annotation
34    runtime libraries.opencensus_impl,
35            libraries.netty_tcnative
36    testCompile project(':grpc-context').sourceSets.test.output
37}
38
39configureProtoCompilation()
40
41compileJava {
42    // This isn't a library; it can use beta APIs
43    it.options.compilerArgs += ["-Xep:BetaApi:OFF"]
44}
45
46test {
47    // For the automated tests, use Jetty ALPN.
48    jvmArgs "-javaagent:" + configurations.alpnagent.asPath
49}
50
51// For the generated scripts, use Netty tcnative (i.e. OpenSSL).
52// Note that OkHttp currently only supports ALPN, so OpenSSL version >= 1.0.2 is required.
53
54task test_client(type: CreateStartScripts) {
55    mainClassName = "io.grpc.testing.integration.TestServiceClient"
56    applicationName = "test-client"
57    defaultJvmOpts = [
58        "-javaagent:JAVAAGENT_APP_HOME" + configurations.alpnagent.singleFile.name
59    ]
60    outputDir = new File(project.buildDir, 'tmp')
61    classpath = jar.outputs.files + configurations.runtime
62    dependencies { runtime configurations.alpnagent }
63    doLast {
64        unixScript.text = unixScript.text.replace('JAVAAGENT_APP_HOME', '\$APP_HOME/lib/')
65        windowsScript.text = windowsScript.text.replace('JAVAAGENT_APP_HOME', '%APP_HOME%\\lib\\')
66    }
67}
68
69task test_server(type: CreateStartScripts) {
70    mainClassName = "io.grpc.testing.integration.TestServiceServer"
71    applicationName = "test-server"
72    outputDir = new File(project.buildDir, 'tmp')
73    classpath = jar.outputs.files + configurations.runtime
74}
75
76task reconnect_test_client(type: CreateStartScripts) {
77    mainClassName = "io.grpc.testing.integration.ReconnectTestClient"
78    applicationName = "reconnect-test-client"
79    outputDir = new File(project.buildDir, 'tmp')
80    classpath = jar.outputs.files + configurations.runtime
81}
82
83task stresstest_client(type: CreateStartScripts) {
84    mainClassName = "io.grpc.testing.integration.StressTestClient"
85    applicationName = "stresstest-client"
86    outputDir = new File(project.buildDir, 'tmp')
87    classpath = jar.outputs.files + configurations.runtime
88    defaultJvmOpts = [
89        "-verbose:gc",
90        "-XX:+PrintFlagsFinal"
91    ]
92}
93
94task http2_client(type: CreateStartScripts) {
95    mainClassName = "io.grpc.testing.integration.Http2Client"
96    applicationName = "http2-client"
97    outputDir = new File(project.buildDir, 'tmp')
98    classpath = jar.outputs.files + configurations.runtime
99}
100
101applicationDistribution.into("bin") {
102    from(test_client)
103    from(test_server)
104    from(reconnect_test_client)
105    from(stresstest_client)
106    from(http2_client)
107    fileMode = 0755
108}
109