Skip to content

Commit 9ed0fa6

Browse files
cpovirkGoogle Java Core Libraries
authored and
Google Java Core Libraries
committedJul 31, 2023
Under Gradle, return to having guava automatically pull in the empty listenablefuture-9999....jar instead of making Gradle report a conflict that users need to [resolve](https://github.com/google/guava/releases/tag/v32.1.0#user-content-overlap).
See discussion in #6642: The Gradle module metadata does multiple things, most of which bring clear benefits but one of which (the `listenablefuture` part) may bring more costs than benefits at this point. (Accordingly, this CL rolls back one tiny fragment of the larger cl/544108700.) Fixes #6642 RELNOTES=Removed the section of our Gradle metadata that caused Gradle to report conflicts with `listenablefuture`. PiperOrigin-RevId: 552447789
1 parent 347ef4e commit 9ed0fa6

File tree

2 files changed

+34
-36
lines changed

2 files changed

+34
-36
lines changed
 

‎guava/module.json

+28-20
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,13 @@
4343
"requires": "1.0.1"
4444
}
4545
},
46+
{
47+
"group": "com.google.guava",
48+
"module": "listenablefuture",
49+
"version": {
50+
"requires": "9999.0-empty-to-avoid-conflict-with-guava"
51+
}
52+
},
4653
{
4754
"group": "com.google.code.findbugs",
4855
"module": "jsr305"
@@ -76,11 +83,6 @@
7683
"group": "com.google.collections",
7784
"name": "google-collections",
7885
"version": "${pom.version}"
79-
},
80-
{
81-
"group": "com.google.guava",
82-
"name": "listenablefuture",
83-
"version": "1.0"
8486
}
8587
]
8688
},
@@ -112,6 +114,13 @@
112114
"requires": "1.0.1"
113115
}
114116
},
117+
{
118+
"group": "com.google.guava",
119+
"module": "listenablefuture",
120+
"version": {
121+
"requires": "9999.0-empty-to-avoid-conflict-with-guava"
122+
}
123+
},
115124
{
116125
"group": "com.google.code.findbugs",
117126
"module": "jsr305"
@@ -141,11 +150,6 @@
141150
"group": "com.google.collections",
142151
"name": "google-collections",
143152
"version": "${pom.version}"
144-
},
145-
{
146-
"group": "com.google.guava",
147-
"name": "listenablefuture",
148-
"version": "1.0"
149153
}
150154
]
151155
},
@@ -177,6 +181,13 @@
177181
"requires": "1.0.1"
178182
}
179183
},
184+
{
185+
"group": "com.google.guava",
186+
"module": "listenablefuture",
187+
"version": {
188+
"requires": "9999.0-empty-to-avoid-conflict-with-guava"
189+
}
190+
},
180191
{
181192
"group": "com.google.code.findbugs",
182193
"module": "jsr305"
@@ -210,11 +221,6 @@
210221
"group": "com.google.collections",
211222
"name": "google-collections",
212223
"version": "${pom.version}"
213-
},
214-
{
215-
"group": "com.google.guava",
216-
"name": "listenablefuture",
217-
"version": "1.0"
218224
}
219225
]
220226
},
@@ -246,6 +252,13 @@
246252
"requires": "1.0.1"
247253
}
248254
},
255+
{
256+
"group": "com.google.guava",
257+
"module": "listenablefuture",
258+
"version": {
259+
"requires": "9999.0-empty-to-avoid-conflict-with-guava"
260+
}
261+
},
249262
{
250263
"group": "com.google.code.findbugs",
251264
"module": "jsr305"
@@ -275,11 +288,6 @@
275288
"group": "com.google.collections",
276289
"name": "google-collections",
277290
"version": "${pom.version}"
278-
},
279-
{
280-
"group": "com.google.guava",
281-
"name": "listenablefuture",
282-
"version": "1.0"
283291
}
284292
]
285293
}

‎integration-tests/gradle/build.gradle.kts

+6-16
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,17 @@ val expectedReducedRuntimeClasspathAndroidVersion =
1010
"failureaccess-1.0.1.jar",
1111
"jsr305-3.0.2.jar",
1212
"checker-qual-3.33.0.jar",
13-
"error_prone_annotations-2.18.0.jar"
13+
"error_prone_annotations-2.18.0.jar",
14+
"listenablefuture-9999.0-empty-to-avoid-conflict-with-guava.jar"
1415
)
1516
val expectedReducedRuntimeClasspathJreVersion =
1617
setOf(
1718
"guava-$guavaVersionJre.jar",
1819
"failureaccess-1.0.1.jar",
1920
"jsr305-3.0.2.jar",
2021
"checker-qual-3.33.0.jar",
21-
"error_prone_annotations-2.18.0.jar"
22+
"error_prone_annotations-2.18.0.jar",
23+
"listenablefuture-9999.0-empty-to-avoid-conflict-with-guava.jar"
2224
)
2325
val expectedCompileClasspathAndroidVersion =
2426
expectedReducedRuntimeClasspathAndroidVersion + setOf("j2objc-annotations-2.8.jar")
@@ -27,7 +29,6 @@ val expectedCompileClasspathJreVersion =
2729

2830
val extraLegacyDependencies =
2931
setOf(
30-
"listenablefuture-9999.0-empty-to-avoid-conflict-with-guava.jar",
3132
"google-collections-1.0.jar"
3233
)
3334

@@ -60,7 +61,7 @@ subprojects {
6061
// - variant decision is made based on version suffix (android/jre) and not on the actual
6162
// environment
6263
// - runtime classpath equals the compile classpath
63-
// - dependency conflict with Google Collections is not detected and '9999.0' hack is present
64+
// - dependency conflict with Google Collections is not detected
6465
if (name.startsWith("android")) {
6566
expectedCompileClasspathAndroidVersion + extraLegacyDependencies
6667
} else {
@@ -70,7 +71,7 @@ subprojects {
7071
// with Gradle Module Metadata
7172
// - variant is chosen based on the actual environment, independent of version suffix
7273
// - reduced runtime classpath is used (w/o annotation libraries)
73-
// - capability conflicts are detected between Google Collections and listenablefuture
74+
// - capability conflicts are detected with Google Collections
7475
if (name.contains("Android") && !name.contains("JreConstraint")) {
7576
when {
7677
name.contains("RuntimeClasspath") -> {
@@ -127,17 +128,6 @@ subprojects {
127128
}
128129
?.apply { select(this) }
129130
}
130-
withCapability("com.google.guava:listenablefuture") {
131-
candidates
132-
.find {
133-
val idField =
134-
it.javaClass.getDeclaredMethod(
135-
"getId"
136-
) // reflective access to make this compile with Gradle 5
137-
(idField.invoke(it) as ModuleComponentIdentifier).module == "guava"
138-
}
139-
?.apply { select(this) }
140-
}
141131
}
142132
}
143133

0 commit comments

Comments
 (0)
Please sign in to comment.