blob: 36aae8d913956751594ab42588132dcdc7894428 [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 {
4 apply plugin: "java"
5 apply plugin: "maven"
nmittler52f42202015-01-21 14:30:14 -08006 apply plugin: "idea"
Eric Anderson192144e2015-03-02 13:31:14 -08007 apply plugin: "signing"
nathanmittler164b7342014-12-15 09:58:05 -08008
nmittlerf8314582015-01-27 10:25:39 -08009 group = "io.grpc"
nathanmittler164b7342014-12-15 09:58:05 -080010 version = "0.1.0-SNAPSHOT"
11
12 sourceCompatibility = 1.6
13 targetCompatibility = 1.6
14
15 repositories {
16 mavenCentral()
17 mavenLocal()
18 }
19
nmittler02c953e2015-01-26 14:03:11 -080020 compileJava {
Eric Andersone26608f2015-02-13 16:39:54 -080021 options.compilerArgs << "-Xlint:unchecked"
Eric Anderson61179ab2015-02-24 22:59:32 +000022 options.encoding = "UTF-8"
nmittler02c953e2015-01-26 14:03:11 -080023 }
24
Jakob Buchgraber7ddcdfd2015-02-13 16:21:53 -080025 ext {
26 libraries = [
Jakob Buchgraber7ddcdfd2015-02-13 16:21:53 -080027 guava: 'com.google.guava:guava:18.0',
Jakob Buchgraber7ddcdfd2015-02-13 16:21:53 -080028 // used to collect benchmark results
29 hdrhistogram: 'org.hdrhistogram:HdrHistogram:2.1.4',
Jeff Pinnerb1cc7cc2015-02-25 10:17:23 -080030 hpack: 'com.twitter:hpack:0.10.1',
nmittlerb897a892015-02-23 12:03:59 -080031 javaee_api: 'javax:javaee-api:7.0',
32 jsonp: 'org.glassfish:javax.json:1.0.4',
33 jsr305: 'com.google.code.findbugs:jsr305:3.0.0',
34 oauth_client: 'com.google.oauth-client:google-oauth-client:1.18.0-rc',
35 okhttp: 'com.squareup.okhttp:okhttp:2.2.0',
Eric Andersona6f5fff2015-02-26 07:53:17 -080036 protobuf: 'com.google.protobuf:protobuf-java:3.0.0-alpha-2',
37 protobuf_nano: 'com.google.protobuf.nano:protobuf-javanano:3.0.0-alpha-2',
nmittlerb897a892015-02-23 12:03:59 -080038 protobuf_plugin: 'ws.antonov.gradle.plugins:gradle-plugin-protobuf:0.9.1',
nathanmittler164b7342014-12-15 09:58:05 -080039
Jakob Buchgraber7ddcdfd2015-02-13 16:21:53 -080040 // TODO: Unreleased dependencies.
41 // These must already be installed in the local maven repository.
42 netty: 'io.netty:netty-codec-http2:5.0.0.Alpha2-SNAPSHOT',
nathanmittler164b7342014-12-15 09:58:05 -080043
Jakob Buchgraber7ddcdfd2015-02-13 16:21:53 -080044 // Test dependencies.
45 junit: 'junit:junit:4.11',
Eric Anderson192144e2015-03-02 13:31:14 -080046 mockito: 'org.mockito:mockito-core:1.10.19'
Jakob Buchgraber7ddcdfd2015-02-13 16:21:53 -080047 ]
48
49 // Determine the correct version of Jetty ALPN boot to use based
50 // on the Java version.
51 def alpnboot_version = '8.1.2.v20141202'
52 if (JavaVersion.current().ordinal() < JavaVersion.VERSION_1_8.ordinal()) {
53 alpnboot_version = '7.1.2.v20141202'
54 }
55
56 alpnboot_package_name = 'org.mortbay.jetty.alpn:alpn-boot:' + alpnboot_version
Eric Andersonb938ba52015-02-28 09:59:25 -080057
58 def exeSuffix = Os.isFamily(Os.FAMILY_WINDOWS) ? ".exe" : ""
59 // The split is to workaround everything after the colon in C:\ being
60 // removed due to a bug in the protobuf plugin.
61 // https://github.com/aantono/gradle-plugin-protobuf/issues/23
62 def splitRootDir = rootDir
63 if (Os.isFamily(Os.FAMILY_WINDOWS)) {
64 splitRootDir = splitRootDir.getPath().split(":", 2)[1]
65 }
66 javaPluginPath = "$splitRootDir/compiler/build/binaries/java_pluginExecutable/java_plugin$exeSuffix"
Jakob Buchgraber7ddcdfd2015-02-13 16:21:53 -080067 }
nathanmittler164b7342014-12-15 09:58:05 -080068
69 dependencies {
70 testCompile libraries.junit,
71 libraries.mockito
72 }
Eric Anderson192144e2015-03-02 13:31:14 -080073
74 signing {
75 required false
76 sign configurations.archives
77 }
78
nmittler732cfc02015-03-03 07:59:13 -080079 // Disable JavaDoc doclint on Java 8. It's annoying.
80 if (JavaVersion.current().isJava8Compatible()) {
81 allprojects {
82 tasks.withType(Javadoc) {
83 options.addStringOption('Xdoclint:none', '-quiet')
84 }
85 }
86 }
87
Eric Anderson192144e2015-03-02 13:31:14 -080088 task javadocJar(type: Jar) {
89 classifier = 'javadoc'
90 from javadoc
91 }
92
93 task sourcesJar(type: Jar) {
94 classifier = 'sources'
95 from sourceSets.main.allSource
96 }
97
98 artifacts {
99 archives javadocJar, sourcesJar
100 }
101
102 uploadArchives.repositories.mavenDeployer {
103 beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
104
105 repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2/") {
106 if (rootProject.hasProperty("ossrhUsername")
107 && rootProject.hasProperty("ossrhPassword")) {
108 authentication(userName: ossrhUsername, password: ossrhPassword)
109 }
110 }
111
112 snapshotRepository(url: "https://oss.sonatype.org/content/repositories/snapshots/") {
113 if (rootProject.hasProperty("ossrhUsername")
114 && rootProject.hasProperty("ossrhPassword")) {
115 authentication(userName: ossrhUsername, password: ossrhPassword)
116 }
117 }
118 }
119
120 [
121 install.repositories.mavenInstaller,
122 uploadArchives.repositories.mavenDeployer,
123 ]*.pom*.whenConfigured { pom ->
124 pom.project {
125 description project.description
126 url 'https://github.com/grpc/grpc-java'
127
128 scm {
129 connection 'scm:svn:https://github.com/grpc/grpc-java.git'
130 developerConnection 'scm:svn:git@github.com:grpc/grpc-java.git'
131 url 'https://github.com/grpc/grpc-java'
132 }
133
134 licenses {
135 license {
136 name 'BSD 3-Clause'
137 url 'http://opensource.org/licenses/BSD-3-Clause'
138 }
139 }
140 }
141 }
nathanmittler164b7342014-12-15 09:58:05 -0800142}