core, inprocess, util: move inprocess and util code into their own new artifacts grpc-inprocess and grpc-util (#10362)

* core, inprocess, util: move inprocess and util code into their own new artifacts grpc-inprocess and grpc-util
This commit is contained in:
sanjaypujare 2023-07-17 11:45:31 -07:00 committed by GitHub
parent ac35ab67f2
commit 0f5f07f876
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
70 changed files with 124 additions and 47 deletions

View File

@ -271,7 +271,7 @@ subprojects {
requireUpperBoundDepsMatch(configurations.runtimeClasspath, project) requireUpperBoundDepsMatch(configurations.runtimeClasspath, project)
} }
} }
tasks.named('compileJava').configure { tasks.named('assemble').configure {
dependsOn checkUpperBoundDeps dependsOn checkUpperBoundDeps
} }
} }

View File

@ -6,19 +6,8 @@ java_library(
java_library( java_library(
name = "inprocess", name = "inprocess",
srcs = glob([
"src/main/java/io/grpc/inprocess/*.java",
]),
visibility = ["//visibility:public"], visibility = ["//visibility:public"],
deps = [ exports = ["//inprocess"],
":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( java_library(
@ -47,21 +36,8 @@ java_library(
java_library( java_library(
name = "util", name = "util",
srcs = glob([
"src/main/java/io/grpc/util/*.java",
]),
resources = glob([
"src/bazel-util/resources/**",
]),
visibility = ["//visibility:public"], visibility = ["//visibility:public"],
deps = [ exports = ["//util"],
":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 # Mirrors the dependencies included in the artifact on Maven Central for usage
@ -71,9 +47,8 @@ java_library(
name = "core_maven", name = "core_maven",
visibility = ["//visibility:public"], visibility = ["//visibility:public"],
exports = [ exports = [
":inprocess",
":internal", ":internal",
":util",
"//api", "//api",
"//inprocess",
], ],
) )

View File

@ -23,7 +23,8 @@ description = 'gRPC: Core'
dependencies { dependencies {
api project(':grpc-api') api project(':grpc-api')
// force dependent jars to depend on latest grpc-context // 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, implementation libraries.gson,
libraries.android.annotations, libraries.android.annotations,
libraries.animalsniffer.annotations, libraries.animalsniffer.annotations,

View File

@ -1,3 +1 @@
io.grpc.internal.PickFirstLoadBalancerProvider io.grpc.internal.PickFirstLoadBalancerProvider
io.grpc.util.SecretRoundRobinLoadBalancerProvider$Provider
io.grpc.util.OutlierDetectionLoadBalancerProvider

View File

@ -14,7 +14,7 @@ java_library(
"//api", "//api",
"//context", "//context",
"//core:internal", "//core:internal",
"//core:util", "//util",
"//stub", "//stub",
"@com_google_code_findbugs_jsr305//jar", "@com_google_code_findbugs_jsr305//jar",
"@com_google_guava_guava//jar", "@com_google_guava_guava//jar",

View File

@ -19,6 +19,7 @@ dependencies {
runtimeOnly libraries.errorprone.annotations runtimeOnly libraries.errorprone.annotations
compileOnly libraries.javax.annotation compileOnly libraries.javax.annotation
testImplementation libraries.truth, testImplementation libraries.truth,
project(':grpc-inprocess'),
testFixtures(project(':grpc-core')) testFixtures(project(':grpc-core'))
signature libraries.signature.java signature libraries.signature.java

16
inprocess/BUILD.bazel Normal file
View File

@ -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
inprocess/build.gradle Normal file
View File

@ -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*'
}

View File

@ -11,7 +11,7 @@ java_library(
deps = [ deps = [
"//api", "//api",
"//core:internal", "//core:internal",
"//core:util", "//util",
"@com_google_code_findbugs_jsr305//jar", "@com_google_code_findbugs_jsr305//jar",
"@com_google_errorprone_error_prone_annotations//jar", "@com_google_errorprone_error_prone_annotations//jar",
"@com_google_guava_guava//jar", "@com_google_guava_guava//jar",

View File

@ -9,7 +9,7 @@ plugins {
description = "gRPC: OkHttp" description = "gRPC: OkHttp"
dependencies { dependencies {
api project(':grpc-core') api project(':grpc-util')
implementation libraries.okio, implementation libraries.okio,
libraries.guava, libraries.guava,
libraries.perfmark.api libraries.perfmark.api

View File

@ -69,6 +69,7 @@ IO_GRPC_GRPC_JAVA_OVERRIDE_TARGETS = {
"io.grpc:grpc-core": "@io_grpc_grpc_java//core:core_maven", "io.grpc:grpc-core": "@io_grpc_grpc_java//core:core_maven",
"io.grpc:grpc-googleapis": "@io_grpc_grpc_java//googleapis", "io.grpc:grpc-googleapis": "@io_grpc_grpc_java//googleapis",
"io.grpc:grpc-grpclb": "@io_grpc_grpc_java//grpclb", "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": "@io_grpc_grpc_java//netty",
"io.grpc:grpc-netty-shaded": "@io_grpc_grpc_java//netty:shaded_maven", "io.grpc:grpc-netty-shaded": "@io_grpc_grpc_java//netty:shaded_maven",
"io.grpc:grpc-okhttp": "@io_grpc_grpc_java//okhttp", "io.grpc:grpc-okhttp": "@io_grpc_grpc_java//okhttp",
@ -79,6 +80,7 @@ IO_GRPC_GRPC_JAVA_OVERRIDE_TARGETS = {
"io.grpc:grpc-stub": "@io_grpc_grpc_java//stub", "io.grpc:grpc-stub": "@io_grpc_grpc_java//stub",
"io.grpc:grpc-testing": "@io_grpc_grpc_java//testing", "io.grpc:grpc-testing": "@io_grpc_grpc_java//testing",
"io.grpc:grpc-xds": "@io_grpc_grpc_java//xds:xds_maven", "io.grpc:grpc-xds": "@io_grpc_grpc_java//xds:xds_maven",
"io.grpc:grpc-util": "@io_grpc_grpc_java//util",
} }
def grpc_java_repositories(): def grpc_java_repositories():

View File

@ -12,7 +12,7 @@ java_library(
"//api", "//api",
"//core", "//core",
"//core:internal", "//core:internal",
"//core:util", "//util",
"//stub", "//stub",
"@com_google_auto_value_auto_value_annotations//jar", "@com_google_auto_value_auto_value_annotations//jar",
"@com_google_code_findbugs_jsr305//jar", "@com_google_code_findbugs_jsr305//jar",

View File

@ -1,5 +1,5 @@
plugins { plugins {
id "java" id "java-library"
id "maven-publish" id "maven-publish"
id "com.google.protobuf" id "com.google.protobuf"
id "jacoco" id "jacoco"
@ -9,7 +9,7 @@ plugins {
description = "gRPC: RouteLookupService Loadbalancing plugin" description = "gRPC: RouteLookupService Loadbalancing plugin"
dependencies { dependencies {
implementation project(':grpc-core'), implementation project(':grpc-util'),
project(':grpc-protobuf'), project(':grpc-protobuf'),
project(':grpc-stub'), project(':grpc-stub'),
libraries.auto.value.annotations, libraries.auto.value.annotations,

View File

@ -154,7 +154,7 @@ java_library(
":_health_java_grpc", ":_health_java_grpc",
"//api", "//api",
"//core:internal", "//core:internal",
"//core:util", "//util",
"@com_google_code_findbugs_jsr305//jar", "@com_google_code_findbugs_jsr305//jar",
"@com_google_guava_guava//jar", "@com_google_guava_guava//jar",
"@io_grpc_grpc_proto//:health_java_proto", "@io_grpc_grpc_proto//:health_java_proto",

View File

@ -19,7 +19,7 @@ tasks.named("compileJava").configure {
dependencies { dependencies {
api project(':grpc-protobuf'), api project(':grpc-protobuf'),
project(':grpc-stub'), project(':grpc-stub'),
project(':grpc-core') project(':grpc-util')
implementation libraries.protobuf.java.util, implementation libraries.protobuf.java.util,
libraries.guava.jre // JRE required by protobuf-java-util libraries.guava.jre // JRE required by protobuf-java-util

View File

@ -34,7 +34,7 @@ dependencies {
compileOnly 'javax.servlet:javax.servlet-api:4.0.1', compileOnly 'javax.servlet:javax.servlet-api:4.0.1',
libraries.javax.annotation // java 9, 10 needs it libraries.javax.annotation // java 9, 10 needs it
implementation project(':grpc-core'), implementation project(':grpc-util'),
libraries.guava libraries.guava
testImplementation 'javax.servlet:javax.servlet-api:4.0.1', testImplementation 'javax.servlet:javax.servlet-api:4.0.1',
@ -43,6 +43,7 @@ dependencies {
itImplementation project(':grpc-servlet'), itImplementation project(':grpc-servlet'),
project(':grpc-netty'), project(':grpc-netty'),
project(':grpc-core').sourceSets.test.runtimeClasspath, project(':grpc-core').sourceSets.test.runtimeClasspath,
project(':grpc-util').sourceSets.test.runtimeClasspath,
libraries.junit libraries.junit
itImplementation(project(':grpc-interop-testing')) { itImplementation(project(':grpc-interop-testing')) {
// Avoid grpc-netty-shaded dependency // Avoid grpc-netty-shaded dependency

View File

@ -74,12 +74,13 @@ dependencies {
compileOnly 'jakarta.servlet:jakarta.servlet-api:5.0.0', compileOnly 'jakarta.servlet:jakarta.servlet-api:5.0.0',
libraries.javax.annotation libraries.javax.annotation
implementation project(':grpc-core'), implementation project(':grpc-util'),
libraries.guava libraries.guava
itImplementation project(':grpc-servlet-jakarta'), itImplementation project(':grpc-servlet-jakarta'),
project(':grpc-netty'), project(':grpc-netty'),
project(':grpc-core').sourceSets.test.runtimeClasspath, project(':grpc-core').sourceSets.test.runtimeClasspath,
project(':grpc-util').sourceSets.test.runtimeClasspath,
libraries.junit libraries.junit
itImplementation(project(':grpc-interop-testing')) { itImplementation(project(':grpc-interop-testing')) {
// Avoid grpc-netty-shaded dependency // Avoid grpc-netty-shaded dependency

View File

@ -60,6 +60,8 @@ include ":grpc-authz"
include ":grpc-gcp-observability" include ":grpc-gcp-observability"
include ":grpc-gcp-observability:interop" include ":grpc-gcp-observability:interop"
include ":grpc-istio-interop-testing" include ":grpc-istio-interop-testing"
include ":grpc-inprocess"
include ":grpc-util"
project(':grpc-api').projectDir = "$rootDir/api" as File project(':grpc-api').projectDir = "$rootDir/api" as File
project(':grpc-core').projectDir = "$rootDir/core" as File project(':grpc-core').projectDir = "$rootDir/core" as File
@ -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').projectDir = "$rootDir/gcp-observability" as File
project(':grpc-gcp-observability:interop').projectDir = "$rootDir/gcp-observability/interop" 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-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()) { if (settings.hasProperty('skipCodegen') && skipCodegen.toBoolean()) {
println '*** Skipping the build of codegen and compilation of proto files because skipCodegen=true' println '*** Skipping the build of codegen and compilation of proto files because skipCodegen=true'

View File

@ -11,8 +11,8 @@ java_library(
deps = [ deps = [
"//api", "//api",
"//context", "//context",
"//core:inprocess", "//inprocess",
"//core:util", "//util",
"//stub", "//stub",
"@com_google_code_findbugs_jsr305//jar", "@com_google_code_findbugs_jsr305//jar",
"@com_google_guava_guava//jar", "@com_google_guava_guava//jar",

View File

@ -9,7 +9,8 @@ plugins {
description = "gRPC: Testing" description = "gRPC: Testing"
dependencies { dependencies {
api project(':grpc-core'), api project(':grpc-inprocess'),
project(':grpc-util'),
project(':grpc-stub'), project(':grpc-stub'),
libraries.junit libraries.junit
// Only io.grpc.internal.testing.StatsTestUtils depends on opencensus_api, for internal use. // Only io.grpc.internal.testing.StatsTestUtils depends on opencensus_api, for internal use.

18
util/BUILD.bazel Normal file
View File

@ -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
util/build.gradle Normal file
View File

@ -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
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
]
}

View File

@ -1 +1,2 @@
io.grpc.util.SecretRoundRobinLoadBalancerProvider$Provider io.grpc.util.SecretRoundRobinLoadBalancerProvider$Provider
io.grpc.util.OutlierDetectionLoadBalancerProvider

View File

@ -38,7 +38,7 @@ java_library(
"//api", "//api",
"//context", "//context",
"//core:internal", "//core:internal",
"//core:util", "//util",
"//netty", "//netty",
"//stub", "//stub",
"//services:metrics", "//services:metrics",
@ -145,7 +145,7 @@ java_library(
"//api", "//api",
"//context", "//context",
"//core:internal", "//core:internal",
"//core:util", "//util",
"//protobuf", "//protobuf",
"//services:metrics", "//services:metrics",
"//services:metrics_internal", "//services:metrics_internal",