core, inprocess, util: move inprocess and util code into their own new artifacts grpc-inprocess and grpc-util#10362
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.
internal should not be public. Why did you need this? It was already allowing subpackages.
| @@ -1,3 +1 @@ | |||
| io.grpc.internal.PickFirstLoadBalancerProvider | |||
| io.grpc.util.SecretRoundRobinLoadBalancerProvider$Provider | |||
There was a problem hiding this comment.
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.
... 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.
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.
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.
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.
This has been resolved
There was a problem hiding this comment.
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.
@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.
| ) | ||
|
|
||
| java_library( | ||
| name = "inprocess", |
There was a problem hiding this comment.
Leave a forwarding library in place. Keep name and visibility and have it export //inprocess. Ditto for util.
inprocess/build.gradle
Outdated
| components.java.withVariantsFromConfiguration(configurations.testFixturesRuntimeElements) { skip() } | ||
|
|
||
|
|
||
| tasks.register("versionFile") { |
There was a problem hiding this comment.
Keep this in core. It is not needed in inprocess and util.
inprocess/build.gradle
Outdated
| exclude 'io/grpc/inprocess/Internal*' | ||
| } | ||
|
|
||
| animalsniffer { |
inprocess/build.gradle
Outdated
| testFixtures(project(':grpc-core')) | ||
| testImplementation libraries.guava.testlib | ||
|
|
||
| testRuntimeOnly project(':grpc-census') |
repositories.bzl
Outdated
| "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", |
rls/build.gradle
Outdated
| dependencies { | ||
| implementation project(':grpc-core'), | ||
| project(':grpc-protobuf'), | ||
| api project(':grpc-util') |
There was a problem hiding this comment.
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.
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.
Delete this file and use src/main/resources instead.
ejona86
left a comment
There was a problem hiding this comment.
Most of my earlier comments apply to util/build.gradle as well.
grpclb/build.gradle
Outdated
|
|
||
| dependencies { | ||
| implementation project(':grpc-core'), | ||
| implementation project(':grpc-inprocess'), |
There was a problem hiding this comment.
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.
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.
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.
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.
Already done with a comment
core/build.gradle
Outdated
| // 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.
Include a comment that we depend on grpc-util to pull in RR
| ":internal", | ||
| ":util", | ||
| "//api", | ||
| "//inprocess", |
There was a problem hiding this comment.
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.
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