Skip to content
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: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ subprojects {
requireUpperBoundDepsMatch(configurations.runtimeClasspath, project)
}
}
tasks.named('compileJava').configure {
tasks.named('assemble').configure {
dependsOn checkUpperBoundDeps
}
}
Expand Down
31 changes: 3 additions & 28 deletions core/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,8 @@ java_library(

java_library(
name = "inprocess",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Leave a forwarding library in place. Keep name and visibility and have it export //inprocess. Ditto for util.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

srcs = glob([
"src/main/java/io/grpc/inprocess/*.java",
]),
visibility = ["//visibility:public"],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

internal should not be public. Why did you need this? It was already allowing subpackages.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

deps = [
":internal",
"//api",
"//context",
"@com_google_code_findbugs_jsr305//jar",
"@com_google_errorprone_error_prone_annotations//jar",
"@com_google_guava_guava//jar",
"@com_google_j2objc_j2objc_annotations//jar",
],
exports = ["//inprocess"],
)

java_library(
Expand Down Expand Up @@ -47,21 +36,8 @@ java_library(

java_library(
name = "util",
srcs = glob([
"src/main/java/io/grpc/util/*.java",
]),
resources = glob([
"src/bazel-util/resources/**",
]),
visibility = ["//visibility:public"],
deps = [
":internal",
"//api",
"@com_google_code_findbugs_jsr305//jar",
"@com_google_guava_guava//jar",
"@com_google_j2objc_j2objc_annotations//jar",
"@org_codehaus_mojo_animal_sniffer_annotations//jar",
],
exports = ["//util"],
)

# Mirrors the dependencies included in the artifact on Maven Central for usage
Expand All @@ -71,9 +47,8 @@ java_library(
name = "core_maven",
visibility = ["//visibility:public"],
exports = [
":inprocess",
":internal",
":util",
"//api",
"//inprocess",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should have exported //util, not //inprocess (to mirror core/build.gradle)

],
)
3 changes: 2 additions & 1 deletion core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ description = 'gRPC: Core'
dependencies {
api project(':grpc-api')
// force dependent jars to depend on latest grpc-context
runtimeOnly project(":grpc-context")
runtimeOnly project(":grpc-context"),
project(":grpc-util") // need grpc-util to pull in round robin
implementation libraries.gson,
libraries.android.annotations,
libraries.animalsniffer.annotations,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
io.grpc.internal.PickFirstLoadBalancerProvider
io.grpc.util.SecretRoundRobinLoadBalancerProvider$Provider
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

RR moving to grpc-util could definitely break users in a hard-to-diagnose way. I'm not sure how we want to handle this. Short-term we could have a runtimeDependency in grpc-core onto grpc-util.

That would mean we'd also want //inprocess in core_maven

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

... Short-term we could have a runtimeDependency in grpc-core onto grpc-util.

Interesting. grpc-util has an api dependency on grpc-core so doing what you suggest makes the dependency circular (even with runtimeOnly dependency). Any ideas?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like this is a blocker and needs to be resolved. So I'll wait for that before I address the remaining comments.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was aware that would be the case. But it should work. Are you saying it doesn't work?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I had tried it before I added the comment:

* What went wrong:
Circular dependency between the following tasks:
:grpc-core:checkUpperBoundDeps
+--- :grpc-core:jar
|    +--- :grpc-core:classes
|    |    \--- :grpc-core:compileJava
|    |         \--- :grpc-core:checkUpperBoundDeps (*)
|    \--- :grpc-core:compileJava (*)
\--- :grpc-util:jar
     +--- :grpc-util:classes
     |    \--- :grpc-util:compileJava
     |         +--- :grpc-core:compileJava (*)
     |         \--- :grpc-util:checkUpperBoundDeps
     |              +--- :grpc-core:jar (*)
     |              \--- :grpc-util:jar (*)
     \--- :grpc-util:compileJava (*)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This has been resolved

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hi i just wanted to let you know that this did indeed break for us in a hard to diagnose way. Is there a correct way to upgrade this library so that it does not break? in general we use something like

ManagedChannelBuilder
            .forTarget(URL)
            .defaultLoadBalancingPolicy("round_robin")
            .usePlaintext()
            .build()

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mdering "break" is not a helpful description. Please open a new issue and describe the error/problem you see when upgrading. You can link to this PR. For this specific change, it's also important whether you are shading/shadowing/making a fat jar.

io.grpc.util.OutlierDetectionLoadBalancerProvider
2 changes: 1 addition & 1 deletion grpclb/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ java_library(
"//api",
"//context",
"//core:internal",
"//core:util",
"//util",
"//stub",
"@com_google_code_findbugs_jsr305//jar",
"@com_google_guava_guava//jar",
Expand Down
1 change: 1 addition & 0 deletions grpclb/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ dependencies {
runtimeOnly libraries.errorprone.annotations
compileOnly libraries.javax.annotation
testImplementation libraries.truth,
project(':grpc-inprocess'),
testFixtures(project(':grpc-core'))

signature libraries.signature.java
Expand Down
16 changes: 16 additions & 0 deletions inprocess/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
java_library(
name = "inprocess",
srcs = glob([
"src/main/java/io/grpc/inprocess/*.java",
]),
visibility = ["//visibility:public"],
deps = [
"//core:internal",
"//api",
"//context",
"@com_google_code_findbugs_jsr305//jar",
"@com_google_errorprone_error_prone_annotations//jar",
"@com_google_guava_guava//jar",
"@com_google_j2objc_j2objc_annotations//jar",
],
)
24 changes: 24 additions & 0 deletions inprocess/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
plugins {
id "java-library"
id "maven-publish"

id "ru.vyarus.animalsniffer"
}

description = 'gRPC: Inprocess'

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

implementation libraries.guava
testImplementation project(':grpc-testing'),
testFixtures(project(':grpc-core'))
testImplementation libraries.guava.testlib

signature libraries.signature.java
signature libraries.signature.android
}

tasks.named("javadoc").configure {
exclude 'io/grpc/inprocess/Internal*'
}
2 changes: 1 addition & 1 deletion okhttp/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ java_library(
deps = [
"//api",
"//core:internal",
"//core:util",
"//util",
"@com_google_code_findbugs_jsr305//jar",
"@com_google_errorprone_error_prone_annotations//jar",
"@com_google_guava_guava//jar",
Expand Down
2 changes: 1 addition & 1 deletion okhttp/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ plugins {
description = "gRPC: OkHttp"

dependencies {
api project(':grpc-core')
api project(':grpc-util')
implementation libraries.okio,
libraries.guava,
libraries.perfmark.api
Expand Down
2 changes: 2 additions & 0 deletions repositories.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ IO_GRPC_GRPC_JAVA_OVERRIDE_TARGETS = {
"io.grpc:grpc-core": "@io_grpc_grpc_java//core:core_maven",
"io.grpc:grpc-googleapis": "@io_grpc_grpc_java//googleapis",
"io.grpc:grpc-grpclb": "@io_grpc_grpc_java//grpclb",
"io.grpc:grpc-inprocess": "@io_grpc_grpc_java//inprocess",
"io.grpc:grpc-netty": "@io_grpc_grpc_java//netty",
"io.grpc:grpc-netty-shaded": "@io_grpc_grpc_java//netty:shaded_maven",
"io.grpc:grpc-okhttp": "@io_grpc_grpc_java//okhttp",
Expand All @@ -79,6 +80,7 @@ IO_GRPC_GRPC_JAVA_OVERRIDE_TARGETS = {
"io.grpc:grpc-stub": "@io_grpc_grpc_java//stub",
"io.grpc:grpc-testing": "@io_grpc_grpc_java//testing",
"io.grpc:grpc-xds": "@io_grpc_grpc_java//xds:xds_maven",
"io.grpc:grpc-util": "@io_grpc_grpc_java//util",
}

def grpc_java_repositories():
Expand Down
2 changes: 1 addition & 1 deletion rls/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ java_library(
"//api",
"//core",
"//core:internal",
"//core:util",
"//util",
"//stub",
"@com_google_auto_value_auto_value_annotations//jar",
"@com_google_code_findbugs_jsr305//jar",
Expand Down
4 changes: 2 additions & 2 deletions rls/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.google.protobuf"
id "jacoco"
Expand All @@ -9,7 +9,7 @@ plugins {
description = "gRPC: RouteLookupService Loadbalancing plugin"

dependencies {
implementation project(':grpc-core'),
implementation project(':grpc-util'),
project(':grpc-protobuf'),
project(':grpc-stub'),
libraries.auto.value.annotations,
Expand Down
2 changes: 1 addition & 1 deletion services/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ java_library(
":_health_java_grpc",
"//api",
"//core:internal",
"//core:util",
"//util",
"@com_google_code_findbugs_jsr305//jar",
"@com_google_guava_guava//jar",
"@io_grpc_grpc_proto//:health_java_proto",
Expand Down
2 changes: 1 addition & 1 deletion services/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ tasks.named("compileJava").configure {
dependencies {
api project(':grpc-protobuf'),
project(':grpc-stub'),
project(':grpc-core')
project(':grpc-util')
implementation libraries.protobuf.java.util,
libraries.guava.jre // JRE required by protobuf-java-util

Expand Down
3 changes: 2 additions & 1 deletion servlet/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ dependencies {
compileOnly 'javax.servlet:javax.servlet-api:4.0.1',
libraries.javax.annotation // java 9, 10 needs it

implementation project(':grpc-core'),
implementation project(':grpc-util'),
libraries.guava

testImplementation 'javax.servlet:javax.servlet-api:4.0.1',
Expand All @@ -43,6 +43,7 @@ dependencies {
itImplementation project(':grpc-servlet'),
project(':grpc-netty'),
project(':grpc-core').sourceSets.test.runtimeClasspath,
project(':grpc-util').sourceSets.test.runtimeClasspath,
libraries.junit
itImplementation(project(':grpc-interop-testing')) {
// Avoid grpc-netty-shaded dependency
Expand Down
3 changes: 2 additions & 1 deletion servlet/jakarta/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,13 @@ dependencies {
compileOnly 'jakarta.servlet:jakarta.servlet-api:5.0.0',
libraries.javax.annotation

implementation project(':grpc-core'),
implementation project(':grpc-util'),
libraries.guava

itImplementation project(':grpc-servlet-jakarta'),
project(':grpc-netty'),
project(':grpc-core').sourceSets.test.runtimeClasspath,
project(':grpc-util').sourceSets.test.runtimeClasspath,
libraries.junit
itImplementation(project(':grpc-interop-testing')) {
// Avoid grpc-netty-shaded dependency
Expand Down
4 changes: 4 additions & 0 deletions settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ include ":grpc-authz"
include ":grpc-gcp-observability"
include ":grpc-gcp-observability:interop"
include ":grpc-istio-interop-testing"
include ":grpc-inprocess"
include ":grpc-util"

project(':grpc-api').projectDir = "$rootDir/api" as File
project(':grpc-core').projectDir = "$rootDir/core" as File
Expand Down Expand Up @@ -91,6 +93,8 @@ project(':grpc-authz').projectDir = "$rootDir/authz" as File
project(':grpc-gcp-observability').projectDir = "$rootDir/gcp-observability" as File
project(':grpc-gcp-observability:interop').projectDir = "$rootDir/gcp-observability/interop" as File
project(':grpc-istio-interop-testing').projectDir = "$rootDir/istio-interop-testing" as File
project(':grpc-inprocess').projectDir = "$rootDir/inprocess" as File
project(':grpc-util').projectDir = "$rootDir/util" as File

if (settings.hasProperty('skipCodegen') && skipCodegen.toBoolean()) {
println '*** Skipping the build of codegen and compilation of proto files because skipCodegen=true'
Expand Down
4 changes: 2 additions & 2 deletions testing/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ java_library(
deps = [
"//api",
"//context",
"//core:inprocess",
"//core:util",
"//inprocess",
"//util",
"//stub",
"@com_google_code_findbugs_jsr305//jar",
"@com_google_guava_guava//jar",
Expand Down
3 changes: 2 additions & 1 deletion testing/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ plugins {
description = "gRPC: Testing"

dependencies {
api project(':grpc-core'),
api project(':grpc-inprocess'),
project(':grpc-util'),
project(':grpc-stub'),
libraries.junit
// Only io.grpc.internal.testing.StatsTestUtils depends on opencensus_api, for internal use.
Expand Down
18 changes: 18 additions & 0 deletions util/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
java_library(
name = "util",
srcs = glob([
"src/main/java/io/grpc/util/*.java",
]),
resources = glob([
"src/main/resources/**",
]),
visibility = ["//visibility:public"],
deps = [
"//api",
"//core:internal",
"@com_google_code_findbugs_jsr305//jar",
"@com_google_guava_guava//jar",
"@com_google_j2objc_j2objc_annotations//jar",
"@org_codehaus_mojo_animal_sniffer_annotations//jar",
],
)
34 changes: 34 additions & 0 deletions util/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
plugins {
id "java-library"
id "maven-publish"

id "me.champeau.jmh"
id "ru.vyarus.animalsniffer"
}

description = 'gRPC: Util'

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

implementation libraries.animalsniffer.annotations,
libraries.guava
runtimeOnly libraries.gson // to fix checkUpperBoundDeps error in services
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, this should go in services.

testImplementation testFixtures(project(':grpc-api')),
testFixtures(project(':grpc-core')),
project(':grpc-testing')
testImplementation libraries.guava.testlib

jmh project(':grpc-testing')

signature libraries.signature.java
signature libraries.signature.android
}

animalsniffer {
// Don't check sourceSets.jmh
sourceSets = [
sourceSets.main,
sourceSets.test
]
}
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
io.grpc.util.SecretRoundRobinLoadBalancerProvider$Provider
io.grpc.util.OutlierDetectionLoadBalancerProvider
4 changes: 2 additions & 2 deletions xds/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ java_library(
"//api",
"//context",
"//core:internal",
"//core:util",
"//util",
"//netty",
"//stub",
"//services:metrics",
Expand Down Expand Up @@ -145,7 +145,7 @@ java_library(
"//api",
"//context",
"//core:internal",
"//core:util",
"//util",
"//protobuf",
"//services:metrics",
"//services:metrics_internal",
Expand Down