aboutsummaryrefslogtreecommitdiff
path: root/interop-testing/build.gradle
blob: 0fb71a1c7ec150ca8b16b2b90d1ec980a0c1d07a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
apply plugin: 'application'

description = "gRPC: Integration Testing"
startScripts.enabled = false

// Add dependency on the protobuf plugin
buildscript {
  repositories {
      maven {
          // The google mirror is less flaky than mavenCentral()
          url "https://maven-central.storage-download.googleapis.com/repos/central/data/"
      }
  }
  dependencies {
    classpath libraries.protobuf_plugin
  }
}

dependencies {
    compile project(':grpc-alts'),
            project(':grpc-auth'),
            project(':grpc-core'),
            project(':grpc-netty'),
            project(':grpc-okhttp'),
            project(':grpc-protobuf'),
            project(':grpc-stub'),
            project(':grpc-testing'),
            libraries.junit,
            libraries.mockito,
            libraries.netty_tcnative,
            libraries.oauth_client,
            libraries.truth
    runtime libraries.opencensus_impl
    testCompile project(':grpc-context').sourceSets.test.output
}

configureProtoCompilation()

compileJava {
    // This isn't a library; it can use beta APIs
    it.options.compilerArgs += ["-Xep:BetaApi: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
}

applicationDistribution.into("bin") {
    from(test_client)
    from(test_server)
    from(reconnect_test_client)
    from(stresstest_client)
    from(http2_client)
    fileMode = 0755
}

// Let intellij projects refer to generated code
idea {
  module {
    sourceDirs += file("${projectDir}/src/generated/main/java")
    sourceDirs += file("${projectDir}/src/generated/main/grpc")
  }
}