Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Re-use current ApplicationModel for JaCoCo reports when testing Gradle projects #32093

Merged
merged 1 commit into from
Mar 27, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
import org.jboss.jandex.ClassInfo;

import io.quarkus.bootstrap.model.ApplicationModel;
import io.quarkus.bootstrap.utils.BuildToolHelper;
import io.quarkus.bootstrap.workspace.SourceDir;
import io.quarkus.deployment.ApplicationArchive;
import io.quarkus.deployment.IsTest;
Expand Down Expand Up @@ -105,17 +104,7 @@ public byte[] apply(String className, byte[] bytes) {
info.classFiles = classes;

Set<String> sources = new HashSet<>();
ApplicationModel model;
if (BuildToolHelper.isMavenProject(targetdir.toPath())) {
model = curateOutcomeBuildItem.getApplicationModel();
} else if (BuildToolHelper.isGradleProject(targetdir.toPath())) {
//this seems counter productive, but we want the dev mode model and not the test model
//as the test model will include the test classes that we don't want in the report
model = BuildToolHelper.enableGradleAppModelForDevMode(targetdir.toPath());
} else {
throw new RuntimeException("Cannot determine project type generating Jacoco report");
}

final ApplicationModel model = curateOutcomeBuildItem.getApplicationModel();
if (model.getApplicationModule() != null) {
addProjectModule(model.getAppArtifact(), config, info, includes, excludes, classes, sources);
}
Expand Down