blob: d5e3b0d855ea87d638a231379f2bceaae6a3735d [file] [log] [blame]
Eric Andersonb938ba52015-02-28 09:59:25 -08001import org.apache.tools.ant.taskdefs.condition.Os
2
nathanmittler164b7342014-12-15 09:58:05 -08003subprojects {
Eric Andersonc3e8dae2015-01-30 14:58:07 -08004 apply plugin: "checkstyle"
nathanmittler164b7342014-12-15 09:58:05 -08005 apply plugin: "java"
6 apply plugin: "maven"
nmittler52f42202015-01-21 14:30:14 -08007 apply plugin: "idea"
Eric Anderson192144e2015-03-02 13:31:14 -08008 apply plugin: "signing"
nathanmittler164b7342014-12-15 09:58:05 -08009
nmittlerf8314582015-01-27 10:25:39 -080010 group = "io.grpc"
nathanmittler164b7342014-12-15 09:58:05 -080011 version = "0.1.0-SNAPSHOT"
12
13 sourceCompatibility = 1.6
14 targetCompatibility = 1.6
15
16 repositories {
17 mavenCentral()
18 mavenLocal()
19 }
20
Eric Anderson76d09552015-03-12 15:25:11 -070021 [compileJava, compileTestJava].each() {
22 it.options.compilerArgs += ["-Xlint:unchecked", "-Xlint:deprecation", "-Xlint:-options"]
23 it.options.encoding = "UTF-8"
nmittler02c953e2015-01-26 14:03:11 -080024 }
25
Eric Anderson14444a92015-03-11 16:44:38 -070026 javadoc.options.encoding = "UTF-8"
27
Jakob Buchgraber7ddcdfd2015-02-13 16:21:53 -080028 ext {
29 libraries = [
Jakob Buchgraber7ddcdfd2015-02-13 16:21:53 -080030 guava: 'com.google.guava:guava:18.0',
Jakob Buchgraber7ddcdfd2015-02-13 16:21:53 -080031 // used to collect benchmark results
32 hdrhistogram: 'org.hdrhistogram:HdrHistogram:2.1.4',
Jeff Pinnerb1cc7cc2015-02-25 10:17:23 -080033 hpack: 'com.twitter:hpack:0.10.1',
nmittlerb897a892015-02-23 12:03:59 -080034 javaee_api: 'javax:javaee-api:7.0',
35 jsonp: 'org.glassfish:javax.json:1.0.4',
36 jsr305: 'com.google.code.findbugs:jsr305:3.0.0',
Louis Ryan767a12c2015-03-02 15:05:09 -080037 oauth_client: 'com.google.auth:google-auth-library-oauth2-http:0.1.0',
nmittlerb897a892015-02-23 12:03:59 -080038 okhttp: 'com.squareup.okhttp:okhttp:2.2.0',
Eric Andersona6f5fff2015-02-26 07:53:17 -080039 protobuf: 'com.google.protobuf:protobuf-java:3.0.0-alpha-2',
40 protobuf_nano: 'com.google.protobuf.nano:protobuf-javanano:3.0.0-alpha-2',
nmittlerb897a892015-02-23 12:03:59 -080041 protobuf_plugin: 'ws.antonov.gradle.plugins:gradle-plugin-protobuf:0.9.1',
nathanmittler164b7342014-12-15 09:58:05 -080042
Jakob Buchgraber7ddcdfd2015-02-13 16:21:53 -080043 // TODO: Unreleased dependencies.
44 // These must already be installed in the local maven repository.
nmittler2a425092015-03-11 12:15:30 -070045 netty: 'io.netty:netty-codec-http2:4.1.0.Beta5-SNAPSHOT',
nathanmittler164b7342014-12-15 09:58:05 -080046
Jakob Buchgraber7ddcdfd2015-02-13 16:21:53 -080047 // Test dependencies.
48 junit: 'junit:junit:4.11',
Eric Anderson192144e2015-03-02 13:31:14 -080049 mockito: 'org.mockito:mockito-core:1.10.19'
Jakob Buchgraber7ddcdfd2015-02-13 16:21:53 -080050 ]
51
52 // Determine the correct version of Jetty ALPN boot to use based
53 // on the Java version.
54 def alpnboot_version = '8.1.2.v20141202'
55 if (JavaVersion.current().ordinal() < JavaVersion.VERSION_1_8.ordinal()) {
56 alpnboot_version = '7.1.2.v20141202'
57 }
58
59 alpnboot_package_name = 'org.mortbay.jetty.alpn:alpn-boot:' + alpnboot_version
Eric Andersonb938ba52015-02-28 09:59:25 -080060
61 def exeSuffix = Os.isFamily(Os.FAMILY_WINDOWS) ? ".exe" : ""
62 // The split is to workaround everything after the colon in C:\ being
63 // removed due to a bug in the protobuf plugin.
64 // https://github.com/aantono/gradle-plugin-protobuf/issues/23
65 def splitRootDir = rootDir
66 if (Os.isFamily(Os.FAMILY_WINDOWS)) {
67 splitRootDir = splitRootDir.getPath().split(":", 2)[1]
68 }
Kun Zhang90706dc2015-04-09 13:11:31 -070069 protocPluginBaseName = 'protoc-gen-grpc-java'
70 javaPluginPath = "$splitRootDir/compiler/build/binaries/java_pluginExecutable/$protocPluginBaseName$exeSuffix"
Jakob Buchgraber7ddcdfd2015-02-13 16:21:53 -080071 }
nathanmittler164b7342014-12-15 09:58:05 -080072
73 dependencies {
74 testCompile libraries.junit,
75 libraries.mockito
76 }
Eric Anderson192144e2015-03-02 13:31:14 -080077
78 signing {
79 required false
80 sign configurations.archives
81 }
82
nmittler732cfc02015-03-03 07:59:13 -080083 // Disable JavaDoc doclint on Java 8. It's annoying.
84 if (JavaVersion.current().isJava8Compatible()) {
85 allprojects {
86 tasks.withType(Javadoc) {
87 options.addStringOption('Xdoclint:none', '-quiet')
88 }
89 }
90 }
91
Eric Andersonc3e8dae2015-01-30 14:58:07 -080092 checkstyle {
93 configFile = file("$rootDir/checkstyle.xml")
Xudong Ma9aae6f62015-04-06 21:04:56 +080094 toolVersion = "6.5"
Eric Anderson26141b42015-03-21 10:59:17 -070095 ignoreFailures = true
96 if (rootProject.hasProperty("checkstyle.ignoreFailures")) {
97 ignoreFailures = rootProject.properties["checkstyle.ignoreFailures"].toBoolean()
98 }
Eric Andersonc3e8dae2015-01-30 14:58:07 -080099 }
100
101 checkstyleMain {
102 source = fileTree(dir: "src", include: "**/*.java",
103 excludes: ["${buildDir}/generated-sources", "**/TestServiceGrpc.java"])
104 }
105
106 checkstyleTest {
107 source = fileTree(dir: "test", include: "**/*.java",
108 exclude: "${buildDir}/generated-sources")
109 }
110
Eric Anderson192144e2015-03-02 13:31:14 -0800111 task javadocJar(type: Jar) {
112 classifier = 'javadoc'
113 from javadoc
114 }
115
116 task sourcesJar(type: Jar) {
117 classifier = 'sources'
118 from sourceSets.main.allSource
119 }
120
121 artifacts {
122 archives javadocJar, sourcesJar
123 }
124
125 uploadArchives.repositories.mavenDeployer {
126 beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
127
128 repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2/") {
129 if (rootProject.hasProperty("ossrhUsername")
130 && rootProject.hasProperty("ossrhPassword")) {
131 authentication(userName: ossrhUsername, password: ossrhPassword)
132 }
133 }
134
135 snapshotRepository(url: "https://oss.sonatype.org/content/repositories/snapshots/") {
136 if (rootProject.hasProperty("ossrhUsername")
137 && rootProject.hasProperty("ossrhPassword")) {
138 authentication(userName: ossrhUsername, password: ossrhPassword)
139 }
140 }
141 }
142
143 [
144 install.repositories.mavenInstaller,
145 uploadArchives.repositories.mavenDeployer,
146 ]*.pom*.whenConfigured { pom ->
147 pom.project {
Eric Anderson7e8a02c2015-03-12 17:03:01 -0700148 name "$project.group:$project.name"
Eric Anderson192144e2015-03-02 13:31:14 -0800149 description project.description
150 url 'https://github.com/grpc/grpc-java'
151
152 scm {
153 connection 'scm:svn:https://github.com/grpc/grpc-java.git'
154 developerConnection 'scm:svn:git@github.com:grpc/grpc-java.git'
155 url 'https://github.com/grpc/grpc-java'
156 }
157
158 licenses {
159 license {
160 name 'BSD 3-Clause'
161 url 'http://opensource.org/licenses/BSD-3-Clause'
162 }
163 }
Eric Anderson7e8a02c2015-03-12 17:03:01 -0700164
165 developers {
166 developer {
167 id "grpc.io"
168 name "gRPC Contributors"
169 email "grpc-io@googlegroups.com"
170 url "http://grpc.io/"
171 // https://issues.gradle.org/browse/GRADLE-2719
172 organization = "Google, Inc."
173 organizationUrl "https://www.google.com"
174 }
175 }
Eric Anderson192144e2015-03-02 13:31:14 -0800176 }
177 }
nathanmittler164b7342014-12-15 09:58:05 -0800178}