Skip to content

Commit

Permalink
Re-use current ApplicationModel for JaCoCo reports when testing Gradl…
Browse files Browse the repository at this point in the history
…e projects

(cherry picked from commit be495a1)
  • Loading branch information
aloubyansky authored and gsmet committed Apr 2, 2023
1 parent 3f901dd commit b3b3ec3
Showing 1 changed file with 1 addition and 12 deletions.
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

0 comments on commit b3b3ec3

Please sign in to comment.