mirror of https://github.com/grpc/grpc-java.git
context, all: move Context classes to grpc-api (#10313)
* context, all: move Context classes to grpc-api clean up grpc-context since it has no source code: only add dep on grpc-api add exclusion for all transitive deps of grpc-api - only guava exclude grpc-context as a dependency from grpc-alts because all context code is in grpc-api now api: 1.7 as target Java version for Context source-set of grpc-api * core, census: fix the issues with android project pulling in old grpc-context version * api,context: make changes to bazel build files to account for context code moving from context to api
This commit is contained in:
parent
d654707838
commit
4d2c3aac0e
|
@ -2,6 +2,7 @@ java_library(
|
||||||
name = "api",
|
name = "api",
|
||||||
srcs = glob([
|
srcs = glob([
|
||||||
"src/main/java/**/*.java",
|
"src/main/java/**/*.java",
|
||||||
|
"src/context/java/**/*.java",
|
||||||
]),
|
]),
|
||||||
javacopts = ["-Xep:DoNotCall:OFF"], # Remove once requiring Bazel 3.4.0+; allows non-final
|
javacopts = ["-Xep:DoNotCall:OFF"], # Remove once requiring Bazel 3.4.0+; allows non-final
|
||||||
visibility = ["//visibility:public"],
|
visibility = ["//visibility:public"],
|
||||||
|
@ -13,4 +14,5 @@ java_library(
|
||||||
"@com_google_guava_guava//jar",
|
"@com_google_guava_guava//jar",
|
||||||
"@com_google_j2objc_j2objc_annotations//jar",
|
"@com_google_j2objc_j2objc_annotations//jar",
|
||||||
],
|
],
|
||||||
|
exports = ["//context"],
|
||||||
)
|
)
|
||||||
|
|
|
@ -9,17 +9,31 @@ plugins {
|
||||||
|
|
||||||
description = 'gRPC: API'
|
description = 'gRPC: API'
|
||||||
|
|
||||||
|
sourceSets {
|
||||||
|
context
|
||||||
|
main {
|
||||||
|
output.classesDirs.from(sourceSets.context.output.classesDirs)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
compileContextJava {
|
||||||
|
sourceCompatibility = 1.7
|
||||||
|
targetCompatibility = 1.7
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
api project(':grpc-context'),
|
compileOnly sourceSets.context.output
|
||||||
libraries.jsr305,
|
api libraries.jsr305,
|
||||||
libraries.errorprone.annotations
|
libraries.errorprone.annotations
|
||||||
implementation libraries.guava
|
implementation libraries.guava
|
||||||
|
|
||||||
|
testFixturesApi libraries.truth
|
||||||
|
testFixturesImplementation libraries.jsr305
|
||||||
testFixturesImplementation libraries.guava,
|
testFixturesImplementation libraries.guava,
|
||||||
libraries.junit,
|
libraries.junit,
|
||||||
libraries.mockito.core
|
libraries.mockito.core
|
||||||
testImplementation testFixtures(project(':grpc-context')),
|
testImplementation project(':grpc-testing'),
|
||||||
project(':grpc-testing'),
|
|
||||||
project(':grpc-grpclb')
|
project(':grpc-grpclb')
|
||||||
testImplementation libraries.guava.testlib
|
testImplementation libraries.guava.testlib
|
||||||
jmh project(':grpc-core')
|
jmh project(':grpc-core')
|
||||||
|
@ -29,9 +43,14 @@ dependencies {
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.named("javadoc").configure {
|
tasks.named("javadoc").configure {
|
||||||
|
source sourceSets.context.allSource
|
||||||
// We want io.grpc.Internal, but not io.grpc.Internal*
|
// We want io.grpc.Internal, but not io.grpc.Internal*
|
||||||
exclude 'io/grpc/Internal?*.java'
|
exclude 'io/grpc/Internal?*.java'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tasks.named("sourcesJar").configure {
|
||||||
|
from sourceSets.context.allSource
|
||||||
|
}
|
||||||
|
|
||||||
components.java.withVariantsFromConfiguration(configurations.testFixturesApiElements) { skip() }
|
components.java.withVariantsFromConfiguration(configurations.testFixturesApiElements) { skip() }
|
||||||
components.java.withVariantsFromConfiguration(configurations.testFixturesRuntimeElements) { skip() }
|
components.java.withVariantsFromConfiguration(configurations.testFixturesRuntimeElements) { skip() }
|
||||||
|
|
|
@ -9,12 +9,13 @@ description = 'gRPC: Census'
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
api project(':grpc-api')
|
api project(':grpc-api')
|
||||||
|
// force dependent jars to depend on latest grpc-context
|
||||||
|
runtimeOnly project(":grpc-context")
|
||||||
implementation libraries.guava,
|
implementation libraries.guava,
|
||||||
libraries.opencensus.api,
|
libraries.opencensus.api,
|
||||||
libraries.opencensus.contrib.grpc.metrics
|
libraries.opencensus.contrib.grpc.metrics
|
||||||
|
|
||||||
testImplementation testFixtures(project(':grpc-api')),
|
testImplementation testFixtures(project(':grpc-api')),
|
||||||
testFixtures(project(':grpc-context')),
|
|
||||||
testFixtures(project(':grpc-core')),
|
testFixtures(project(':grpc-core')),
|
||||||
project(':grpc-testing'),
|
project(':grpc-testing'),
|
||||||
libraries.opencensus.impl
|
libraries.opencensus.impl
|
||||||
|
|
|
@ -1,7 +1,4 @@
|
||||||
java_library(
|
java_library(
|
||||||
name = "context",
|
name = "context",
|
||||||
srcs = glob([
|
|
||||||
"src/main/java/**/*.java",
|
|
||||||
]),
|
|
||||||
visibility = ["//visibility:public"],
|
visibility = ["//visibility:public"],
|
||||||
)
|
)
|
||||||
|
|
|
@ -1,31 +1,14 @@
|
||||||
plugins {
|
plugins {
|
||||||
id "java"
|
id "java-library"
|
||||||
id "java-test-fixtures"
|
|
||||||
id "maven-publish"
|
id "maven-publish"
|
||||||
|
|
||||||
id "me.champeau.gradle.japicmp"
|
|
||||||
id "me.champeau.jmh"
|
|
||||||
id "ru.vyarus.animalsniffer"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
description = 'gRPC: Context'
|
description = 'gRPC: Context'
|
||||||
|
|
||||||
sourceCompatibility = 1.7
|
|
||||||
targetCompatibility = 1.7
|
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
testFixturesApi libraries.truth
|
runtimeOnly (project(":grpc-api")) {
|
||||||
// Explicitly choose the guava version to stay Java 7-compatible.
|
exclude group: "com.google.guava", module: "guava"
|
||||||
testFixturesImplementation 'com.google.guava:guava:30.1.1-android'
|
exclude group: "com.google.code.findbugs", module: "jsr305"
|
||||||
testFixturesImplementation libraries.jsr305
|
exclude group: "com.google.errorprone", module: "error_prone_annotations"
|
||||||
testImplementation libraries.jsr305
|
}
|
||||||
// Explicitly choose the guava version to stay Java 7-compatible. The rest of gRPC can move
|
|
||||||
// forward to Java 8-requiring versions. This is also only used for testing, so is unlikely to
|
|
||||||
// cause problems.
|
|
||||||
testImplementation 'com.google.guava:guava-testlib:30.1.1-android'
|
|
||||||
signature "org.codehaus.mojo.signature:java17:1.0@signature"
|
|
||||||
signature "net.sf.androidscents.signature:android-api-level-14:4.0_r4@signature"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
components.java.withVariantsFromConfiguration(configurations.testFixturesApiElements) { skip() }
|
|
||||||
components.java.withVariantsFromConfiguration(configurations.testFixturesRuntimeElements) { skip() }
|
|
||||||
|
|
|
@ -22,6 +22,8 @@ description = 'gRPC: Core'
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
api project(':grpc-api')
|
api project(':grpc-api')
|
||||||
|
// force dependent jars to depend on latest grpc-context
|
||||||
|
runtimeOnly project(":grpc-context")
|
||||||
implementation libraries.gson,
|
implementation libraries.gson,
|
||||||
libraries.android.annotations,
|
libraries.android.annotations,
|
||||||
libraries.animalsniffer.annotations,
|
libraries.animalsniffer.annotations,
|
||||||
|
@ -33,8 +35,7 @@ dependencies {
|
||||||
libraries.mockito.core,
|
libraries.mockito.core,
|
||||||
libraries.truth,
|
libraries.truth,
|
||||||
project(':grpc-testing')
|
project(':grpc-testing')
|
||||||
testImplementation testFixtures(project(':grpc-context')),
|
testImplementation testFixtures(project(':grpc-api')),
|
||||||
testFixtures(project(':grpc-api')),
|
|
||||||
project(':grpc-testing'),
|
project(':grpc-testing'),
|
||||||
project(':grpc-grpclb')
|
project(':grpc-grpclb')
|
||||||
testImplementation libraries.guava.testlib
|
testImplementation libraries.guava.testlib
|
||||||
|
|
|
@ -63,7 +63,7 @@ dependencies {
|
||||||
libraries.checker.qual, // Explicit dependency to keep in step with version used by guava
|
libraries.checker.qual, // Explicit dependency to keep in step with version used by guava
|
||||||
libraries.j2objc.annotations // Explicit dependency to keep in step with version used by guava
|
libraries.j2objc.annotations // Explicit dependency to keep in step with version used by guava
|
||||||
|
|
||||||
testImplementation testFixtures(project(':grpc-context')),
|
testImplementation testFixtures(project(':grpc-api')),
|
||||||
project(':grpc-testing'),
|
project(':grpc-testing'),
|
||||||
project(':grpc-testing-proto')
|
project(':grpc-testing-proto')
|
||||||
testImplementation (libraries.guava.testlib) {
|
testImplementation (libraries.guava.testlib) {
|
||||||
|
|
|
@ -45,8 +45,7 @@ dependencies {
|
||||||
libraries.netty.tcnative.classes,
|
libraries.netty.tcnative.classes,
|
||||||
project(':grpc-grpclb'),
|
project(':grpc-grpclb'),
|
||||||
project(':grpc-rls')
|
project(':grpc-rls')
|
||||||
testImplementation testFixtures(project(':grpc-context')),
|
testImplementation testFixtures(project(':grpc-api')),
|
||||||
testFixtures(project(':grpc-api')),
|
|
||||||
testFixtures(project(':grpc-core')),
|
testFixtures(project(':grpc-core')),
|
||||||
libraries.mockito.core,
|
libraries.mockito.core,
|
||||||
libraries.okhttp
|
libraries.okhttp
|
||||||
|
|
|
@ -26,8 +26,7 @@ dependencies {
|
||||||
|
|
||||||
runtimeOnly libraries.netty.tcnative,
|
runtimeOnly libraries.netty.tcnative,
|
||||||
libraries.netty.tcnative.classes
|
libraries.netty.tcnative.classes
|
||||||
testImplementation testFixtures(project(':grpc-context')),
|
testImplementation testFixtures(project(':grpc-api')),
|
||||||
testFixtures(project(':grpc-api')),
|
|
||||||
testFixtures(project(':grpc-core')),
|
testFixtures(project(':grpc-core')),
|
||||||
libraries.mockito.core,
|
libraries.mockito.core,
|
||||||
libraries.junit,
|
libraries.junit,
|
||||||
|
|
|
@ -14,7 +14,7 @@ dependencies {
|
||||||
libraries.junit
|
libraries.junit
|
||||||
// Only io.grpc.internal.testing.StatsTestUtils depends on opencensus_api, for internal use.
|
// Only io.grpc.internal.testing.StatsTestUtils depends on opencensus_api, for internal use.
|
||||||
compileOnly libraries.opencensus.api
|
compileOnly libraries.opencensus.api
|
||||||
runtimeOnly project(":grpc-context") // Pull in newer version than census-api
|
runtimeOnly project(":grpc-api") // Pull in newer version than census-api
|
||||||
|
|
||||||
testImplementation libraries.mockito.core
|
testImplementation libraries.mockito.core
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue