From e5e35d918ae183590d807c67620f1f99bfa0b75a Mon Sep 17 00:00:00 2001 From: glefloch Date: Tue, 24 Jan 2023 14:25:51 +0100 Subject: [PATCH] Handle empty source directory for included builds --- .../tooling/GradleApplicationModelBuilder.java | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/devtools/gradle/gradle-model/src/main/java/io/quarkus/gradle/tooling/GradleApplicationModelBuilder.java b/devtools/gradle/gradle-model/src/main/java/io/quarkus/gradle/tooling/GradleApplicationModelBuilder.java index fea4982a42529..0344dda228d18 100644 --- a/devtools/gradle/gradle-model/src/main/java/io/quarkus/gradle/tooling/GradleApplicationModelBuilder.java +++ b/devtools/gradle/gradle-model/src/main/java/io/quarkus/gradle/tooling/GradleApplicationModelBuilder.java @@ -18,7 +18,6 @@ import java.util.Properties; import java.util.Set; -import org.gradle.api.GradleException; import org.gradle.api.Project; import org.gradle.api.artifacts.Configuration; import org.gradle.api.artifacts.ResolvedArtifact; @@ -570,15 +569,13 @@ private void addSubstitutedProject(PathList.Builder paths, File projectFile) { } File classesOutput = new File(projectFile, CLASSES_OUTPUT); File[] languageDirectories = classesOutput.listFiles(); - if (languageDirectories == null) { - throw new GradleException( - "The project does not contain a class output directory. " + classesOutput.getPath() + " must exist."); - } - for (File languageDirectory : languageDirectories) { - if (languageDirectory.isDirectory()) { - for (File sourceSet : languageDirectory.listFiles()) { - if (sourceSet.isDirectory() && sourceSet.getName().equals(SourceSet.MAIN_SOURCE_SET_NAME)) { - paths.add(sourceSet.toPath()); + if (languageDirectories != null) { + for (File languageDirectory : languageDirectories) { + if (languageDirectory.isDirectory()) { + for (File sourceSet : languageDirectory.listFiles()) { + if (sourceSet.isDirectory() && sourceSet.getName().equals(SourceSet.MAIN_SOURCE_SET_NAME)) { + paths.add(sourceSet.toPath()); + } } } }