From ded7cf60f079096776dff641696ff00f7f74d2f0 Mon Sep 17 00:00:00 2001 From: labkey-jeckels Date: Sun, 29 Nov 2026 14:39:14 -0800 Subject: [PATCH 1/2] Add a JaCoCo IntelliJ run configuration template ijConfigure now fetches the JaCoCo agent and installs a copy of the Spring Boot dev configuration that runs the server with it, so tests can collect coverage without hand-editing VM options. --- .gitignore | 3 ++- .../templates/LabKeyEmbedded_Dev_JaCoCo.xml | 15 +++++++++++++++ build.gradle | 19 ++++++++++++++++++- gradle.properties | 3 +++ 4 files changed, 38 insertions(+), 2 deletions(-) create mode 100644 .idea/runConfigurations/templates/LabKeyEmbedded_Dev_JaCoCo.xml diff --git a/.gitignore b/.gitignore index 73238e2747..d6c921e4ab 100644 --- a/.gitignore +++ b/.gitignore @@ -17,7 +17,7 @@ distributions/ labkey-api-*/ labkey-ui-components/ remoteapi/ -server/modules/ +server/modules/ server/testAutomation/ tools/ clientAPIs/* @@ -47,6 +47,7 @@ clientAPIs/* .idea/runConfigurations/LabKey_Dev.xml .idea/runConfigurations/LabKey_Production.xml .idea/runConfigurations/LabKeyEmbedded_Dev.xml +.idea/runConfigurations/LabKeyEmbedded_Dev_JaCoCo.xml .idea/runConfigurations/Spring_Boot_LabKey_Embedded_Tomcat_Dev.xml .idea/gradle.xml .idea/compiler.xml diff --git a/.idea/runConfigurations/templates/LabKeyEmbedded_Dev_JaCoCo.xml b/.idea/runConfigurations/templates/LabKeyEmbedded_Dev_JaCoCo.xml new file mode 100644 index 0000000000..66a2b76169 --- /dev/null +++ b/.idea/runConfigurations/templates/LabKeyEmbedded_Dev_JaCoCo.xml @@ -0,0 +1,15 @@ + + + + + diff --git a/build.gradle b/build.gradle index 80b347005e..6015435c67 100644 --- a/build.gradle +++ b/build.gradle @@ -519,7 +519,7 @@ subprojects { } }) } - + project.tasks.register("allDepInsight", DependencyInsightReportTask) { DependencyInsightReportTask t -> t.group = "Help" @@ -612,6 +612,22 @@ project.tasks.register("ijRunConfigurationsSetup", Copy) { copy.mustRunAfter(project.tasks.ijCodeSetup) } +project.configurations.register("jacocoAgent") { + description = "JaCoCo agent used by the \"(JaCoCo)\" IntelliJ run configuration" + canBeConsumed = false + transitive = false +} +project.dependencies.add("jacocoAgent", "org.jacoco:org.jacoco.agent:${jacocoVersion}:runtime") + +project.tasks.register("ijJacocoAgent", Copy) { + Copy copy -> + copy.group = GroupNames.INIT + copy.description = "Copy the JaCoCo agent to build/jacoco/jacocoagent.jar for the \"(JaCoCo)\" run configuration; rerun after a root clean" + copy.from(project.configurations.named("jacocoAgent")) + copy.into(project.layout.buildDirectory.dir("jacoco")) + copy.rename({ String name -> "jacocoagent.jar" }) +} + project.tasks.register("ijCodeSetup", Copy) { Copy copy -> copy.group = GroupNames.INIT @@ -627,6 +643,7 @@ project.tasks.register('ijConfigure') { task.description = "Install IntelliJ template files as files for IntelliJ to use in .idea directory" task.dependsOn(project.tasks.ijCodeSetup) task.dependsOn(project.tasks.ijRunConfigurationsSetup) + task.dependsOn(project.tasks.ijJacocoAgent) task.dependsOn(BuildUtils.getConfigsProject(project).tasks.configSetup) } diff --git a/gradle.properties b/gradle.properties index f3c6af030d..2d5d5e4060 100644 --- a/gradle.properties +++ b/gradle.properties @@ -215,6 +215,9 @@ jacksonAnnotationsVersion=2.21 # Spring Boot brings in a transitive dependency on Jackson 3.x. It has changed package names and can coexist with Jackson 2.x. jackson3Version=3.1.8 +# Agent for the "(JaCoCo)" IntelliJ run configuration; see the ijJacocoAgent task +jacocoVersion=0.8.15 + # The Jakarta Activation API version that Angus Activation implements. Keep in sync with angusActivationVersion (above). jakartaActivationApiVersion=2.1.4 From 522db752536b4436b99a81fe23b54ef8f2865277 Mon Sep 17 00:00:00 2001 From: labkey-jeckels Date: Sun, 29 Nov 2026 15:04:06 -0800 Subject: [PATCH 2/2] Install the JaCoCo agent with the run configurations ijRunConfigurationsSetup alone no longer leaves the JaCoCo configuration without its agent, and IntelliJ's re-saved copy of that configuration is ignored. --- .gitignore | 1 + build.gradle | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index d6c921e4ab..61c44cc559 100644 --- a/.gitignore +++ b/.gitignore @@ -49,6 +49,7 @@ clientAPIs/* .idea/runConfigurations/LabKeyEmbedded_Dev.xml .idea/runConfigurations/LabKeyEmbedded_Dev_JaCoCo.xml .idea/runConfigurations/Spring_Boot_LabKey_Embedded_Tomcat_Dev.xml +.idea/runConfigurations/Spring_Boot_LabKey_Embedded_Tomcat_Dev__JaCoCo_.xml .idea/gradle.xml .idea/compiler.xml .idea/misc.xml diff --git a/build.gradle b/build.gradle index 6015435c67..bda2ef8b80 100644 --- a/build.gradle +++ b/build.gradle @@ -610,6 +610,7 @@ project.tasks.register("ijRunConfigurationsSetup", Copy) { return line.replace("PATH_SEPARATOR", File.pathSeparator) }) copy.mustRunAfter(project.tasks.ijCodeSetup) + copy.dependsOn("ijJacocoAgent") } project.configurations.register("jacocoAgent") { @@ -643,7 +644,6 @@ project.tasks.register('ijConfigure') { task.description = "Install IntelliJ template files as files for IntelliJ to use in .idea directory" task.dependsOn(project.tasks.ijCodeSetup) task.dependsOn(project.tasks.ijRunConfigurationsSetup) - task.dependsOn(project.tasks.ijJacocoAgent) task.dependsOn(BuildUtils.getConfigsProject(project).tasks.configSetup) }