-
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
Changes from 2 commits
743edeb
0abd922
ccd6a4b
0b30c31
50f9552
ab7a652
662884b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,33 +4,16 @@ java_library( | |
exports = ["//api"], | ||
) | ||
|
||
java_library( | ||
name = "inprocess", | ||
srcs = glob([ | ||
"src/main/java/io/grpc/inprocess/*.java", | ||
]), | ||
visibility = ["//visibility:public"], | ||
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", | ||
], | ||
) | ||
|
||
java_library( | ||
name = "internal", | ||
visibility = ["//visibility:public"], | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 commentThe reason will be displayed to describe this comment to others. Learn more. done |
||
srcs = glob([ | ||
"src/main/java/io/grpc/internal/*.java", | ||
]), | ||
javacopts = ["-Xep:DoNotCall:OFF"], # Remove once requiring Bazel 3.4.0+; allows non-final | ||
resources = glob([ | ||
"src/bazel-internal/resources/**", | ||
]), | ||
visibility = ["//:__subpackages__"], | ||
deps = [ | ||
"//api", | ||
"//context", | ||
|
@@ -45,35 +28,14 @@ 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", | ||
], | ||
) | ||
|
||
# Mirrors the dependencies included in the artifact on Maven Central for usage | ||
# with maven_install's override_targets. Should only be used as a dep for | ||
# pre-compiled binaries on Maven Central. | ||
java_library( | ||
name = "core_maven", | ||
visibility = ["//visibility:public"], | ||
exports = [ | ||
":inprocess", | ||
":internal", | ||
":util", | ||
"//api", | ||
], | ||
) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 commentThe 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 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
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 commentThe 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 commentThe 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 commentThe reason will be displayed to describe this comment to others. Learn more. Yes, I had tried it before I added the comment:
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 commentThe 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 commentThe 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 |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 commentThe reason will be displayed to describe this comment to others. Learn more. Why was it changed to depend on inprocess? |
||
project(':grpc-protobuf'), | ||
project(':grpc-stub'), | ||
libraries.protobuf.java, | ||
|
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", | ||
], | ||
) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
plugins { | ||
id "java-library" | ||
id "java-test-fixtures" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Delete. There are no test fixtures here. |
||
id "maven-publish" | ||
|
||
id "me.champeau.jmh" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Delete. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. deleted but not deleting for util (since util has jmh) |
||
id "ru.vyarus.animalsniffer" | ||
} | ||
|
||
import static java.nio.charset.StandardCharsets.US_ASCII; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Delete both imports. |
||
|
||
import com.google.common.primitives.Bytes; | ||
|
||
description = 'gRPC: Inprocess' | ||
|
||
dependencies { | ||
api project(':grpc-core') | ||
// force dependent jars to depend on latest grpc-context | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove this. It was only for core. |
||
runtimeOnly project(":grpc-context") | ||
implementation libraries.gson, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Delete all these deps except guava. |
||
libraries.android.annotations, | ||
libraries.animalsniffer.annotations, | ||
libraries.errorprone.annotations, | ||
libraries.guava, | ||
libraries.perfmark.api | ||
testFixturesApi libraries.junit | ||
testFixturesImplementation libraries.guava, | ||
libraries.mockito.core, | ||
libraries.truth, | ||
project(':grpc-testing') | ||
testImplementation testFixtures(project(':grpc-api')), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Delete grpc-api fixture |
||
project(':grpc-testing'), | ||
project(':grpc-grpclb'), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Delete. |
||
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 commentThe reason will be displayed to describe this comment to others. Learn more. Delete. |
||
|
||
jmh project(':grpc-testing') | ||
|
||
signature libraries.signature.java | ||
signature libraries.signature.android | ||
} | ||
|
||
tasks.named("javadoc").configure { | ||
exclude 'io/grpc/inprocess/Internal*' | ||
} | ||
|
||
animalsniffer { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Delete. There's no jmh. |
||
// Don't check sourceSets.jmh | ||
sourceSets = [ | ||
sourceSets.main, | ||
sourceSets.test | ||
] | ||
} | ||
|
||
components.java.withVariantsFromConfiguration(configurations.testFixturesApiElements) { skip() } | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Delete both lines |
||
components.java.withVariantsFromConfiguration(configurations.testFixturesRuntimeElements) { skip() } | ||
|
||
|
||
tasks.register("versionFile") { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Keep this in core. It is not needed in inprocess and util. |
||
doLast { | ||
new File(buildDir, "version").write("${project.version}\n") | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 commentThe reason will be displayed to describe this comment to others. Learn more. Sort these. |
||
"io.grpc:grpc-util": "@io_grpc_grpc_java//util", | ||
} | ||
|
||
def grpc_java_repositories(): | ||
|
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" | ||
|
@@ -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 commentThe reason will be displayed to describe this comment to others. Learn more. This should be an implementation dependency. |
||
implementation project(':grpc-protobuf'), | ||
project(':grpc-stub'), | ||
libraries.auto.value.annotations, | ||
libraries.guava | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
java_library( | ||
name = "util", | ||
srcs = glob([ | ||
"src/main/java/io/grpc/util/*.java", | ||
]), | ||
resources = glob([ | ||
"src/bazel-util/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", | ||
], | ||
) | ||
|
||
# Mirrors the dependencies included in the artifact on Maven Central for usage | ||
# 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 commentThe 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 |
||
visibility = ["//visibility:public"], | ||
exports = [ | ||
":util", | ||
"//api", | ||
], | ||
) |
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
andvisibility
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