File: build.gradle

package info (click to toggle)
grpc-java 1.26.0%2Bds-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 11,852 kB
  • sloc: java: 146,813; cpp: 1,174; xml: 1,037; sh: 662; makefile: 40; python: 40
file content (178 lines) | stat: -rw-r--r-- 6,898 bytes parent folder | download
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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
subprojects {
    apply plugin: "checkstyle"
    apply plugin: "maven"
    apply plugin: "idea"
    apply plugin: "signing"
    apply plugin: "jacoco"

    group = "io.grpc"
    version = "1.26.0" // CURRENT_GRPC_VERSION

    repositories {
        maven { // The google mirror is less flaky than mavenCentral()
            url "https://maven-central.storage-download.googleapis.com/repos/central/data/" }
        mavenCentral()
        mavenLocal()
    }

    tasks.withType(JavaCompile) {
        it.options.compilerArgs += [
            "-Xlint:all",
            "-Xlint:-options",
            "-Xlint:-path",
            "-Xlint:-try"
        ]
        it.options.encoding = "UTF-8"
        if (rootProject.hasProperty('failOnWarnings') && rootProject.failOnWarnings.toBoolean()) {
            it.options.compilerArgs += ["-Werror"]
        }
    }

    ext {
        def exeSuffix = ""
        protocPluginBaseName = 'protoc-gen-grpc-java'
        javaPluginPath = "$rootDir/compiler/build/exe/java_plugin/$protocPluginBaseName$exeSuffix"

        nettyVersion = 'debian'
        guavaVersion = 'debian'
        googleauthVersion = '0.18.0'
        protobufVersion = '3.11.0'
        protocVersion = protobufVersion
        opencensusVersion = '0.24.0'

        libraries = [
            android_annotations: "com.google.android:annotations:4.1.1.4",
            animalsniffer_annotations: "org.codehaus.mojo:animal-sniffer-annotations:1.17",
            errorprone: "com.google.errorprone:error_prone_annotations:2.3.3",
            gson: "com.google.code.gson:gson:2.8.6",
            guava: "com.google.guava:guava:${guavaVersion}",
            hpack: 'com.twitter:hpack:0.10.1',
            javax_annotation: 'javax.annotation:javax.annotation-api:1.2',
            jsr305: 'com.google.code.findbugs:jsr305:3.0.2',
            google_api_protos: 'com.google.api.grpc:proto-google-common-protos:1.12.0',
            google_auth_credentials: "com.google.auth:google-auth-library-credentials:${googleauthVersion}",
            google_auth_oauth2_http: "com.google.auth:google-auth-library-oauth2-http:${googleauthVersion}",
            okhttp: 'com.squareup.okhttp:okhttp:2.5.0',
            okio: 'com.squareup.okio:okio:1.13.0',
            opencensus_api: "io.opencensus:opencensus-api:${opencensusVersion}",
            opencensus_contrib_grpc_metrics: "io.opencensus:opencensus-contrib-grpc-metrics:${opencensusVersion}",
            opencensus_impl: "io.opencensus:opencensus-impl:${opencensusVersion}",
            opencensus_impl_lite: "io.opencensus:opencensus-impl-lite:${opencensusVersion}",
            instrumentation_api: 'com.google.instrumentation:instrumentation-api:0.4.3',
            perfmark: 'io.perfmark:perfmark-api:0.19.0',
            pgv: 'io.envoyproxy.protoc-gen-validate:pgv-java-stub:0.2.0',
            protobuf: "com.google.protobuf:protobuf-java:${protobufVersion}",
            protobuf_lite: "com.google.protobuf:protobuf-javalite:${protobufVersion}",
            protobuf_util: "com.google.protobuf:protobuf-java-util:${protobufVersion}",
            lang: "org.apache.commons:commons-lang3:3.5",

            netty: "io.netty:netty-codec-http2:[${nettyVersion}]",
            netty_epoll: "io.netty:netty-transport-native-epoll:${nettyVersion}:linux-x86_64",
            netty_proxy_handler: "io.netty:netty-handler-proxy:${nettyVersion}",

            // Keep the following references of tcnative version in sync whenever it's updated
            // SECURITY.md (multiple occurrences)
            // examples/example-tls/build.gradle
            // examples/example-tls/pom.xml
            netty_tcnative: 'io.netty:netty-tcnative-boringssl-static:2.0.26.Final',

            conscrypt: 'org.conscrypt:conscrypt-openjdk-uber:2.2.1',
            re2j: 'com.google.re2j:re2j:1.2',

            // Test dependencies.
            junit: 'junit:junit:4.12',
            mockito: 'org.mockito:mockito-core:2.28.2',
            truth: 'com.google.truth:truth:1.0',
            guava_testlib: "com.google.guava:guava-testlib:${guavaVersion}",

            // Benchmark dependencies
            hdrhistogram: 'org.hdrhistogram:HdrHistogram:2.1.10',
            math: 'org.apache.commons:commons-math3:3.6',

            // Jetty ALPN dependencies
            jetty_alpn_agent: 'org.mortbay.jetty.alpn:jetty-alpn-agent:2.0.9'
        ]
    }

    // Define a separate configuration for managing the dependency on Jetty ALPN agent.
    configurations {
        compile {
            // Detect Maven Enforcer's dependencyConvergence failures. We only
            // care for artifacts used as libraries by others.
            if (!(project.name in [
                'grpc-benchmarks',
                'grpc-interop-testing',
                'grpc-gae-interop-testing-jdk8',
            ])) {
                resolutionStrategy.failOnVersionConflict()
            }
        }
    }

    // Disable JavaDoc doclint on Java 8. It's annoying.
    if (JavaVersion.current().isJava8Compatible()) {
        allprojects {
            tasks.withType(Javadoc) {
                options.addStringOption('Xdoclint:none', '-quiet')
            }
        }
    }

    // For jdk10 we must explicitly choose between html4 and html5, otherwise we get a warning
    if (JavaVersion.current().isJava10Compatible()) {
        allprojects {
            tasks.withType(Javadoc) {
                options.addBooleanOption('html4', true)
            }
        }
    }

    jacoco { toolVersion = "0.8.2" }

    plugins.withId("java") {
        sourceCompatibility = 1.7
        targetCompatibility = 1.7

        dependencies {
            testCompile libraries.junit,
                    libraries.mockito,
                    libraries.truth
        }

        compileTestJava {
            // serialVersionUID is basically guaranteed to be useless in our tests
            options.compilerArgs += [
                "-Xlint:-serial"
            ]
        }

        jar.manifest {
            attributes('Implementation-Title': name,
            'Implementation-Version': version,
            'Built-By': System.getProperty('user.name'),
            'Built-JDK': System.getProperty('java.version'),
            'Source-Compatibility': sourceCompatibility,
            'Target-Compatibility': targetCompatibility)
        }

        javadoc.options {
            encoding = 'UTF-8'
            use = true
            links 'https://docs.oracle.com/javase/8/docs/api/'
            source = "8"
        }

        // At a test failure, log the stack trace to the console so that we don't
        // have to open the HTML in a browser.
        test {
            testLogging {
                exceptionFormat = 'full'
                showExceptions true
                showCauses true
                showStackTraces true
            }
            maxHeapSize = '1500m'
        }

    }
}