Skip to content

Commit de39f3b

Browse files
committed
Skip settings.gradle existence check when build file is conventional
1 parent b97ac66 commit de39f3b

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

rewrite-gradle-tooling-model/model/src/main/java/org/openrewrite/gradle/toolingapi/OpenRewriteModelBuilder.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -99,11 +99,12 @@ public static OpenRewriteModel forProjectDirectory(File projectDir, @Nullable Fi
9999
File abs = buildFile.getAbsoluteFile();
100100
boolean atConventionalLocation = abs.equals(new File(projectDir, "build.gradle").getAbsoluteFile()) ||
101101
abs.equals(new File(projectDir, "build.gradle.kts").getAbsoluteFile());
102-
Path projectPath = projectDir.toPath();
103-
boolean settingsAlreadyExists = Files.exists(projectPath.resolve("settings.gradle")) ||
104-
Files.exists(projectPath.resolve("settings.gradle.kts"));
105-
if (!atConventionalLocation && !settingsAlreadyExists) {
106-
settings = projectPath.resolve("settings.gradle");
102+
if (!atConventionalLocation) {
103+
Path projectPath = projectDir.toPath();
104+
if (!Files.exists(projectPath.resolve("settings.gradle")) &&
105+
!Files.exists(projectPath.resolve("settings.gradle.kts"))) {
106+
settings = projectPath.resolve("settings.gradle");
107+
}
107108
}
108109
}
109110
try (ProjectConnection connection = connector.connect()) {

0 commit comments

Comments
 (0)