Skip to content

Commit 9017302

Browse files
committed
Deprecate GuaveComponentRule
It does no longer fit the current Guava release, which replaced jsr305 with jspecify. Users can use the patch DSL if needed. The rule will be removed in the next major release.
1 parent be4f1f0 commit 9017302

File tree

3 files changed

+18
-15
lines changed

3 files changed

+18
-15
lines changed

README.md

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -100,21 +100,13 @@ If some of the transitive dependencies are not wanted in your case, you can fine
100100
jvmDependencyConflicts {
101101
patch {
102102
module("com.google.guava:guava") {
103-
removeDependency("com.google.code.findbugs:jsr305")
104103
reduceToCompileOnlyApiDependency("com.google.errorprone:error_prone_annotations")
104+
reduceToCompileOnlyApiDependency("org.jspecify:jspecify")
105105
}
106106
}
107107
}
108108
```
109109
110-
If you need the previous behavior for older Guava versions, you can explicitly apply the `GuavaComponentRule`.
111-
112-
```kotlin
113-
dependencies.components {
114-
withModule<GuavaComponentRule>("com.google.guava:guava")
115-
}
116-
```
117-
118110
## Disclaimer
119111
120112
Gradle and the Gradle logo are trademarks of Gradle, Inc.

src/main/java/org/gradlex/jvm/dependency/conflict/resolution/rules/GuavaComponentRule.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,23 @@
2929
/**
3030
* Kept for individual usage to get the patch functionality for older Guava versions.
3131
* Might be removed in future versions.
32+
*
33+
* @deprecated use patch DSL:
34+
* <p>
35+
* <pre>
36+
* jvmDependencyConflicts {
37+
* patch {
38+
* module("com.google.guava:guava") {
39+
* reduceToCompileOnlyApiDependency("com.google.errorprone:error_prone_annotations")
40+
* reduceToCompileOnlyApiDependency("org.jspecify:jspecify")
41+
* }
42+
* }
43+
* }
44+
* </pre>
45+
* </p>
3246
*/
3347
@CacheableRule
48+
@Deprecated
3449
abstract public class GuavaComponentRule implements ComponentMetadataRule {
3550

3651
private final static Attribute<String> TARGET_JVM_ENVIRONMENT_ATTRIBUTE =

src/test/groovy/org/gradlex/jvm/dependency/conflict/test/GuavaClasspathTest.groovy

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -121,12 +121,8 @@ class GuavaClasspathTest extends Specification {
121121
result.add([it[0], it[1], it[2], 'standard-jvm', 'runtimeClasspath'])
122122
}
123123
}
124-
if (System.getProperty("gradleVersionUnderTest") == "7.6.4") {
125-
// only do all permutations for one Gradle version
126-
return result
127-
}
128-
// reduced amount of permutations
129-
return result.subList(0, 80)
124+
// The rule we are testing is Deprecated, until we remove it just test one permutation
125+
return result.subList(0, 4)
130126
}
131127

132128
@Unroll

0 commit comments

Comments
 (0)