Skip to content

Commit

Permalink
Continuous testing fails with multiple outputs
Browse files Browse the repository at this point in the history
  • Loading branch information
stuartwdouglas committed May 17, 2021
1 parent e284ec6 commit 534c5dc
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ public Path appJarOrClasses() {
JavaPluginConvention javaConvention = convention.findPlugin(JavaPluginConvention.class);
if (javaConvention != null) {
final SourceSet mainSourceSet = javaConvention.getSourceSets().getByName(SourceSet.MAIN_SOURCE_SET_NAME);
final String classesPath = QuarkusGradleUtils.getClassesDir(mainSourceSet, jarTask.getTemporaryDir());
final String classesPath = QuarkusGradleUtils.getClassesDir(mainSourceSet, jarTask.getTemporaryDir(), false);
if (classesPath != null) {
classesDir = Paths.get(classesPath);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ private void addLocalProject(Project project, GradleDevModeLauncher.Builder buil
return;
}

String classesDir = QuarkusGradleUtils.getClassesDir(mainSourceSet, project.getBuildDir());
String classesDir = QuarkusGradleUtils.getClassesDir(mainSourceSet, project.getBuildDir(), false);
if (classesDir == null) {
return;
} else {
Expand Down Expand Up @@ -429,7 +429,7 @@ private void addLocalProject(Project project, GradleDevModeLauncher.Builder buil
final File testResourcesOutputDir = testSourceSet.getOutput().getResourcesDir();

if (!testSourcePaths.isEmpty() || (testResourcesOutputDir != null && testResourcesOutputDir.exists())) {
String testClassesDir = QuarkusGradleUtils.getClassesDir(testSourceSet, project.getBuildDir());
String testClassesDir = QuarkusGradleUtils.getClassesDir(testSourceSet, project.getBuildDir(), true);
if (testClassesDir != null) {
File testClassesDirFile = new File(testClassesDir);
if (testClassesDirFile.exists()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,17 +56,16 @@ public static PathsCollection getOutputPaths(Project project) {
return builder.build();
}

public static String getClassesDir(SourceSet sourceSet, File tmpDir) {
return getClassesDir(sourceSet, tmpDir, true);
public static String getClassesDir(SourceSet sourceSet, File tmpDir, boolean test) {
return getClassesDir(sourceSet, tmpDir, true, test);
}

public static String getClassesDir(SourceSet sourceSet, File tmpDir, boolean populated) {
public static String getClassesDir(SourceSet sourceSet, File tmpDir, boolean populated, boolean test) {
FileCollection classesDirs = sourceSet.getOutput().getClassesDirs();
Set<File> classDirFiles = classesDirs.getFiles();
if (classDirFiles.size() == 1) {
return classesDirs.getAsPath();
}

Path classesDir = null;
final Iterator<File> i = classDirFiles.iterator();
int dirCount = 0;
Expand All @@ -84,7 +83,7 @@ public static String getClassesDir(SourceSet sourceSet, File tmpDir, boolean pop
//there does not seem to be any sane way of dealing with multiple output dirs, as there does not seem
//to be a way to map them. We will need to address this at some point, but for now we just stick them
//all in a temp dir
final Path tmpClassesDir = tmpDir.toPath().resolve("quarkus-app-classes");
final Path tmpClassesDir = tmpDir.toPath().resolve("quarkus-app-classes" + (test ? "-test" : ""));
if (!populated) {
return tmpClassesDir.toString();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ public final class PathTestHelper {
TEST_TO_MAIN_DIR_FRAGMENTS.put(
"classes" + File.separator + "java" + File.separator + "native-integration-test",
"classes" + File.separator + "java" + File.separator + "main");
TEST_TO_MAIN_DIR_FRAGMENTS.put( //synthetic tmp dirs when there are multiple outputs
"quarkus-app-classes-test",
"quarkus-app-classes");
//endregion
//region Kotlin
TEST_TO_MAIN_DIR_FRAGMENTS.put(
Expand Down

0 comments on commit 534c5dc

Please sign in to comment.