Skip to content

Commit ebbe067

Browse files
authored
alts,census,gcp-observability: Explicitly set grpc-context as an implementation dependency (#10997)
Override google-auth `io.grpc:grpc-context` dependency with our own `project(":grpc-context")`. This fixes the issue with classes depending on `grpc-alts` implementation receiving very (!) old `io.grpc:grpc-context:1.27.2` as a transitive dependency of `com.google.auth`. Projects `grpc-census` `grpc-gcp-observability` are affected in the similar way, except `io.grpc:grpc-context:1.59.1` is pulled as a transitive dependency of `io.opencensus`. ### Before ``` ❯ ./gradlew -q :grpc-xds:dependencyInsight --configuration=compileClasspath --dependency=io.grpc:grpc-context *** Skipping the build of codegen and compilation of proto files because skipCodegen=true * Skipping the build of Android projects because skipAndroid=true io.grpc:grpc-context:1.27.2 Variant compile: | Attribute Name | Provided | Requested | |--------------------------------|----------|--------------| | org.gradle.status | release | | | org.gradle.category | library | library | | org.gradle.libraryelements | jar | classes | | org.gradle.usage | java-api | java-api | | org.gradle.dependency.bundling | | external | | org.gradle.jvm.environment | | standard-jvm | | org.gradle.jvm.version | | 8 | io.grpc:grpc-context:1.27.2 \--- io.opencensus:opencensus-api:0.31.1 +--- com.google.http-client:google-http-client:1.43.3 | +--- com.google.auth:google-auth-library-oauth2-http:1.22.0 | | \--- project :grpc-alts | | \--- compileClasspath | \--- com.google.http-client:google-http-client-gson:1.43.3 | \--- com.google.auth:google-auth-library-oauth2-http:1.22.0 (*) \--- io.opencensus:opencensus-contrib-http-util:0.31.1 \--- com.google.http-client:google-http-client:1.43.3 (*) (*) - Indicates repeated occurrences of a transitive dependency subtree. Gradle expands transitive dependency subtrees only once per project; repeat occurrences only display the root of the subtree, followed by this annotation. ``` ### After ``` ❯ ./gradlew -q :grpc-xds:dependencyInsight --configuration=compileClasspath --dependency=io.grpc:grpc-context *** Skipping the build of codegen and compilation of proto files because skipCodegen=true * Skipping the build of Android projects because skipAndroid=true project :grpc-context Variant apiElements: | Attribute Name | Provided | Requested | |--------------------------------|----------|--------------| | org.gradle.category | library | library | | org.gradle.dependency.bundling | external | external | | org.gradle.jvm.version | 8 | 8 | | org.gradle.libraryelements | jar | classes | | org.gradle.usage | java-api | java-api | | org.gradle.jvm.environment | | standard-jvm | Selection reasons: - By conflict resolution: between versions 1.63.0-SNAPSHOT and 1.27.2 project :grpc-context \--- project :grpc-alts \--- compileClasspath io.grpc:grpc-context:1.27.2 -> project :grpc-context \--- io.opencensus:opencensus-api:0.31.1 +--- com.google.http-client:google-http-client:1.43.3 | +--- com.google.auth:google-auth-library-oauth2-http:1.22.0 | | \--- project :grpc-alts | | \--- compileClasspath | \--- com.google.http-client:google-http-client-gson:1.43.3 | \--- com.google.auth:google-auth-library-oauth2-http:1.22.0 (*) \--- io.opencensus:opencensus-contrib-http-util:0.31.1 \--- com.google.http-client:google-http-client:1.43.3 (*) (*) - Indicates repeated occurrences of a transitive dependency subtree. Gradle expands transitive dependency subtrees only once per project; repeat occurrences only display the root of the subtree, followed by this annotation. ```
1 parent aa90768 commit ebbe067

File tree

5 files changed

+6
-1
lines changed

5 files changed

+6
-1
lines changed

alts/build.gradle

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ dependencies {
1313
api project(':grpc-api')
1414
implementation project(':grpc-auth'),
1515
project(':grpc-core'),
16+
project(":grpc-context"), // Override google-auth dependency with our newer version
1617
project(':grpc-grpclb'),
1718
project(':grpc-protobuf'),
1819
project(':grpc-stub'),

auth/build.gradle

+1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ dependencies {
2020
implementation libraries.guava
2121
testImplementation project(':grpc-testing'),
2222
project(':grpc-core'),
23+
project(":grpc-context"), // Override google-auth dependency with our newer version
2324
libraries.google.auth.oauth2Http
2425
signature libraries.signature.java
2526
signature libraries.signature.android

census/build.gradle

+1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ dependencies {
1818
// force dependent jars to depend on latest grpc-context
1919
runtimeOnly project(":grpc-context")
2020
implementation libraries.guava,
21+
project(":grpc-context"), // Override opencensus dependency with our newer version
2122
libraries.opencensus.api,
2223
libraries.opencensus.contrib.grpc.metrics
2324

gcp-observability/build.gradle

+1
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ dependencies {
3434
implementation project(':grpc-protobuf'),
3535
project(':grpc-stub'),
3636
project(':grpc-census'),
37+
project(":grpc-context"), // Override opencensus dependency with our newer version
3738
libraries.opencensus.contrib.grpc.metrics
3839
// Avoid gradle using project dependencies without configuration: shadow
3940
implementation (libraries.google.cloud.logging) {

testing/build.gradle

+2-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ dependencies {
1515
implementation project(':grpc-inprocess')
1616
implementation project(':grpc-core')
1717
// Only io.grpc.internal.testing.StatsTestUtils depends on opencensus_api, for internal use.
18-
compileOnly libraries.opencensus.api
18+
compileOnly libraries.opencensus.api,
19+
project(":grpc-context") // Override opencensus dependency with our newer version
1920
runtimeOnly project(":grpc-api") // Pull in newer version than census-api
2021

2122
testImplementation libraries.mockito.core

0 commit comments

Comments
 (0)