Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

all: migrate gradle build to java-library plugin #6902

Closed
wants to merge 21 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
432f47a
context: migrate away deprecated gradle configurations
dapengzhang0 Apr 5, 2020
b05a22c
all: use java-library gradle plugin for grpc-api
dapengzhang0 Apr 5, 2020
9bd2f7c
core,netty,okhttp: use java-library plugin for grpc-core
dapengzhang0 Apr 5, 2020
5090e29
stub: use java-library gradle plugin
dapengzhang0 Apr 5, 2020
648ce63
compiler: migrate away deprecated gradle configurations
dapengzhang0 Apr 5, 2020
b8366a8
protobuf, protobuf-lite: use java-library gradle plugin
dapengzhang0 Apr 5, 2020
825679e
auth: use java-library gradle plugin
dapengzhang0 Apr 5, 2020
d88a309
benchmarks: migrate away deprecated gradle configurations
dapengzhang0 Apr 5, 2020
c25e376
all: use java-library gradle plugin for grpc-census
dapengzhang0 Apr 5, 2020
dfa15e7
grpclb: migrate away deprecated gradle configurations
dapengzhang0 Apr 5, 2020
ad39f55
netty: use java-library gradle plugin
dapengzhang0 Apr 6, 2020
901f95d
okhttp: use java-library gradle plugin
dapengzhang0 Apr 6, 2020
553bde2
rls: migrate away deprecated gradle configurations
dapengzhang0 Apr 6, 2020
af87b65
services: use java-library gradle plugin
dapengzhang0 Apr 6, 2020
318e601
xds: migrate away deprecated gradle configurations
dapengzhang0 Apr 6, 2020
3e1d1e4
alts: use java-library gradle plugin
dapengzhang0 Apr 6, 2020
60ecf5f
testing,testing-proto: use java-library gradle plugin
dapengzhang0 Apr 6, 2020
2f36dbb
android,cronet: use api configuration with android library gradle plugin
dapengzhang0 Apr 6, 2020
ef780f3
interop-testing,gae-interop-testing: migrate away deprecated gradle c…
dapengzhang0 Apr 6, 2020
0762b98
build: fix resolutionStrategy
dapengzhang0 Apr 6, 2020
6b4b151
grpc-all: migrate away deprecated gradle configurations
dapengzhang0 Apr 8, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion all/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ for (subproject in rootProject.subprojects) {
}

dependencies {
compile subprojects.minus(project(':grpc-protobuf-lite'))
implementation subprojects.minus(project(':grpc-protobuf-lite'))
}

javadoc {
Expand Down
28 changes: 14 additions & 14 deletions alts/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
id "java"
id "java-library"
id "maven-publish"

id "com.github.johnrengelman.shadow"
Expand All @@ -13,35 +13,35 @@ sourceCompatibility = 1.7
targetCompatibility = 1.7

dependencies {
compile project(':grpc-auth'),
project(':grpc-core'),
api project(':grpc-core')
compileOnly libraries.javax_annotation
implementation project(':grpc-auth'),
project(':grpc-grpclb'),
project(':grpc-protobuf'),
project(':grpc-stub'),
libraries.lang,
libraries.protobuf,
libraries.conscrypt
def nettyDependency = compile project(':grpc-netty')
compile (libraries.google_auth_oauth2_http) {
def nettyDependency = implementation project(':grpc-netty')
implementation (libraries.google_auth_oauth2_http) {
// prefer our own versions instead of google-auth-oauth2-http's dependency
exclude group: 'com.google.guava', module: 'guava'
// we'll always be more up-to-date
exclude group: 'io.grpc', module: 'grpc-context'
}
compileOnly libraries.javax_annotation

shadow configurations.compile.getDependencies().minus(nettyDependency)
shadow project(path: ':grpc-netty-shaded', configuration: 'shadow')

testCompile project(':grpc-testing'),
guavaDependency 'implementation'
testImplementation project(':grpc-testing'),
project(':grpc-testing-proto'),
libraries.guava,
libraries.guava_testlib,
libraries.junit,
libraries.mockito,
libraries.truth
testRuntime libraries.netty_tcnative,
libraries.netty_epoll
testRuntimeOnly libraries.netty_epoll,
dapengzhang0 marked this conversation as resolved.
Show resolved Hide resolved
libraries.netty_tcnative

shadow configurations.implementation.getDependencies().minus(nettyDependency),
project(path: ':grpc-netty-shaded', configuration: 'shadow')

signature 'org.codehaus.mojo.signature:java17:1.0@signature'
}

Expand Down
2 changes: 1 addition & 1 deletion android-interop-testing/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,10 @@ dependencies {
project(':grpc-testing'),
libraries.junit,
libraries.truth

implementation (libraries.google_auth_oauth2_http) {
exclude group: 'org.apache.httpcomponents'
}
censusGrpcMetricDependency 'implementation'

compileOnly libraries.javax_annotation

Expand Down
14 changes: 7 additions & 7 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@ repositories {
}

dependencies {
implementation project(':grpc-core')

testImplementation project('::grpc-okhttp')
testImplementation libraries.androidx_test
testImplementation libraries.junit
testImplementation libraries.robolectric
testImplementation libraries.truth
api project(':grpc-core')
guavaDependency 'implementation'
testImplementation project('::grpc-okhttp'),
libraries.androidx_test,
libraries.junit,
libraries.robolectric,
libraries.truth
}

task javadocs(type: Javadoc) {
Expand Down
20 changes: 6 additions & 14 deletions api/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
id "java"
id "java-library"
id "maven-publish"

id "me.champeau.gradle.jmh"
Expand All @@ -11,20 +11,12 @@ description = 'gRPC: API'
evaluationDependsOn(project(':grpc-context').path)

dependencies {
compile project(':grpc-context'),
libraries.errorprone,
libraries.jsr305,
libraries.animalsniffer_annotations
compile (libraries.guava) {
// prefer our own versions from libraries instead of Guava's dependency
exclude group: 'com.google.errorprone', module: 'error_prone_annotations'
exclude group: 'com.google.code.findbugs', module: 'jsr305'
exclude group: 'org.codehaus.mojo', module: 'animal-sniffer-annotations'
}

testCompile project(':grpc-context').sourceSets.test.output,
project(':grpc-testing'),
api project(':grpc-context'),
libraries.jsr305
guavaDependency 'implementation'
testImplementation project(':grpc-context').sourceSets.test.output,
project(':grpc-grpclb'),
project(':grpc-testing'),
libraries.guava_testlib

jmh project(':grpc-core')
Expand Down
8 changes: 5 additions & 3 deletions auth/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
id "java"
id "java-library"
id "maven-publish"

id "me.champeau.gradle.japicmp"
Expand All @@ -8,10 +8,12 @@ plugins {

description = "gRPC: Auth"
dependencies {
compile project(':grpc-api'),
api project(':grpc-api'),
libraries.google_auth_credentials
testCompile project(':grpc-testing'),
guavaDependency 'implementation'
testImplementation project(':grpc-testing'),
libraries.google_auth_oauth2_http

signature "org.codehaus.mojo.signature:java17:1.0@signature"
signature "net.sf.androidscents.signature:android-api-level-14:4.0_r4@signature"
}
14 changes: 7 additions & 7 deletions benchmarks/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,20 @@ configurations {
}

dependencies {
compile project(':grpc-core'),
alpnagent libraries.jetty_alpn_agent

compileOnly libraries.javax_annotation
implementation project(':grpc-core'),
project(':grpc-netty'),
project(':grpc-okhttp'),
project(':grpc-stub'),
project(':grpc-protobuf'),
project(':grpc-testing'),
libraries.hdrhistogram,
libraries.netty_tcnative,
libraries.math,
libraries.netty_epoll,
libraries.math
compileOnly libraries.javax_annotation
alpnagent libraries.jetty_alpn_agent

testCompile libraries.junit,
libraries.netty_tcnative
testImplementation libraries.junit,
libraries.mockito
}

Expand Down
74 changes: 67 additions & 7 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ subprojects {
}
}

def isAndroid = project.name in [
'grpc-android', 'grpc-android-interop-testing', 'grpc-cronet']

ext {
def exeSuffix = osdetector.os == 'windows' ? ".exe" : ""
protocPluginBaseName = 'protoc-gen-grpc-java'
Expand All @@ -54,7 +57,6 @@ subprojects {
opencensusVersion = '0.24.0'

configureProtoCompilation = {
boolean isAndroid = project.getName().contains('android')
String generatedSourcePath = "${projectDir}/src/generated"
project.protobuf {
protoc {
Expand Down Expand Up @@ -185,18 +187,76 @@ subprojects {
// Jetty ALPN dependencies
jetty_alpn_agent: 'org.mortbay.jetty.alpn:jetty-alpn-agent:2.0.9'
]

// A util function to config guava dependency with the given configuration
dapengzhang0 marked this conversation as resolved.
Show resolved Hide resolved
// name. We exclude some of its transitive dependencies and manually
// add them with a specific version.
guavaDependency = { configurationName ->
dependencies."$configurationName"(libraries.guava) {
exclude group: 'com.google.code.findbugs', module: 'jsr305'
exclude group: 'com.google.errorprone', module: 'error_prone_annotations'
exclude group: 'org.codehaus.mojo', module: 'animal-sniffer-annotations'
}
dependencies."$configurationName" libraries.errorprone
dependencies.runtimeOnly libraries.animalsniffer_annotations
dependencies.runtimeOnly libraries.jsr305
}

// A util function to config opencensus_api dependency with the given
// configuration name. We exclude some of its transitive dependencies
// and manually add them with a specific version.
censusApiDependency = { configurationName ->
dependencies."$configurationName"(libraries.opencensus_api) {
exclude group: 'com.google.code.findbugs', module: 'jsr305'
exclude group: 'com.google.guava', module: 'guava'
// we'll always be more up-to-date
exclude group: 'io.grpc', module: 'grpc-context'
}
dependencies.runtimeOnly project(':grpc-context')
dependencies.runtimeOnly libraries.jsr305
guavaDependency 'runtimeOnly'
}

// A util function to config opencensus_contrib_grpc_metrics dependency
// with the given configuration name. We exclude some of its transitive
// dependencies and manually add them with a specific version.
censusGrpcMetricDependency = { configurationName ->
dependencies."$configurationName"(libraries.opencensus_contrib_grpc_metrics) {
exclude group: 'com.google.code.findbugs', module: 'jsr305'
exclude group: 'com.google.guava', module: 'guava'
// we'll always be more up-to-date
exclude group: 'io.grpc', module: 'grpc-context'
}
dependencies.runtimeOnly project(':grpc-context')
dependencies.runtimeOnly libraries.jsr305
guavaDependency 'runtimeOnly'
}

// A util function to config perfmark dependency with the given configuration
// name. We exclude some of its transitive dependencies and manually
// add them with a specific version.
perfmarkDependency = { configurationName ->
dependencies."$configurationName"(libraries.perfmark) {
exclude group: 'com.google.errorprone', module: 'error_prone_annotations'
}
dependencies.runtimeOnly libraries.errorprone
}
}

// Define a separate configuration for managing the dependency on Jetty ALPN agent.
configurations {
compile {
// Detect Maven Enforcer's dependencyConvergence failures. We only
// care for artifacts used as libraries by others.
if (!(project.name in [
// Detect Maven Enforcer's dependencyConvergence failures. We only
// care for artifacts used as libraries by others.
if (isAndroid && !(project.name in ['grpc-android-interop-testing'])) {
releaseRuntimeClasspath {
resolutionStrategy.failOnVersionConflict()
}
}
if (!isAndroid && !(project.name in [
'grpc-benchmarks',
'grpc-interop-testing',
'grpc-gae-interop-testing-jdk8',
])) {
])) {
runtimeClasspath {
resolutionStrategy.failOnVersionConflict()
}
}
Expand Down
28 changes: 6 additions & 22 deletions census/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
id "java"
id "java-library"
id "maven-publish"
}

Expand All @@ -8,27 +8,11 @@ description = 'gRPC: Census'
evaluationDependsOn(project(':grpc-api').path)

dependencies {
compile project(':grpc-api')

compile (libraries.opencensus_api) {
// prefer 3.0.2 from libraries instead of 3.0.1
exclude group: 'com.google.code.findbugs', module: 'jsr305'
// prefer 20.0 from libraries instead of 19.0
exclude group: 'com.google.guava', module: 'guava'
// we'll always be more up-to-date
exclude group: 'io.grpc', module: 'grpc-context'
}

compile (libraries.opencensus_contrib_grpc_metrics) {
// prefer 3.0.2 from libraries instead of 3.0.1
exclude group: 'com.google.code.findbugs', module: 'jsr305'
// we'll always be more up-to-date
exclude group: 'io.grpc', module: 'grpc-context'
// prefer 20.0 from libraries instead of 19.0
exclude group: 'com.google.guava', module: 'guava'
}

testCompile project(':grpc-api').sourceSets.test.output,
api project(':grpc-api')
censusApiDependency 'implementation'
censusGrpcMetricDependency 'implementation'
guavaDependency 'implementation'
testImplementation project(':grpc-api').sourceSets.test.output,
project(':grpc-context').sourceSets.test.output,
project(':grpc-core').sourceSets.test.output,
project(':grpc-testing'),
Expand Down
6 changes: 3 additions & 3 deletions compiler/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -126,14 +126,14 @@ model {
}

configurations {
testLiteCompile
testLiteImplementation
}

dependencies {
testCompile project(':grpc-protobuf'),
testImplementation project(':grpc-protobuf'),
project(':grpc-stub'),
libraries.javax_annotation
testLiteCompile project(':grpc-protobuf-lite'),
testLiteImplementation project(':grpc-protobuf-lite'),
project(':grpc-stub'),
libraries.javax_annotation
}
Expand Down
4 changes: 3 additions & 1 deletion context/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ plugins {
description = 'gRPC: Context'

dependencies {
testCompile libraries.jsr305, libraries.guava_testlib
testImplementation libraries.guava_testlib,
libraries.jsr305

signature "org.codehaus.mojo.signature:java17:1.0@signature"
signature "net.sf.androidscents.signature:android-api-level-14:4.0_r4@signature"
}
23 changes: 10 additions & 13 deletions core/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
id "java"
id "java-library"
id "maven-publish"

id "me.champeau.gradle.japicmp"
Expand All @@ -13,20 +13,17 @@ evaluationDependsOn(project(':grpc-context').path)
evaluationDependsOn(project(':grpc-api').path)

dependencies {
compile project(':grpc-api'),
libraries.gson,
libraries.android_annotations,
libraries.errorprone // prefer our version to perfmark's 2.3.3
compile (libraries.perfmark) {
exclude group: 'com.google.errorprone', module: 'error_prone_annotations'
}

testCompile project(':grpc-context').sourceSets.test.output,
project(':grpc-api').sourceSets.test.output,
project(':grpc-testing'),
api project(':grpc-api')
implementation libraries.android_annotations,
libraries.animalsniffer_annotations,
libraries.gson
guavaDependency 'implementation'
perfmarkDependency 'implementation'
testImplementation project(':grpc-api').sourceSets.test.output,
project(':grpc-context').sourceSets.test.output,
project(':grpc-grpclb'),
project(':grpc-testing'),
libraries.guava_testlib

testRuntimeOnly project(':grpc-census')

jmh project(':grpc-testing')
Expand Down
Loading