diff --git a/all/build.gradle b/all/build.gradle index 3df9132c09..5cd86feb47 100644 --- a/all/build.gradle +++ b/all/build.gradle @@ -1,4 +1,6 @@ plugins { + id "maven-publish" + id "com.github.kt3k.coveralls" } diff --git a/alts/build.gradle b/alts/build.gradle index 1d3ed8ab8b..4b06db9e5d 100644 --- a/alts/build.gradle +++ b/alts/build.gradle @@ -1,4 +1,6 @@ plugins { + id "maven-publish" + id "com.github.johnrengelman.shadow" id "com.google.protobuf" } diff --git a/api/build.gradle b/api/build.gradle index 5b50e3da7f..ce4662904c 100644 --- a/api/build.gradle +++ b/api/build.gradle @@ -1,4 +1,6 @@ plugins { + id "maven-publish" + id "me.champeau.gradle.jmh" } diff --git a/auth/build.gradle b/auth/build.gradle index 09619ea562..85509f51df 100644 --- a/auth/build.gradle +++ b/auth/build.gradle @@ -1,3 +1,7 @@ +plugins { + id "maven-publish" +} + description = "gRPC: Auth" dependencies { compile project(':grpc-api'), diff --git a/benchmarks/build.gradle b/benchmarks/build.gradle index f5e284031d..a31d55b2d3 100644 --- a/benchmarks/build.gradle +++ b/benchmarks/build.gradle @@ -1,5 +1,6 @@ plugins { id "application" + id "maven-publish" id "com.google.protobuf" id "me.champeau.gradle.jmh" diff --git a/bom/build.gradle b/bom/build.gradle index 8c1d30b950..dd22c7e7ae 100644 --- a/bom/build.gradle +++ b/bom/build.gradle @@ -1,3 +1,7 @@ +plugins { + id "maven-publish" +} + description = 'gRPC: BOM' publishing { diff --git a/build.gradle b/build.gradle index 7fc0360ee1..5360313afd 100644 --- a/build.gradle +++ b/build.gradle @@ -11,7 +11,6 @@ subprojects { apply plugin: "checkstyle" apply plugin: "java" apply plugin: "maven" - apply plugin: "maven-publish" apply plugin: "idea" apply plugin: "signing" apply plugin: "jacoco" @@ -305,109 +304,107 @@ subprojects { } } - task javadocJar(type: Jar) { - classifier = 'javadoc' - from javadoc - } + plugins.withId("maven-publish") { + task javadocJar(type: Jar) { + classifier = 'javadoc' + from javadoc + } - task sourcesJar(type: Jar) { - classifier = 'sources' - from sourceSets.main.allSource - } + task sourcesJar(type: Jar) { + classifier = 'sources' + from sourceSets.main.allSource + } - publishing { - publications { - // do not use mavenJava, as java plugin will modify it via "magic" - maven(MavenPublication) { - if (project.name != 'grpc-netty-shaded') { - from components.java - } - - artifact javadocJar - artifact sourcesJar - - pom { - name = project.group + ":" + project.name - url = 'https://github.com/grpc/grpc-java' - afterEvaluate { - // description is not available until evaluated. - description = project.description + publishing { + publications { + // do not use mavenJava, as java plugin will modify it via "magic" + maven(MavenPublication) { + if (project.name != 'grpc-netty-shaded') { + from components.java } - scm { - connection = 'scm:git:https://github.com/grpc/grpc-java.git' - developerConnection = 'scm:git:git@github.com:grpc/grpc-java.git' + artifact javadocJar + artifact sourcesJar + + pom { + name = project.group + ":" + project.name url = 'https://github.com/grpc/grpc-java' - } - - licenses { - license { - name = 'Apache 2.0' - url = 'https://opensource.org/licenses/Apache-2.0' + afterEvaluate { + // description is not available until evaluated. + description = project.description } - } - developers { - developer { - id = "grpc.io" - name = "gRPC Contributors" - email = "grpc-io@googlegroups.com" - url = "https://grpc.io/" - organization = "gRPC Authors" - organizationUrl = "https://www.google.com" + scm { + connection = 'scm:git:https://github.com/grpc/grpc-java.git' + developerConnection = 'scm:git:git@github.com:grpc/grpc-java.git' + url = 'https://github.com/grpc/grpc-java' } - } - withXml { - if (!(project.name in - [ - "grpc-stub", - "grpc-protobuf", - "grpc-protobuf-lite", - ])) { - asNode().dependencies.'*'.findAll() { dep -> - dep.artifactId.text() in ['grpc-api', 'grpc-core'] - }.each() { core -> - core.version*.value = "[" + core.version.text() + "]" + licenses { + license { + name = 'Apache 2.0' + url = 'https://opensource.org/licenses/Apache-2.0' + } + } + + developers { + developer { + id = "grpc.io" + name = "gRPC Contributors" + email = "grpc-io@googlegroups.com" + url = "https://grpc.io/" + organization = "gRPC Authors" + organizationUrl = "https://www.google.com" + } + } + + withXml { + if (!(project.name in + [ + "grpc-stub", + "grpc-protobuf", + "grpc-protobuf-lite", + ])) { + asNode().dependencies.'*'.findAll() { dep -> + dep.artifactId.text() in ['grpc-api', 'grpc-core'] + }.each() { core -> + core.version*.value = "[" + core.version.text() + "]" + } } } } } } - } - repositories { - maven { - if (rootProject.hasProperty('repositoryDir')) { - url = new File(rootProject.repositoryDir).toURI() - } else { - String stagingUrl - if (rootProject.hasProperty('repositoryId')) { - stagingUrl = 'https://oss.sonatype.org/service/local/staging/deployByRepositoryId/' + - rootProject.repositoryId + repositories { + maven { + if (rootProject.hasProperty('repositoryDir')) { + url = new File(rootProject.repositoryDir).toURI() } else { - stagingUrl = 'https://oss.sonatype.org/service/local/staging/deploy/maven2/' - } - credentials { - if (rootProject.hasProperty('ossrhUsername') && rootProject.hasProperty('ossrhPassword')) { - username = rootProject.ossrhUsername - password = rootProject.ossrhPassword + String stagingUrl + if (rootProject.hasProperty('repositoryId')) { + stagingUrl = 'https://oss.sonatype.org/service/local/staging/deployByRepositoryId/' + + rootProject.repositoryId + } else { + stagingUrl = 'https://oss.sonatype.org/service/local/staging/deploy/maven2/' } + credentials { + if (rootProject.hasProperty('ossrhUsername') && rootProject.hasProperty('ossrhPassword')) { + username = rootProject.ossrhUsername + password = rootProject.ossrhPassword + } + } + def releaseUrl = stagingUrl + def snapshotUrl = 'https://oss.sonatype.org/content/repositories/snapshots/' + url = version.endsWith('SNAPSHOT') ? snapshotUrl : releaseUrl } - def releaseUrl = stagingUrl - def snapshotUrl = 'https://oss.sonatype.org/content/repositories/snapshots/' - url = version.endsWith('SNAPSHOT') ? snapshotUrl : releaseUrl - } + } } } - } - signing { - required false - sign publishing.publications.maven - } - - [publishMavenPublicationToMavenRepository, publishMavenPublicationToMavenLocal]*.onlyIf { - !name.contains("grpc-gae-interop-testing") && !name.contains("grpc-xds") + signing { + required false + sign publishing.publications.maven + } } // At a test failure, log the stack trace to the console so that we don't diff --git a/compiler/build.gradle b/compiler/build.gradle index a57fd41bc3..1b0a21037f 100644 --- a/compiler/build.gradle +++ b/compiler/build.gradle @@ -1,5 +1,6 @@ plugins { id "cpp" + id "maven-publish" id "com.google.protobuf" } diff --git a/context/build.gradle b/context/build.gradle index e504f5de57..b2c3c4d5a1 100644 --- a/context/build.gradle +++ b/context/build.gradle @@ -1,4 +1,6 @@ plugins { + id "maven-publish" + id "me.champeau.gradle.jmh" } diff --git a/core/build.gradle b/core/build.gradle index ce215d1f88..f9b81a0a97 100644 --- a/core/build.gradle +++ b/core/build.gradle @@ -1,4 +1,6 @@ plugins { + id "maven-publish" + id "me.champeau.gradle.jmh" } diff --git a/grpclb/build.gradle b/grpclb/build.gradle index 2e67844e7d..7488fd0b52 100644 --- a/grpclb/build.gradle +++ b/grpclb/build.gradle @@ -1,4 +1,6 @@ plugins { + id "maven-publish" + id "com.google.protobuf" } diff --git a/interop-testing/build.gradle b/interop-testing/build.gradle index 33e880f9e6..a1709c1964 100644 --- a/interop-testing/build.gradle +++ b/interop-testing/build.gradle @@ -1,5 +1,6 @@ plugins { id "application" + id "maven-publish" id "com.google.protobuf" } diff --git a/netty/build.gradle b/netty/build.gradle index 8afe46da18..60b7d8a750 100644 --- a/netty/build.gradle +++ b/netty/build.gradle @@ -1,4 +1,6 @@ plugins { + id "maven-publish" + id "me.champeau.gradle.jmh" } diff --git a/netty/shaded/build.gradle b/netty/shaded/build.gradle index b7f6ec73d6..609e6c3c28 100644 --- a/netty/shaded/build.gradle +++ b/netty/shaded/build.gradle @@ -1,4 +1,6 @@ plugins { + id "maven-publish" + id "com.github.johnrengelman.shadow" } diff --git a/okhttp/build.gradle b/okhttp/build.gradle index 7ee7fed4c5..5b6fd6d468 100644 --- a/okhttp/build.gradle +++ b/okhttp/build.gradle @@ -1,3 +1,7 @@ +plugins { + id "maven-publish" +} + description = "gRPC: OkHttp" dependencies { diff --git a/protobuf-lite/build.gradle b/protobuf-lite/build.gradle index a319a182cb..49d42570c0 100644 --- a/protobuf-lite/build.gradle +++ b/protobuf-lite/build.gradle @@ -1,4 +1,6 @@ plugins { + id "maven-publish" + id "com.google.protobuf" } diff --git a/protobuf/build.gradle b/protobuf/build.gradle index b4204bd631..384bd3e2fb 100644 --- a/protobuf/build.gradle +++ b/protobuf/build.gradle @@ -1,4 +1,6 @@ plugins { + id "maven-publish" + id "com.google.protobuf" } diff --git a/services/build.gradle b/services/build.gradle index 739b2d9f27..cac01f3d9a 100644 --- a/services/build.gradle +++ b/services/build.gradle @@ -1,4 +1,6 @@ plugins { + id "maven-publish" + id "com.google.protobuf" } diff --git a/stub/build.gradle b/stub/build.gradle index 3ee264db4b..6e9264b087 100644 --- a/stub/build.gradle +++ b/stub/build.gradle @@ -1,3 +1,7 @@ +plugins { + id "maven-publish" +} + description = "gRPC: Stub" dependencies { compile project(':grpc-api') diff --git a/testing-proto/build.gradle b/testing-proto/build.gradle index 6a09b2f778..25a717bf3f 100644 --- a/testing-proto/build.gradle +++ b/testing-proto/build.gradle @@ -1,4 +1,6 @@ plugins { + id "maven-publish" + id "com.google.protobuf" } diff --git a/testing/build.gradle b/testing/build.gradle index fa038fc456..450377072f 100644 --- a/testing/build.gradle +++ b/testing/build.gradle @@ -1,3 +1,7 @@ +plugins { + id "maven-publish" +} + description = "gRPC: Testing" dependencies { diff --git a/xds/build.gradle b/xds/build.gradle index 9aaadcff7c..fb98b48cd0 100644 --- a/xds/build.gradle +++ b/xds/build.gradle @@ -1,4 +1,6 @@ plugins { + id "maven-publish" + id "com.github.johnrengelman.shadow" id "com.google.protobuf" } @@ -68,3 +70,4 @@ publishing { } } } +[publishMavenPublicationToMavenRepository, publishMavenPublicationToMavenLocal]*.onlyIf { false }