Skip to content

Commit cc7a6c0

Browse files
authored
Merge pull request #1581 from stalep/nativeimagelauncher-gradle
Search for a native image for gradle builds if the maven search fails
2 parents dd2dc9e + 5077ed9 commit cc7a6c0

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

test-framework/common/src/main/java/io/quarkus/test/common/NativeImageLauncher.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,14 +81,23 @@ private static String guessPath(Class<?> testClass) {
8181
URL[] urls = ((URLClassLoader) cl).getURLs();
8282
for (URL url : urls) {
8383
if (url.getProtocol().equals("file") && url.getPath().endsWith("test-classes/")) {
84-
//we have the test classes dir
84+
//we have the maven test classes dir
8585
File testClasses = new File(url.getPath());
8686
for (File file : testClasses.getParentFile().listFiles()) {
8787
if (file.getName().endsWith("-runner")) {
8888
logGuessedPath(file.getAbsolutePath());
8989
return file.getAbsolutePath();
9090
}
9191
}
92+
} else if (url.getProtocol().equals("file") && url.getPath().endsWith("test/")) {
93+
//we have the gradle test classes dir, build/classes/java/test
94+
File testClasses = new File(url.getPath());
95+
for (File file : testClasses.getParentFile().getParentFile().getParentFile().listFiles()) {
96+
if (file.getName().endsWith("-runner")) {
97+
logGuessedPath(file.getAbsolutePath());
98+
return file.getAbsolutePath();
99+
}
100+
}
92101
}
93102
}
94103
}

0 commit comments

Comments
 (0)