-
Notifications
You must be signed in to change notification settings - Fork 3.9k
core, inprocess, util: move inprocess and util code into their own new artifacts grpc-inprocess and grpc-util #10362
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
Conversation
…w artifacts grpc-inprocess and grpc-util
Thanks @larry-safran . Now waiting for @ejona86 's LGTM.... |
Gentle ping @ejona86 - waiting for your LGTM |
java_library( | ||
name = "internal", | ||
visibility = ["//visibility:public"], |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
@@ -1,3 +1 @@ | |||
io.grpc.internal.PickFirstLoadBalancerProvider | |||
io.grpc.util.SecretRoundRobinLoadBalancerProvider$Provider |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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 (*)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This has been resolved
There was a problem hiding this comment.
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()
There was a problem hiding this comment.
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.
@@ -4,33 +4,16 @@ java_library( | |||
exports = ["//api"], | |||
) | |||
|
|||
java_library( | |||
name = "inprocess", |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
inprocess/build.gradle
Outdated
components.java.withVariantsFromConfiguration(configurations.testFixturesRuntimeElements) { skip() } | ||
|
||
|
||
tasks.register("versionFile") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Keep this in core. It is not needed in inprocess and util.
inprocess/build.gradle
Outdated
exclude 'io/grpc/inprocess/Internal*' | ||
} | ||
|
||
animalsniffer { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Delete. There's no jmh.
inprocess/build.gradle
Outdated
testFixtures(project(':grpc-core')) | ||
testImplementation libraries.guava.testlib | ||
|
||
testRuntimeOnly project(':grpc-census') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Delete.
repositories.bzl
Outdated
@@ -79,6 +79,8 @@ 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-inprocess": "@io_grpc_grpc_java//inprocess", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sort these.
rls/build.gradle
Outdated
@@ -9,8 +9,8 @@ plugins { | |||
description = "gRPC: RouteLookupService Loadbalancing plugin" | |||
|
|||
dependencies { | |||
implementation project(':grpc-core'), | |||
project(':grpc-protobuf'), | |||
api project(':grpc-util') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be an implementation dependency.
util/BUILD.bazel
Outdated
# with maven_install's override_targets. Should only be used as a dep for | ||
# pre-compiled binaries on Maven Central. | ||
java_library( | ||
name = "util_maven", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's no need to export //api from here, so delete the entire target. If it were needed, it should have been used from repositories.bzl
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Delete this file and use src/main/resources instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Most of my earlier comments apply to util/build.gradle
as well.
grpclb/build.gradle
Outdated
@@ -10,7 +10,7 @@ plugins { | |||
description = "gRPC: GRPCLB LoadBalancer plugin" | |||
|
|||
dependencies { | |||
implementation project(':grpc-core'), | |||
implementation project(':grpc-inprocess'), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why was it changed to depend on inprocess?
util/build.gradle
Outdated
dependencies { | ||
api project(':grpc-core') | ||
|
||
implementation libraries.gson, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why depend on gson?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Without it the build of grpc-services fails:
* What went wrong:
Execution failed for task ':grpc-services:checkUpperBoundDeps'.
> Maven version skew: com.google.code.gson:gson (2.8.9 != 2.10.1) Bad version dependency path: [project ':grpc-services', com.google.protobuf:protobuf-java-util:3.22.3] Run './gradlew :grpc-services:dependencies --configuration runtimeClasspath' to diagnose
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And then running ./gradlew :grpc-services:dependencies --configuration runtimeClasspath
(as suggested) gives me:
runtimeClasspath - Runtime classpath of source set 'main'.
...
+--- project :grpc-util
| +--- project :grpc-core
| | +--- project :grpc-api (*)
| | +--- com.google.code.gson:gson:2.10.1 ===> v2.10.1 referenced
| | +--- com.google.android:annotations:4.1.1.4
| | +--- org.codehaus.mojo:animal-sniffer-annotations:1.23
| | +--- com.google.errorprone:error_prone_annotations:2.18.0
| | +--- com.google.guava:guava:32.0.1-android -> 32.0.1-jre (*)
| | +--- io.perfmark:perfmark-api:0.26.0
| | +--- project :grpc-context
| | | \--- project :grpc-api (*)
| | \--- project :grpc-util (*)
| +--- org.codehaus.mojo:animal-sniffer-annotations:1.23
| \--- com.google.guava:guava:32.0.1-android -> 32.0.1-jre (*)
+--- com.google.protobuf:protobuf-java-util:3.22.3
| +--- com.google.protobuf:protobuf-java:3.22.3
| +--- com.google.code.findbugs:jsr305:3.0.2
| +--- com.google.code.gson:gson:2.8.9 -> 2.10.1 ===> v2.8.9 referenced
| +--- com.google.errorprone:error_prone_annotations:2.11.0 -> 2.18.0
| +--- com.google.guava:guava:31.1-jre -> 32.0.1-jre (*)
| \--- com.google.j2objc:j2objc-annotations:1.3 -> 2.8
...
I can also fix it by making libraries.gson
a runtimeOnly dependency of grpc-util
and then add a comment describing why it is required?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can also fix it by making libraries.gson a runtimeOnly dependency of grpc-util and then add a comment describing why it is required?
Yes. Do that for forced upgrading to fix version skew.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Already done with a comment
core/build.gradle
Outdated
@@ -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") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Include a comment that we depend on grpc-util to pull in RR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
"//api", | ||
"//inprocess", |
There was a problem hiding this comment.
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)
|
||
implementation libraries.animalsniffer.annotations, | ||
libraries.guava | ||
runtimeOnly libraries.gson // to fix checkUpperBoundDeps error in services |
There was a problem hiding this comment.
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.
grpc-core does not contain the inprocess classes anymore, they were moved out to io.grpc:grpc-inprocess so we need to add it as a dependency. See https://github.com/grpc/grpc-java/releases/tag/v1.58.0 See grpc/grpc-java#10362 Closes gh-4063
CC @ejona86