Skip to content

Commit 518f6cf

Browse files
committed
Disable Gradle Module Metadata resolution
The module metadata in Guava causes the -jre version to be selected even when you choose the -android version. Gradle did not give any clues that this was happening, and while `println(configurations.compileClasspath.resolve())` shows the different jar in use, most other diagonstics don't. dependencyInsight can show you this is happening, but only if you know which dependency has a problem and read Guava's module metadata first to understand the significance of the results. You could argue this is a Guava-specific problem. I was able to get parts of our build working with attributes and resolutionStrategy configurations mentioned at https://github.com/google/guava/releases/tag/v32.1.0 , so that only Guava would be changed. But it was fickle giving poor error messages or silently swapping back to the -jre version. Given the weak debuggability, the added complexity, and the lack of value module metadata is providing us, disabling module metadata for our entire build seems prudent. See google/guava#7575
1 parent ebe2b48 commit 518f6cf

File tree

6 files changed

+19
-8
lines changed

6 files changed

+19
-8
lines changed

Diff for: android-interop-testing/build.gradle

-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ description = 'gRPC: Android Integration Testing'
77

88
repositories {
99
google()
10-
mavenCentral()
1110
}
1211

1312
android {

Diff for: android/build.gradle

-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ android {
3131

3232
repositories {
3333
google()
34-
mavenCentral()
3534
}
3635

3736
dependencies {

Diff for: binder/build.gradle

-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ android {
3232

3333
repositories {
3434
google()
35-
mavenCentral()
3635
}
3736

3837
dependencies {

Diff for: build.gradle

+18-3
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,24 @@ subprojects {
2525

2626
repositories {
2727
maven { // The google mirror is less flaky than mavenCentral()
28-
url "https://maven-central.storage-download.googleapis.com/maven2/" }
29-
mavenCentral()
30-
mavenLocal()
28+
url "https://maven-central.storage-download.googleapis.com/maven2/"
29+
metadataSources {
30+
mavenPom()
31+
ignoreGradleMetadataRedirection()
32+
}
33+
}
34+
mavenCentral() {
35+
metadataSources {
36+
mavenPom()
37+
ignoreGradleMetadataRedirection()
38+
}
39+
}
40+
mavenLocal() {
41+
metadataSources {
42+
mavenPom()
43+
ignoreGradleMetadataRedirection()
44+
}
45+
}
3146
}
3247

3348
tasks.withType(JavaCompile).configureEach {

Diff for: cronet/build.gradle

-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ description = "gRPC: Cronet Android"
88

99
repositories {
1010
google()
11-
mavenCentral()
1211
}
1312

1413
android {

Diff for: gradle/libs.versions.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ jetty-servlet10 = "org.eclipse.jetty:jetty-servlet:10.0.20"
6262
jsr305 = "com.google.code.findbugs:jsr305:3.0.2"
6363
junit = "junit:junit:4.13.2"
6464
# 2.17+ require Java 11+ (not mentioned in release notes)
65-
lincheck = "org.jetbrains.kotlinx:lincheck:2.16"
65+
lincheck = "org.jetbrains.kotlinx:lincheck-jvm:2.16"
6666
# Update notes / 2023-07-19 sergiitk:
6767
# Couldn't update to 5.4.0, updated to the last in 4.x line. Version 5.x breaks some tests.
6868
# Error log: https://github.com/grpc/grpc-java/pull/10359#issuecomment-1632834435

0 commit comments

Comments
 (0)