Skip to content

Commit

Permalink
Merge pull request #15153 from glefloch/fix/gradle-included-build-test
Browse files Browse the repository at this point in the history
Remove jandex plugin from flaky test
  • Loading branch information
aloubyansky authored Feb 19, 2021
2 parents b042fca + 567c953 commit 6dce423
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@

import io.quarkus.bootstrap.BootstrapConstants;
import io.quarkus.bootstrap.model.AppArtifactKey;
import io.quarkus.bootstrap.resolver.QuarkusGradleModelFactory;
import io.quarkus.bootstrap.resolver.model.ArtifactCoords;
import io.quarkus.bootstrap.resolver.model.Dependency;
import io.quarkus.bootstrap.resolver.model.ModelParameter;
Expand All @@ -68,6 +67,9 @@

public class QuarkusModelBuilder implements ParameterizedToolingModelBuilder<ModelParameter> {

private static final String MAIN_RESOURCES_OUTPUT = "build/resources/main";
private static final String CLASSES_OUTPUT = "build/classes";

private static Configuration classpathConfig(Project project, LaunchMode mode) {
if (LaunchMode.TEST.equals(mode)) {
return project.getConfigurations().getByName(JavaPlugin.TEST_RUNTIME_CLASSPATH_CONFIGURATION_NAME);
Expand Down Expand Up @@ -339,7 +341,7 @@ private void collectDependencies(ResolvedConfiguration configuration,
a.getId().getComponentIdentifier() instanceof ProjectComponentIdentifier) {
IncludedBuild includedBuild = includedBuild(project, a.getName());
if (includedBuild != null) {
addSubstitutedProject(dep, includedBuild.getProjectDir(), mode);
addSubstitutedProject(dep, includedBuild.getProjectDir());
} else {
Project projectDep = project.getRootProject()
.findProject(((ProjectComponentIdentifier) a.getId().getComponentIdentifier()).getProjectPath());
Expand Down Expand Up @@ -413,13 +415,25 @@ private void addDevModePaths(final DependencyImpl dep, ResolvedArtifact a, Proje
}
}

private void addSubstitutedProject(final DependencyImpl dep, File projectFile, LaunchMode mode) {
final QuarkusModel quarkusModel = QuarkusGradleModelFactory.create(projectFile, mode.name());
final io.quarkus.bootstrap.resolver.model.SourceSet moduleOutput = quarkusModel.getWorkspace().getMainModule()
.getSourceSet();
dep.addPath(moduleOutput.getResourceDirectory());
for (File sourceDirectory : moduleOutput.getSourceDirectories()) {
dep.addPath(sourceDirectory);
private void addSubstitutedProject(final DependencyImpl dep, File projectFile) {
File mainResourceDirectory = new File(projectFile, MAIN_RESOURCES_OUTPUT);
if (mainResourceDirectory.exists()) {
dep.addPath(mainResourceDirectory);
}
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)) {
dep.addPath(sourceSet);
}
}
}
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
plugins {
id 'java'
id 'io.quarkus'
id "org.kordamp.gradle.jandex" version '0.6.0'
}

repositories {
Expand Down

0 comments on commit 6dce423

Please sign in to comment.