Skip to content

Commit 53d4aa2

Browse files
committed
Pull up the second check on onlyIfUsing into the larger if
1 parent b6ed519 commit 53d4aa2

1 file changed

Lines changed: 3 additions & 5 deletions

File tree

rewrite-gradle/src/main/java/org/openrewrite/gradle/AddDependency.java

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -202,15 +202,13 @@ public TreeVisitor<?, ExecutionContext> getVisitor(Scanned acc) {
202202
if (!maybeGp.isPresent()) {
203203
return s;
204204
}
205-
// When onlyIfUsing is set, skip projects that don't use the specified type
206205
if (onlyIfUsing != null) {
206+
// When onlyIfUsing is set, skip projects that don't use the specified type
207207
if (!maybeJp.isPresent() || !acc.usingType.getOrDefault(maybeJp.get(), false)) {
208208
return s;
209209
}
210-
}
211-
// When configuration needs to be inferred, also require source set info
212-
if (!hasExplicitConfiguration && onlyIfUsing != null) {
213-
if (!acc.configurationsByProject.containsKey(maybeJp.get())) {
210+
// When configuration needs to be inferred, also require source set info
211+
if (!hasExplicitConfiguration && !acc.configurationsByProject.containsKey(maybeJp.get())) {
214212
return s;
215213
}
216214
}

0 commit comments

Comments
 (0)