Eric Anderson | b938ba5 | 2015-02-28 09:59:25 -0800 | [diff] [blame] | 1 | import org.apache.tools.ant.taskdefs.condition.Os |
| 2 | |
nathanmittler | 164b734 | 2014-12-15 09:58:05 -0800 | [diff] [blame] | 3 | subprojects { |
Eric Anderson | c3e8dae | 2015-01-30 14:58:07 -0800 | [diff] [blame] | 4 | apply plugin: "checkstyle" |
nathanmittler | 164b734 | 2014-12-15 09:58:05 -0800 | [diff] [blame] | 5 | apply plugin: "java" |
| 6 | apply plugin: "maven" |
nmittler | 52f4220 | 2015-01-21 14:30:14 -0800 | [diff] [blame] | 7 | apply plugin: "idea" |
Eric Anderson | 192144e | 2015-03-02 13:31:14 -0800 | [diff] [blame] | 8 | apply plugin: "signing" |
nathanmittler | 164b734 | 2014-12-15 09:58:05 -0800 | [diff] [blame] | 9 | |
nmittler | f831458 | 2015-01-27 10:25:39 -0800 | [diff] [blame] | 10 | group = "io.grpc" |
nathanmittler | 164b734 | 2014-12-15 09:58:05 -0800 | [diff] [blame] | 11 | version = "0.1.0-SNAPSHOT" |
| 12 | |
| 13 | sourceCompatibility = 1.6 |
| 14 | targetCompatibility = 1.6 |
| 15 | |
| 16 | repositories { |
| 17 | mavenCentral() |
| 18 | mavenLocal() |
| 19 | } |
| 20 | |
Eric Anderson | 76d0955 | 2015-03-12 15:25:11 -0700 | [diff] [blame] | 21 | [compileJava, compileTestJava].each() { |
| 22 | it.options.compilerArgs += ["-Xlint:unchecked", "-Xlint:deprecation", "-Xlint:-options"] |
| 23 | it.options.encoding = "UTF-8" |
nmittler | 02c953e | 2015-01-26 14:03:11 -0800 | [diff] [blame] | 24 | } |
| 25 | |
Eric Anderson | 14444a9 | 2015-03-11 16:44:38 -0700 | [diff] [blame] | 26 | javadoc.options.encoding = "UTF-8" |
| 27 | |
Jakob Buchgraber | 7ddcdfd | 2015-02-13 16:21:53 -0800 | [diff] [blame] | 28 | ext { |
| 29 | libraries = [ |
Jakob Buchgraber | 7ddcdfd | 2015-02-13 16:21:53 -0800 | [diff] [blame] | 30 | guava: 'com.google.guava:guava:18.0', |
Jakob Buchgraber | 7ddcdfd | 2015-02-13 16:21:53 -0800 | [diff] [blame] | 31 | // used to collect benchmark results |
| 32 | hdrhistogram: 'org.hdrhistogram:HdrHistogram:2.1.4', |
Jeff Pinner | b1cc7cc | 2015-02-25 10:17:23 -0800 | [diff] [blame] | 33 | hpack: 'com.twitter:hpack:0.10.1', |
nmittler | b897a89 | 2015-02-23 12:03:59 -0800 | [diff] [blame] | 34 | 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 Ryan | 767a12c | 2015-03-02 15:05:09 -0800 | [diff] [blame] | 37 | oauth_client: 'com.google.auth:google-auth-library-oauth2-http:0.1.0', |
nmittler | b897a89 | 2015-02-23 12:03:59 -0800 | [diff] [blame] | 38 | okhttp: 'com.squareup.okhttp:okhttp:2.2.0', |
Eric Anderson | a6f5fff | 2015-02-26 07:53:17 -0800 | [diff] [blame] | 39 | 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', |
nmittler | b897a89 | 2015-02-23 12:03:59 -0800 | [diff] [blame] | 41 | protobuf_plugin: 'ws.antonov.gradle.plugins:gradle-plugin-protobuf:0.9.1', |
nathanmittler | 164b734 | 2014-12-15 09:58:05 -0800 | [diff] [blame] | 42 | |
Jakob Buchgraber | 7ddcdfd | 2015-02-13 16:21:53 -0800 | [diff] [blame] | 43 | // TODO: Unreleased dependencies. |
| 44 | // These must already be installed in the local maven repository. |
nmittler | 2a42509 | 2015-03-11 12:15:30 -0700 | [diff] [blame] | 45 | netty: 'io.netty:netty-codec-http2:4.1.0.Beta5-SNAPSHOT', |
nathanmittler | 164b734 | 2014-12-15 09:58:05 -0800 | [diff] [blame] | 46 | |
Jakob Buchgraber | 7ddcdfd | 2015-02-13 16:21:53 -0800 | [diff] [blame] | 47 | // Test dependencies. |
| 48 | junit: 'junit:junit:4.11', |
Eric Anderson | 192144e | 2015-03-02 13:31:14 -0800 | [diff] [blame] | 49 | mockito: 'org.mockito:mockito-core:1.10.19' |
Jakob Buchgraber | 7ddcdfd | 2015-02-13 16:21:53 -0800 | [diff] [blame] | 50 | ] |
| 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 Anderson | b938ba5 | 2015-02-28 09:59:25 -0800 | [diff] [blame] | 60 | |
| 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 Zhang | 90706dc | 2015-04-09 13:11:31 -0700 | [diff] [blame^] | 69 | protocPluginBaseName = 'protoc-gen-grpc-java' |
| 70 | javaPluginPath = "$splitRootDir/compiler/build/binaries/java_pluginExecutable/$protocPluginBaseName$exeSuffix" |
Jakob Buchgraber | 7ddcdfd | 2015-02-13 16:21:53 -0800 | [diff] [blame] | 71 | } |
nathanmittler | 164b734 | 2014-12-15 09:58:05 -0800 | [diff] [blame] | 72 | |
| 73 | dependencies { |
| 74 | testCompile libraries.junit, |
| 75 | libraries.mockito |
| 76 | } |
Eric Anderson | 192144e | 2015-03-02 13:31:14 -0800 | [diff] [blame] | 77 | |
| 78 | signing { |
| 79 | required false |
| 80 | sign configurations.archives |
| 81 | } |
| 82 | |
nmittler | 732cfc0 | 2015-03-03 07:59:13 -0800 | [diff] [blame] | 83 | // 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 Anderson | c3e8dae | 2015-01-30 14:58:07 -0800 | [diff] [blame] | 92 | checkstyle { |
| 93 | configFile = file("$rootDir/checkstyle.xml") |
Xudong Ma | 9aae6f6 | 2015-04-06 21:04:56 +0800 | [diff] [blame] | 94 | toolVersion = "6.5" |
Eric Anderson | 26141b4 | 2015-03-21 10:59:17 -0700 | [diff] [blame] | 95 | ignoreFailures = true |
| 96 | if (rootProject.hasProperty("checkstyle.ignoreFailures")) { |
| 97 | ignoreFailures = rootProject.properties["checkstyle.ignoreFailures"].toBoolean() |
| 98 | } |
Eric Anderson | c3e8dae | 2015-01-30 14:58:07 -0800 | [diff] [blame] | 99 | } |
| 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 Anderson | 192144e | 2015-03-02 13:31:14 -0800 | [diff] [blame] | 111 | 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 Anderson | 7e8a02c | 2015-03-12 17:03:01 -0700 | [diff] [blame] | 148 | name "$project.group:$project.name" |
Eric Anderson | 192144e | 2015-03-02 13:31:14 -0800 | [diff] [blame] | 149 | 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 Anderson | 7e8a02c | 2015-03-12 17:03:01 -0700 | [diff] [blame] | 164 | |
| 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 Anderson | 192144e | 2015-03-02 13:31:14 -0800 | [diff] [blame] | 176 | } |
| 177 | } |
nathanmittler | 164b734 | 2014-12-15 09:58:05 -0800 | [diff] [blame] | 178 | } |