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",
|
||||
srcs = glob([
|
||||
"src/main/java/**/*.java",
|
||||
"src/context/java/**/*.java",
|
||||
]),
|
||||
javacopts = ["-Xep:DoNotCall:OFF"], # Remove once requiring Bazel 3.4.0+; allows non-final
|
||||
visibility = ["//visibility:public"],
|
||||
|
@ -13,4 +14,5 @@ java_library(
|
|||
"@com_google_guava_guava//jar",
|
||||
"@com_google_j2objc_j2objc_annotations//jar",
|
||||
],
|
||||
exports = ["//context"],
|
||||
)
|
||||
|
|
|
@ -9,17 +9,31 @@ plugins {
|
|||
|
||||
description = 'gRPC: API'
|
||||
|
||||
sourceSets {
|
||||
context
|
||||
main {
|
||||
output.classesDirs.from(sourceSets.context.output.classesDirs)
|
||||
}
|
||||
}
|
||||
|
||||
compileContextJava {
|
||||
sourceCompatibility = 1.7
|
||||
targetCompatibility = 1.7
|
||||
}
|
||||
|
||||
|
||||
dependencies {
|
||||
api project(':grpc-context'),
|
||||
libraries.jsr305,
|
||||
compileOnly sourceSets.context.output
|
||||
api libraries.jsr305,
|
||||
libraries.errorprone.annotations
|
||||
implementation libraries.guava
|
||||
|
||||
testFixturesApi libraries.truth
|
||||
testFixturesImplementation libraries.jsr305
|
||||
testFixturesImplementation libraries.guava,
|
||||
libraries.junit,
|
||||
libraries.mockito.core
|
||||
testImplementation testFixtures(project(':grpc-context')),
|
||||
project(':grpc-testing'),
|
||||
testImplementation project(':grpc-testing'),
|
||||
project(':grpc-grpclb')
|
||||
testImplementation libraries.guava.testlib
|
||||
jmh project(':grpc-core')
|
||||
|
@ -29,9 +43,14 @@ dependencies {
|
|||
}
|
||||
|
||||
tasks.named("javadoc").configure {
|
||||
source sourceSets.context.allSource
|
||||
// We want io.grpc.Internal, but not io.grpc.Internal*
|
||||
exclude 'io/grpc/Internal?*.java'
|
||||
}
|
||||
|
||||
tasks.named("sourcesJar").configure {
|
||||
from sourceSets.context.allSource
|
||||
}
|
||||
|
||||
components.java.withVariantsFromConfiguration(configurations.testFixturesApiElements) { skip() }
|
||||
components.java.withVariantsFromConfiguration(configurations.testFixturesRuntimeElements) { skip() }
|
||||
|
|
|
@ -9,12 +9,13 @@ description = 'gRPC: Census'
|
|||
|
||||
dependencies {
|
||||
api project(':grpc-api')
|
||||
// force dependent jars to depend on latest grpc-context
|
||||
runtimeOnly project(":grpc-context")
|
||||
implementation libraries.guava,
|
||||
libraries.opencensus.api,
|
||||
libraries.opencensus.contrib.grpc.metrics
|
||||
|
||||
testImplementation testFixtures(project(':grpc-api')),
|
||||
testFixtures(project(':grpc-context')),
|
||||
testFixtures(project(':grpc-core')),
|
||||
project(':grpc-testing'),
|
||||
libraries.opencensus.impl
|
||||
|
|
|
@ -1,7 +1,4 @@
|
|||
java_library(
|
||||
name = "context",
|
||||
srcs = glob([
|
||||
"src/main/java/**/*.java",
|
||||
]),
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
|
|
@ -1,31 +1,14 @@
|
|||
plugins {
|
||||
id "java"
|
||||
id "java-test-fixtures"
|
||||
id "java-library"
|
||||
id "maven-publish"
|
||||
|
||||
id "me.champeau.gradle.japicmp"
|
||||
id "me.champeau.jmh"
|
||||
id "ru.vyarus.animalsniffer"
|
||||
}
|
||||
|
||||
description = 'gRPC: Context'
|
||||
|
||||
sourceCompatibility = 1.7
|
||||
targetCompatibility = 1.7
|
||||
|
||||
dependencies {
|
||||
testFixturesApi libraries.truth
|
||||
// Explicitly choose the guava version to stay Java 7-compatible.
|
||||
testFixturesImplementation 'com.google.guava:guava:30.1.1-android'
|
||||
testFixturesImplementation libraries.jsr305
|
||||
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"
|
||||
runtimeOnly (project(":grpc-api")) {
|
||||
exclude group: "com.google.guava", module: "guava"
|
||||
exclude group: "com.google.code.findbugs", module: "jsr305"
|
||||
exclude group: "com.google.errorprone", module: "error_prone_annotations"
|
||||
}
|
||||
}
|
||||
|
||||
components.java.withVariantsFromConfiguration(configurations.testFixturesApiElements) { skip() }
|
||||
components.java.withVariantsFromConfiguration(configurations.testFixturesRuntimeElements) { skip() }
|
||||
|
|
|
@ -22,6 +22,8 @@ description = 'gRPC: Core'
|
|||
|
||||
dependencies {
|
||||
api project(':grpc-api')
|
||||
// force dependent jars to depend on latest grpc-context
|
||||
runtimeOnly project(":grpc-context")
|
||||
implementation libraries.gson,
|
||||
libraries.android.annotations,
|
||||
libraries.animalsniffer.annotations,
|
||||
|
@ -33,8 +35,7 @@ dependencies {
|
|||
libraries.mockito.core,
|
||||
libraries.truth,
|
||||
project(':grpc-testing')
|
||||
testImplementation testFixtures(project(':grpc-context')),
|
||||
testFixtures(project(':grpc-api')),
|
||||
testImplementation testFixtures(project(':grpc-api')),
|
||||
project(':grpc-testing'),
|
||||
project(':grpc-grpclb')
|
||||
testImplementation libraries.guava.testlib
|
||||
|
|
|
@ -63,7 +63,7 @@ dependencies {
|
|||
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
|
||||
|
||||
testImplementation testFixtures(project(':grpc-context')),
|
||||
testImplementation testFixtures(project(':grpc-api')),
|
||||
project(':grpc-testing'),
|
||||
project(':grpc-testing-proto')
|
||||
testImplementation (libraries.guava.testlib) {
|
||||
|
|
|
@ -45,8 +45,7 @@ dependencies {
|
|||
libraries.netty.tcnative.classes,
|
||||
project(':grpc-grpclb'),
|
||||
project(':grpc-rls')
|
||||
testImplementation testFixtures(project(':grpc-context')),
|
||||
testFixtures(project(':grpc-api')),
|
||||
testImplementation testFixtures(project(':grpc-api')),
|
||||
testFixtures(project(':grpc-core')),
|
||||
libraries.mockito.core,
|
||||
libraries.okhttp
|
||||
|
|
|
@ -26,8 +26,7 @@ dependencies {
|
|||
|
||||
runtimeOnly libraries.netty.tcnative,
|
||||
libraries.netty.tcnative.classes
|
||||
testImplementation testFixtures(project(':grpc-context')),
|
||||
testFixtures(project(':grpc-api')),
|
||||
testImplementation testFixtures(project(':grpc-api')),
|
||||
testFixtures(project(':grpc-core')),
|
||||
libraries.mockito.core,
|
||||
libraries.junit,
|
||||
|
|
|
@ -14,7 +14,7 @@ dependencies {
|
|||
libraries.junit
|
||||
// Only io.grpc.internal.testing.StatsTestUtils depends on opencensus_api, for internal use.
|
||||
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
|
||||
|
||||
|
|
Loading…
Reference in New Issue