blob: b1b5fdb091dcd8e78e556b3027c4dcb8588a41f9 [file] [log] [blame]
Kun Zhang4bc2d6d2015-04-17 10:49:11 -07001buildscript {
2 repositories {
3 mavenCentral()
4 mavenLocal()
5 }
6 dependencies {
7 classpath 'com.google.gradle:osdetector-gradle-plugin:1.2.1'
8 }
9}
Eric Andersonb938ba52015-02-28 09:59:25 -080010
nathanmittler164b7342014-12-15 09:58:05 -080011subprojects {
Eric Andersonc3e8dae2015-01-30 14:58:07 -080012 apply plugin: "checkstyle"
nathanmittler164b7342014-12-15 09:58:05 -080013 apply plugin: "java"
14 apply plugin: "maven"
nmittler52f42202015-01-21 14:30:14 -080015 apply plugin: "idea"
Kun Zhang4bc2d6d2015-04-17 10:49:11 -070016 apply plugin: "osdetector"
Eric Anderson192144e2015-03-02 13:31:14 -080017 apply plugin: "signing"
Eric Anderson041cdb12015-05-05 12:29:26 -070018 apply plugin: "jacoco"
nathanmittler164b7342014-12-15 09:58:05 -080019
nmittlerf8314582015-01-27 10:25:39 -080020 group = "io.grpc"
nathanmittler164b7342014-12-15 09:58:05 -080021 version = "0.1.0-SNAPSHOT"
22
23 sourceCompatibility = 1.6
24 targetCompatibility = 1.6
25
26 repositories {
27 mavenCentral()
28 mavenLocal()
29 }
30
Eric Anderson76d09552015-03-12 15:25:11 -070031 [compileJava, compileTestJava].each() {
32 it.options.compilerArgs += ["-Xlint:unchecked", "-Xlint:deprecation", "-Xlint:-options"]
33 it.options.encoding = "UTF-8"
nmittler02c953e2015-01-26 14:03:11 -080034 }
35
Eric Anderson10fb2062015-05-05 10:28:38 -070036 javadoc.options {
37 encoding = 'UTF-8'
38 links 'https://docs.oracle.com/javase/8/docs/api/'
39 }
Eric Anderson14444a92015-03-11 16:44:38 -070040
Jakob Buchgraber7ddcdfd2015-02-13 16:21:53 -080041 ext {
42 libraries = [
Jakob Buchgraber7ddcdfd2015-02-13 16:21:53 -080043 guava: 'com.google.guava:guava:18.0',
Jakob Buchgraber7ddcdfd2015-02-13 16:21:53 -080044 // used to collect benchmark results
45 hdrhistogram: 'org.hdrhistogram:HdrHistogram:2.1.4',
Jeff Pinnerb1cc7cc2015-02-25 10:17:23 -080046 hpack: 'com.twitter:hpack:0.10.1',
nmittlerb897a892015-02-23 12:03:59 -080047 javaee_api: 'javax:javaee-api:7.0',
48 jsonp: 'org.glassfish:javax.json:1.0.4',
49 jsr305: 'com.google.code.findbugs:jsr305:3.0.0',
Louis Ryan767a12c2015-03-02 15:05:09 -080050 oauth_client: 'com.google.auth:google-auth-library-oauth2-http:0.1.0',
nmittlerb897a892015-02-23 12:03:59 -080051 okhttp: 'com.squareup.okhttp:okhttp:2.2.0',
Eric Andersona6f5fff2015-02-26 07:53:17 -080052 protobuf: 'com.google.protobuf:protobuf-java:3.0.0-alpha-2',
53 protobuf_nano: 'com.google.protobuf.nano:protobuf-javanano:3.0.0-alpha-2',
Kun Zhang41940f72015-04-28 18:14:34 -070054 protobuf_plugin: 'com.google.protobuf:protobuf-gradle-plugin:0.3.1',
nathanmittler164b7342014-12-15 09:58:05 -080055
Jakob Buchgraber7ddcdfd2015-02-13 16:21:53 -080056 // TODO: Unreleased dependencies.
57 // These must already be installed in the local maven repository.
nmittler2a425092015-03-11 12:15:30 -070058 netty: 'io.netty:netty-codec-http2:4.1.0.Beta5-SNAPSHOT',
nathanmittler164b7342014-12-15 09:58:05 -080059
Jakob Buchgraber7ddcdfd2015-02-13 16:21:53 -080060 // Test dependencies.
61 junit: 'junit:junit:4.11',
Eric Anderson192144e2015-03-02 13:31:14 -080062 mockito: 'org.mockito:mockito-core:1.10.19'
Jakob Buchgraber7ddcdfd2015-02-13 16:21:53 -080063 ]
64
65 // Determine the correct version of Jetty ALPN boot to use based
66 // on the Java version.
67 def alpnboot_version = '8.1.2.v20141202'
68 if (JavaVersion.current().ordinal() < JavaVersion.VERSION_1_8.ordinal()) {
69 alpnboot_version = '7.1.2.v20141202'
70 }
71
72 alpnboot_package_name = 'org.mortbay.jetty.alpn:alpn-boot:' + alpnboot_version
Eric Andersonb938ba52015-02-28 09:59:25 -080073
Kun Zhang4bc2d6d2015-04-17 10:49:11 -070074 def exeSuffix = osdetector.os == 'windows' ? ".exe" : ""
Kun Zhang90706dc2015-04-09 13:11:31 -070075 protocPluginBaseName = 'protoc-gen-grpc-java'
Kun Zhang221c5342015-04-29 18:16:15 -070076 javaPluginPath = "$rootDir/compiler/build/binaries/java_pluginExecutable/$protocPluginBaseName$exeSuffix"
Jakob Buchgraber7ddcdfd2015-02-13 16:21:53 -080077 }
nathanmittler164b7342014-12-15 09:58:05 -080078
79 dependencies {
80 testCompile libraries.junit,
81 libraries.mockito
82 }
Eric Anderson192144e2015-03-02 13:31:14 -080083
84 signing {
85 required false
86 sign configurations.archives
87 }
88
nmittler732cfc02015-03-03 07:59:13 -080089 // Disable JavaDoc doclint on Java 8. It's annoying.
90 if (JavaVersion.current().isJava8Compatible()) {
91 allprojects {
92 tasks.withType(Javadoc) {
93 options.addStringOption('Xdoclint:none', '-quiet')
94 }
95 }
96 }
97
Eric Andersonc3e8dae2015-01-30 14:58:07 -080098 checkstyle {
99 configFile = file("$rootDir/checkstyle.xml")
Xudong Ma9aae6f62015-04-06 21:04:56 +0800100 toolVersion = "6.5"
Eric Andersonad44f0a2015-05-05 08:54:51 -0700101 ignoreFailures = false
Eric Anderson26141b42015-03-21 10:59:17 -0700102 if (rootProject.hasProperty("checkstyle.ignoreFailures")) {
103 ignoreFailures = rootProject.properties["checkstyle.ignoreFailures"].toBoolean()
104 }
Eric Andersonc3e8dae2015-01-30 14:58:07 -0800105 }
106
107 checkstyleMain {
108 source = fileTree(dir: "src", include: "**/*.java",
109 excludes: ["${buildDir}/generated-sources", "**/TestServiceGrpc.java"])
110 }
111
112 checkstyleTest {
113 source = fileTree(dir: "test", include: "**/*.java",
114 exclude: "${buildDir}/generated-sources")
115 }
116
Eric Anderson192144e2015-03-02 13:31:14 -0800117 task javadocJar(type: Jar) {
118 classifier = 'javadoc'
119 from javadoc
120 }
121
122 task sourcesJar(type: Jar) {
123 classifier = 'sources'
124 from sourceSets.main.allSource
125 }
126
127 artifacts {
128 archives javadocJar, sourcesJar
129 }
130
131 uploadArchives.repositories.mavenDeployer {
132 beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
zhangkun83da3c3f82015-03-11 18:03:31 -0700133 String stagingUrl
134 if (System.getProperty('repositoryId')) {
135 stagingUrl = 'https://oss.sonatype.org/service/local/staging/deployByRepositoryId/' + System.getProperty('repositoryId')
136 } else {
137 stagingUrl = 'https://oss.sonatype.org/service/local/staging/deploy/maven2/'
138 }
139 repository(url: stagingUrl) {
Eric Anderson192144e2015-03-02 13:31:14 -0800140 if (rootProject.hasProperty("ossrhUsername")
141 && rootProject.hasProperty("ossrhPassword")) {
142 authentication(userName: ossrhUsername, password: ossrhPassword)
143 }
144 }
145
146 snapshotRepository(url: "https://oss.sonatype.org/content/repositories/snapshots/") {
147 if (rootProject.hasProperty("ossrhUsername")
148 && rootProject.hasProperty("ossrhPassword")) {
149 authentication(userName: ossrhUsername, password: ossrhPassword)
150 }
151 }
152 }
153
154 [
155 install.repositories.mavenInstaller,
156 uploadArchives.repositories.mavenDeployer,
157 ]*.pom*.whenConfigured { pom ->
158 pom.project {
Eric Anderson7e8a02c2015-03-12 17:03:01 -0700159 name "$project.group:$project.name"
Eric Anderson192144e2015-03-02 13:31:14 -0800160 description project.description
161 url 'https://github.com/grpc/grpc-java'
162
163 scm {
164 connection 'scm:svn:https://github.com/grpc/grpc-java.git'
165 developerConnection 'scm:svn:git@github.com:grpc/grpc-java.git'
166 url 'https://github.com/grpc/grpc-java'
167 }
168
169 licenses {
170 license {
171 name 'BSD 3-Clause'
172 url 'http://opensource.org/licenses/BSD-3-Clause'
173 }
174 }
Eric Anderson7e8a02c2015-03-12 17:03:01 -0700175
176 developers {
177 developer {
178 id "grpc.io"
179 name "gRPC Contributors"
180 email "grpc-io@googlegroups.com"
181 url "http://grpc.io/"
182 // https://issues.gradle.org/browse/GRADLE-2719
183 organization = "Google, Inc."
184 organizationUrl "https://www.google.com"
185 }
186 }
Eric Anderson192144e2015-03-02 13:31:14 -0800187 }
188 }
Kun Zhang3ddd1d52015-04-22 10:02:19 -0700189 // At a test failure, log the stack trace to the console so that we don't
190 // have to open the HTML in a browser.
191 test {
192 testLogging {
193 exceptionFormat = 'full'
194 }
195 }
nathanmittler164b7342014-12-15 09:58:05 -0800196}