Skip to content

Commit 5966c66

Browse files
CopilotjGauravGupta
andcommitted
fix: resolve Windows CI failures in wrapper detection and path separators
Co-authored-by: jGauravGupta <15934072+jGauravGupta@users.noreply.github.com>
1 parent e1adbae commit 5966c66

3 files changed

Lines changed: 7 additions & 3 deletions

File tree

src/main/java/io/github/jeddict/ai/agent/project/GradleProjectTools.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,9 @@ private String resolveWrapper() {
236236
final boolean isWindows = System.getProperty("os.name").toLowerCase().contains("win");
237237
final File basedirFile = new File(basedir);
238238
if (isWindows) {
239-
return new File(basedirFile, "gradlew.bat").exists() ? "gradlew.bat" : "gradle";
239+
if (new File(basedirFile, "gradlew.bat").exists()) return "gradlew.bat";
240+
if (new File(basedirFile, "gradlew").exists()) return "./gradlew";
241+
return "gradle";
240242
} else {
241243
return new File(basedirFile, "gradlew").exists() ? "./gradlew" : "gradle";
242244
}

src/main/java/io/github/jeddict/ai/agent/project/MavenProjectTools.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,9 @@ private String resolveWrapper() {
254254
final boolean isWindows = System.getProperty("os.name").toLowerCase().contains("win");
255255
final File basedirFile = new File(basedir);
256256
if (isWindows) {
257-
return new File(basedirFile, "mvnw.cmd").exists() ? "mvnw.cmd" : "mvn";
257+
if (new File(basedirFile, "mvnw.cmd").exists()) return "mvnw.cmd";
258+
if (new File(basedirFile, "mvnw").exists()) return "./mvnw";
259+
return "mvn";
258260
} else {
259261
return new File(basedirFile, "mvnw").exists() ? "./mvnw" : "mvn";
260262
}

src/main/java/io/github/jeddict/ai/agent/project/ProjectTools.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -444,7 +444,7 @@ private static String relativize(Project project, String absolutePath) {
444444
final Path projectRoot = Paths.get(project.getProjectDirectory().getPath());
445445
final Path absolute = Paths.get(absolutePath);
446446
if (absolute.startsWith(projectRoot)) {
447-
return projectRoot.relativize(absolute).toString();
447+
return projectRoot.relativize(absolute).toString().replace(File.separatorChar, '/');
448448
}
449449
return absolutePath;
450450
} catch (final IllegalArgumentException e) {

0 commit comments

Comments
 (0)