From b3b3ec3a12d13637625c9206019e10d6cc718173 Mon Sep 17 00:00:00 2001 From: Alexey Loubyansky Date: Thu, 23 Mar 2023 22:50:31 +0100 Subject: [PATCH] Re-use current ApplicationModel for JaCoCo reports when testing Gradle projects (cherry picked from commit be495a101191bc58b7ffbe0ba5be67d3a0bc9716) --- .../quarkus/jacoco/deployment/JacocoProcessor.java | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/test-framework/jacoco/deployment/src/main/java/io/quarkus/jacoco/deployment/JacocoProcessor.java b/test-framework/jacoco/deployment/src/main/java/io/quarkus/jacoco/deployment/JacocoProcessor.java index be25c4ca0541d..c7273df4b8f4f 100644 --- a/test-framework/jacoco/deployment/src/main/java/io/quarkus/jacoco/deployment/JacocoProcessor.java +++ b/test-framework/jacoco/deployment/src/main/java/io/quarkus/jacoco/deployment/JacocoProcessor.java @@ -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; @@ -105,17 +104,7 @@ public byte[] apply(String className, byte[] bytes) { info.classFiles = classes; Set 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); }