Skip to content

Commit 612835a

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 612835a

File tree

3 files changed

+20
-15
lines changed

3 files changed

+20
-15
lines changed

README.md

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -100,21 +100,14 @@ 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("com.google.j2objc:j2objc-annotations")
105+
reduceToCompileOnlyApiDependency("org.jspecify:jspecify")
105106
}
106107
}
107108
}
108109
```
109110
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-
118111
## Disclaimer
119112
120113
Gradle and the Gradle logo are trademarks of Gradle, Inc.

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

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,24 @@
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("com.google.j2objc:j2objc-annotations")
41+
* reduceToCompileOnlyApiDependency("org.jspecify:jspecify")
42+
* }
43+
* }
44+
* }
45+
* </pre>
46+
* </p>
3247
*/
3348
@CacheableRule
49+
@Deprecated
3450
abstract public class GuavaComponentRule implements ComponentMetadataRule {
3551

3652
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)