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

context, all: move Context classes to grpc-api #10313

Merged
merged 5 commits into from
Jun 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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: 2 additions & 0 deletions api/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -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"],
Expand All @@ -13,4 +14,5 @@ java_library(
"@com_google_guava_guava//jar",
"@com_google_j2objc_j2objc_annotations//jar",
],
exports = ["//context"],
)
27 changes: 23 additions & 4 deletions api/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand All @@ -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() }
3 changes: 2 additions & 1 deletion census/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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")
sanjaypujare marked this conversation as resolved.
Show resolved Hide resolved
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
Expand Down
3 changes: 0 additions & 3 deletions context/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
java_library(
name = "context",
srcs = glob([
"src/main/java/**/*.java",
]),
visibility = ["//visibility:public"],
)
29 changes: 6 additions & 23 deletions context/build.gradle
Original file line number Diff line number Diff line change
@@ -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
sanjaypujare marked this conversation as resolved.
Show resolved Hide resolved
targetCompatibility = 1.7
ejona86 marked this conversation as resolved.
Show resolved Hide resolved

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"
ejona86 marked this conversation as resolved.
Show resolved Hide resolved
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() }
5 changes: 3 additions & 2 deletions core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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")
sanjaypujare marked this conversation as resolved.
Show resolved Hide resolved
implementation libraries.gson,
libraries.android.annotations,
libraries.animalsniffer.annotations,
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion gcp-observability/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
3 changes: 1 addition & 2 deletions interop-testing/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 1 addition & 2 deletions istio-interop-testing/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion testing/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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
ejona86 marked this conversation as resolved.
Show resolved Hide resolved
runtimeOnly project(":grpc-api") // Pull in newer version than census-api

testImplementation libraries.mockito.core

Expand Down