blob: 75fed00bb7adcac46fa85bb6a1109eb74097a0eb [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 }
69 javaPluginPath = "$splitRootDir/compiler/build/binaries/java_pluginExecutable/java_plugin$exeSuffix"
Jakob Buchgraber7ddcdfd2015-02-13 16:21:53 -080070 }
nathanmittler164b7342014-12-15 09:58:05 -080071
72 dependencies {
73 testCompile libraries.junit,
74 libraries.mockito
75 }
Eric Anderson192144e2015-03-02 13:31:14 -080076
77 signing {
78 required false
79 sign configurations.archives
80 }
81
nmittler732cfc02015-03-03 07:59:13 -080082 // Disable JavaDoc doclint on Java 8. It's annoying.
83 if (JavaVersion.current().isJava8Compatible()) {
84 allprojects {
85 tasks.withType(Javadoc) {
86 options.addStringOption('Xdoclint:none', '-quiet')
87 }
88 }
89 }
90
Eric Andersonc3e8dae2015-01-30 14:58:07 -080091 checkstyle {
92 configFile = file("$rootDir/checkstyle.xml")
93 toolVersion = "6.2"
Eric Anderson26141b42015-03-21 10:59:17 -070094 ignoreFailures = true
95 if (rootProject.hasProperty("checkstyle.ignoreFailures")) {
96 ignoreFailures = rootProject.properties["checkstyle.ignoreFailures"].toBoolean()
97 }
Eric Andersonc3e8dae2015-01-30 14:58:07 -080098 }
99
100 checkstyleMain {
101 source = fileTree(dir: "src", include: "**/*.java",
102 excludes: ["${buildDir}/generated-sources", "**/TestServiceGrpc.java"])
103 }
104
105 checkstyleTest {
106 source = fileTree(dir: "test", include: "**/*.java",
107 exclude: "${buildDir}/generated-sources")
108 }
109
Eric Anderson192144e2015-03-02 13:31:14 -0800110 task javadocJar(type: Jar) {
111 classifier = 'javadoc'
112 from javadoc
113 }
114
115 task sourcesJar(type: Jar) {
116 classifier = 'sources'
117 from sourceSets.main.allSource
118 }
119
120 artifacts {
121 archives javadocJar, sourcesJar
122 }
123
124 uploadArchives.repositories.mavenDeployer {
125 beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
126
127 repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2/") {
128 if (rootProject.hasProperty("ossrhUsername")
129 && rootProject.hasProperty("ossrhPassword")) {
130 authentication(userName: ossrhUsername, password: ossrhPassword)
131 }
132 }
133
134 snapshotRepository(url: "https://oss.sonatype.org/content/repositories/snapshots/") {
135 if (rootProject.hasProperty("ossrhUsername")
136 && rootProject.hasProperty("ossrhPassword")) {
137 authentication(userName: ossrhUsername, password: ossrhPassword)
138 }
139 }
140 }
141
142 [
143 install.repositories.mavenInstaller,
144 uploadArchives.repositories.mavenDeployer,
145 ]*.pom*.whenConfigured { pom ->
146 pom.project {
Eric Anderson7e8a02c2015-03-12 17:03:01 -0700147 name "$project.group:$project.name"
Eric Anderson192144e2015-03-02 13:31:14 -0800148 description project.description
149 url 'https://github.com/grpc/grpc-java'
150
151 scm {
152 connection 'scm:svn:https://github.com/grpc/grpc-java.git'
153 developerConnection 'scm:svn:git@github.com:grpc/grpc-java.git'
154 url 'https://github.com/grpc/grpc-java'
155 }
156
157 licenses {
158 license {
159 name 'BSD 3-Clause'
160 url 'http://opensource.org/licenses/BSD-3-Clause'
161 }
162 }
Eric Anderson7e8a02c2015-03-12 17:03:01 -0700163
164 developers {
165 developer {
166 id "grpc.io"
167 name "gRPC Contributors"
168 email "grpc-io@googlegroups.com"
169 url "http://grpc.io/"
170 // https://issues.gradle.org/browse/GRADLE-2719
171 organization = "Google, Inc."
172 organizationUrl "https://www.google.com"
173 }
174 }
Eric Anderson192144e2015-03-02 13:31:14 -0800175 }
176 }
nathanmittler164b7342014-12-15 09:58:05 -0800177}