From c16cb9a3cda1ee33bab92dd484fb90e9687df6f3 Mon Sep 17 00:00:00 2001 From: rrourke Date: Tue, 8 Nov 2022 12:41:09 -0500 Subject: [PATCH 1/7] Fix issue with submodules looking at other submodule class files --- pom.xml | 2 +- .../com/github/surpsg/DiffCoverageMojo.kt | 17 +++++++++++++++-- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/pom.xml b/pom.xml index 8cb9658..39acf3d 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ diff-coverage-maven-plugin ${project.groupId}:${project.artifactId} maven-plugin - 0.3.1 + 0.3.2 Diff coverage maven plugin builds code coverage report of new and modified code based on a provided diff diff --git a/src/main/kotlin/com/github/surpsg/DiffCoverageMojo.kt b/src/main/kotlin/com/github/surpsg/DiffCoverageMojo.kt index 396a7ec..2133006 100644 --- a/src/main/kotlin/com/github/surpsg/DiffCoverageMojo.kt +++ b/src/main/kotlin/com/github/surpsg/DiffCoverageMojo.kt @@ -52,6 +52,18 @@ class DiffCoverageMojo : AbstractMojo() { logPluginProperties(this) } + var found = false + for (f in diffCoverageConfig.execFiles) { + if (f.isFile) { + found = true + break + } + } + if (!found) { + log.info("No exec files found skipping") + return + } + ReportGenerator(rootProjectDir, diffCoverageConfig).apply { val reportDir = File(diffCoverageConfig.reportsConfig.baseReportDir) reportDir.mkdirs() @@ -150,7 +162,8 @@ class DiffCoverageMojo : AbstractMojo() { val includePattern: String = includes.joinToString(",") val excludePattern: String = excludes.joinToString(",") return if (excludePattern.isEmpty() && includePattern == ALL_FILES_PATTERN) { - reactorProjects.map { File(it.build.outputDirectory) }.toSet() + reactorProjects.map { File(it.build.outputDirectory) } + .filter { outputDirectory -> outputDirectory.path.contains(rootProjectDir.path)}.toSet() } else { collectFilteredFiles(includePattern, excludePattern) } @@ -159,7 +172,7 @@ class DiffCoverageMojo : AbstractMojo() { private fun collectFilteredFiles(includePattern: String, excludePattern: String?): Set { return reactorProjects.asSequence() .map { project -> File(project.build.outputDirectory) } - .filter { outputDirectory -> outputDirectory.exists() } + .filter { outputDirectory -> outputDirectory.exists() && outputDirectory.path.contains(rootProjectDir.path)} .flatMap { outputDirectory -> FileUtils.getFiles( outputDirectory, From 22572a52dff1cfb0730f55451e7656ee4c36d9a8 Mon Sep 17 00:00:00 2001 From: rrourke Date: Tue, 8 Nov 2022 15:29:35 -0500 Subject: [PATCH 2/7] use the maven project that is running base url --- src/main/kotlin/com/github/surpsg/DiffCoverageMojo.kt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/kotlin/com/github/surpsg/DiffCoverageMojo.kt b/src/main/kotlin/com/github/surpsg/DiffCoverageMojo.kt index 2133006..81976aa 100644 --- a/src/main/kotlin/com/github/surpsg/DiffCoverageMojo.kt +++ b/src/main/kotlin/com/github/surpsg/DiffCoverageMojo.kt @@ -20,6 +20,9 @@ class DiffCoverageMojo : AbstractMojo() { @Parameter(property = "reactorProjects", required = true, readonly = true) private lateinit var reactorProjects: MutableList + @Parameter(property = "project", required = true, readonly = true) + private lateinit var project: MavenProject + @Parameter(property = "jacoco.dataFile", defaultValue = "\${project.build.directory}/jacoco.exec") private lateinit var dataFile: File @@ -45,7 +48,7 @@ class DiffCoverageMojo : AbstractMojo() { private var violations = ViolationsConfiguration() private val rootProjectDir: File - get() = reactorProjects[0].basedir + get() = project.basedir; override fun execute() { val diffCoverageConfig: DiffCoverageConfig = buildDiffCoverageConfig().apply { From 57fd06a363f2f6a15b7e269566959427f2816dea Mon Sep 17 00:00:00 2001 From: rrourke Date: Tue, 8 Nov 2022 16:33:20 -0500 Subject: [PATCH 3/7] remove semicolon --- src/main/kotlin/com/github/surpsg/DiffCoverageMojo.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/kotlin/com/github/surpsg/DiffCoverageMojo.kt b/src/main/kotlin/com/github/surpsg/DiffCoverageMojo.kt index 81976aa..b2d8fc5 100644 --- a/src/main/kotlin/com/github/surpsg/DiffCoverageMojo.kt +++ b/src/main/kotlin/com/github/surpsg/DiffCoverageMojo.kt @@ -48,7 +48,7 @@ class DiffCoverageMojo : AbstractMojo() { private var violations = ViolationsConfiguration() private val rootProjectDir: File - get() = project.basedir; + get() = project.basedir override fun execute() { val diffCoverageConfig: DiffCoverageConfig = buildDiffCoverageConfig().apply { From db7d5c94c59c271e3ea2cbcf2dcb2e4d33e4be1c Mon Sep 17 00:00:00 2001 From: rrourke Date: Tue, 15 Nov 2022 15:01:05 -0500 Subject: [PATCH 4/7] fix tests --- pom.xml | 31 +++- src/it/exclude-classes/pom.xml | 1 - src/it/excluded-all-classes/pom.xml | 1 - src/it/include-classes/pom.xml | 1 - src/it/include-exclude-classes/pom.xml | 1 - .../report/pom.xml | 24 +++ .../verify.bsh | 6 +- .../moduleA/pom.xml | 25 +++ .../moduleB/pom.xml | 24 +++ .../pom.xml | 1 - .../report/diffFile.patch | 44 ----- .../report/pom.xml | 54 ------- .../verify.bsh | 36 +++-- src/it/multi-project-check/B/pom.xml | 42 +++++ .../main/java/com/example/b/BApplication.java | 24 +++ .../java/com/example/b/BApplicationTests.java | 27 ++++ src/it/multi-project-check/C/pom.xml | 42 +++++ .../main/java/com/example/c/CApplication.java | 13 ++ .../java/com/example/c/CApplicationTests.java | 13 ++ src/it/multi-project-check/pom.xml | 151 ++++++++++++++++++ src/it/multi-project-check/verify.bsh | 15 ++ 21 files changed, 454 insertions(+), 122 deletions(-) delete mode 100644 src/it/multi-module-reports-generation-check/report/diffFile.patch delete mode 100644 src/it/multi-module-reports-generation-check/report/pom.xml create mode 100644 src/it/multi-project-check/B/pom.xml create mode 100644 src/it/multi-project-check/B/src/main/java/com/example/b/BApplication.java create mode 100644 src/it/multi-project-check/B/src/test/java/com/example/b/BApplicationTests.java create mode 100644 src/it/multi-project-check/C/pom.xml create mode 100644 src/it/multi-project-check/C/src/main/java/com/example/c/CApplication.java create mode 100644 src/it/multi-project-check/C/src/test/java/com/example/c/CApplicationTests.java create mode 100644 src/it/multi-project-check/pom.xml create mode 100644 src/it/multi-project-check/verify.bsh diff --git a/pom.xml b/pom.xml index 39acf3d..4c2b17d 100644 --- a/pom.xml +++ b/pom.xml @@ -40,17 +40,25 @@ jitpack.io https://jitpack.io + + sunnylabs-public + Wavefront Internal Repository + https://repo.wavefront.com/content/groups/public/ + + true + + + true + + - ossrh - https://oss.sonatype.org/content/repositories/snapshots + sunnylabs-snapshots + Snapshot Repository + https://repo.wavefront.com/content/repositories/snapshots/ - - ossrh - https://oss.sonatype.org/service/local/staging/deploy/maven2/ - @@ -70,6 +78,17 @@ JCenter https://jcenter.bintray.com/ + + sunnylabs-public + Wavefront Internal Repository + https://repo.wavefront.com/content/groups/public/ + + true + + + true + + diff --git a/src/it/exclude-classes/pom.xml b/src/it/exclude-classes/pom.xml index 3e68991..c2f4a1f 100644 --- a/src/it/exclude-classes/pom.xml +++ b/src/it/exclude-classes/pom.xml @@ -38,7 +38,6 @@ com.github.surpsg diff-coverage-maven-plugin - 0.3.0 diffFile.patch diff --git a/src/it/excluded-all-classes/pom.xml b/src/it/excluded-all-classes/pom.xml index e52b3ab..a7a33ba 100644 --- a/src/it/excluded-all-classes/pom.xml +++ b/src/it/excluded-all-classes/pom.xml @@ -38,7 +38,6 @@ com.github.surpsg diff-coverage-maven-plugin - 0.3.0 diffFile.patch diff --git a/src/it/include-classes/pom.xml b/src/it/include-classes/pom.xml index f863659..95f74d1 100644 --- a/src/it/include-classes/pom.xml +++ b/src/it/include-classes/pom.xml @@ -38,7 +38,6 @@ com.github.surpsg diff-coverage-maven-plugin - 0.3.0 diffFile.patch diff --git a/src/it/include-exclude-classes/pom.xml b/src/it/include-exclude-classes/pom.xml index bea4447..a77c0fb 100644 --- a/src/it/include-exclude-classes/pom.xml +++ b/src/it/include-exclude-classes/pom.xml @@ -38,7 +38,6 @@ com.github.surpsg diff-coverage-maven-plugin - 0.3.0 diffFile.patch diff --git a/src/it/multi-module-reports-exclusions-check/report/pom.xml b/src/it/multi-module-reports-exclusions-check/report/pom.xml index 9cafba2..0d287df 100644 --- a/src/it/multi-module-reports-exclusions-check/report/pom.xml +++ b/src/it/multi-module-reports-exclusions-check/report/pom.xml @@ -53,6 +53,30 @@ + + maven-resources-plugin + 3.0.2 + + + copy-resource-one + package + + copy-resources + + + target + + + ../moduleA/target + + + ../moduleB/target + + + + + + diff --git a/src/it/multi-module-reports-exclusions-check/verify.bsh b/src/it/multi-module-reports-exclusions-check/verify.bsh index 474ef43..ca3fd21 100644 --- a/src/it/multi-module-reports-exclusions-check/verify.bsh +++ b/src/it/multi-module-reports-exclusions-check/verify.bsh @@ -17,9 +17,9 @@ if ( !csvReportFile.exists() || !csvReportFile.isFile() ) { throw new RuntimeException( "CSV report file wasn't found: " + csvReportFile.getAbsolutePath() ); } -String expectedInstructionsErrMsg = "[INFO] New violation: Rule violated for bundle multi-module-reports-exclusions-check: instructions covered ratio is 0.5, but expected minimum is 0.6"; -String expectedLinesErrMsg = "[INFO] New violation: Rule violated for bundle multi-module-reports-exclusions-check: lines covered ratio is 0.5, but expected minimum is 0.7"; -String unexpectedBranchesErrMsg = "[INFO] New violation: Rule violated for bundle multi-module-reports-exclusions-check: branches covered ratio"; +String expectedInstructionsErrMsg = "[INFO] New violation: Rule violated for bundle report: instructions covered ratio is 0.5, but expected minimum is 0.6"; +String expectedLinesErrMsg = "[INFO] New violation: Rule violated for bundle report: lines covered ratio is 0.5, but expected minimum is 0.7"; +String unexpectedBranchesErrMsg = "[INFO] New violation: Rule violated for bundle report: branches covered ratio"; String buildLog = FileUtils.fileRead( new File( basedir, "build.log" ) ); if ( !buildLog.contains( expectedInstructionsErrMsg ) ) { diff --git a/src/it/multi-module-reports-generation-check/moduleA/pom.xml b/src/it/multi-module-reports-generation-check/moduleA/pom.xml index a590d04..461fda7 100644 --- a/src/it/multi-module-reports-generation-check/moduleA/pom.xml +++ b/src/it/multi-module-reports-generation-check/moduleA/pom.xml @@ -11,5 +11,30 @@ it-check-passes 1.0-SNAPSHOT + + + + + com.github.surpsg + diff-coverage-maven-plugin + + + diffFile.patch + + **/custom-jacoco-name.exec + + **/exclude/**/ExcludeMe.class + + + + + + diffCoverage + + + + + + diff --git a/src/it/multi-module-reports-generation-check/moduleB/pom.xml b/src/it/multi-module-reports-generation-check/moduleB/pom.xml index a9db0bf..f515704 100644 --- a/src/it/multi-module-reports-generation-check/moduleB/pom.xml +++ b/src/it/multi-module-reports-generation-check/moduleB/pom.xml @@ -11,4 +11,28 @@ it-check-passes 1.0-SNAPSHOT + + + + com.github.surpsg + diff-coverage-maven-plugin + + + diffFile.patch + + **/custom-jacoco-name.exec + + **/exclude/**/ExcludeMe.class + + + + + + diffCoverage + + + + + + diff --git a/src/it/multi-module-reports-generation-check/pom.xml b/src/it/multi-module-reports-generation-check/pom.xml index ec61614..660d472 100644 --- a/src/it/multi-module-reports-generation-check/pom.xml +++ b/src/it/multi-module-reports-generation-check/pom.xml @@ -25,7 +25,6 @@ moduleA moduleB - report diff --git a/src/it/multi-module-reports-generation-check/report/diffFile.patch b/src/it/multi-module-reports-generation-check/report/diffFile.patch deleted file mode 100644 index f44a2cb..0000000 --- a/src/it/multi-module-reports-generation-check/report/diffFile.patch +++ /dev/null @@ -1,44 +0,0 @@ -Index: src/it/multi-module-reports-generation-check/moduleB/src/main/java/com/test/moduleB/ClassModuleB.java -IDEA additional info: -Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP -<+>UTF-8 -=================================================================== -diff --git a/src/it/multi-module-reports-generation-check/moduleB/src/main/java/com/test/moduleB/ClassModuleB.java b/src/it/multi-module-reports-generation-check/moduleB/src/main/java/com/test/moduleB/ClassModuleB.java -new file mode 100644 ---- /dev/null (date 1628714536415) -+++ b/src/it/multi-module-reports-generation-check/moduleB/src/main/java/com/test/moduleB/ClassModuleB.java (date 1628714536415) -@@ -0,0 +1,12 @@ -+package com.test.moduleB; -+ -+public class ClassModuleB { -+ public void sayHello(boolean a) { -+ if (a) { -+ System.out.println("if"); -+ } else { -+ System.out.println("else"); -+ } -+ System.out.println("return"); -+ } -+} -Index: src/it/multi-module-reports-generation-check/moduleA/src/main/java/com/test/moduleA/ClassModuleA.java -IDEA additional info: -Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP -<+>UTF-8 -=================================================================== -diff --git a/src/it/multi-module-reports-generation-check/moduleA/src/main/java/com/test/moduleA/ClassModuleA.java b/src/it/multi-module-reports-generation-check/moduleA/src/main/java/com/test/moduleA/ClassModuleA.java -new file mode 100644 ---- /dev/null (date 1628714375075) -+++ b/src/it/multi-module-reports-generation-check/moduleA/src/main/java/com/test/moduleA/ClassModuleA.java (date 1628714375075) -@@ -0,0 +1,12 @@ -+package com.test.moduleA; -+ -+public class ClassModuleA { -+ public void sayHello(boolean a) { -+ if (a) { -+ System.out.println("if"); -+ } else { -+ System.out.println("else"); -+ } -+ System.out.println("return"); -+ } -+} diff --git a/src/it/multi-module-reports-generation-check/report/pom.xml b/src/it/multi-module-reports-generation-check/report/pom.xml deleted file mode 100644 index f6ef936..0000000 --- a/src/it/multi-module-reports-generation-check/report/pom.xml +++ /dev/null @@ -1,54 +0,0 @@ - - - - 4.0.0 - - it-check-passes-report - 1.0-SNAPSHOT - pom - - - jacoco - it-check-passes - 1.0-SNAPSHOT - - - - - jacoco - it-check-passes-moduleA - 1.0-SNAPSHOT - - - jacoco - it-check-passes-moduleB - 1.0-SNAPSHOT - - - - - - - com.github.surpsg - diff-coverage-maven-plugin - - - diffFile.patch - - **/custom-jacoco-name.exec - - **/exclude/**/ExcludeMe.class - - - - - - diffCoverage - - - - - - - diff --git a/src/it/multi-module-reports-generation-check/verify.bsh b/src/it/multi-module-reports-generation-check/verify.bsh index 94eeb26..843e7ad 100644 --- a/src/it/multi-module-reports-generation-check/verify.bsh +++ b/src/it/multi-module-reports-generation-check/verify.bsh @@ -1,18 +1,34 @@ import java.io.*; import org.codehaus.plexus.util.*; -File reportsDir = new File(basedir, "/report/target/site/diffCoverage"); -File htmlReportDir = new File( reportsDir, "/html" ); -if ( !htmlReportDir.exists() || !htmlReportDir.isDirectory() ) { - throw new RuntimeException( "Html report dir wasn't found: " + htmlReportDir.getAbsolutePath() ); +File moduleADir = new File(basedir, "/moduleA/target/site/diffCoverage"); +File htmlModuleADir = new File( moduleADir, "/html" ); +if ( !htmlModuleADir.exists() || !htmlModuleADir.isDirectory() ) { + throw new RuntimeException( "Html report dir wasn't found: " + htmlModuleADir.getAbsolutePath() ); } -File xmlReportFile = new File( reportsDir, "diff-coverage.xml" ); -if ( !xmlReportFile.exists() || !xmlReportFile.isFile() ) { - throw new RuntimeException( "Xml report file wasn't found: " + xmlReportFile.getAbsolutePath() ); +File xmlModuleAFile = new File( moduleADir, "diff-coverage.xml" ); +if ( !xmlModuleAFile.exists() || !xmlModuleAFile.isFile() ) { + throw new RuntimeException( "Xml report file wasn't found: " + xmlModuleAFile.getAbsolutePath() ); } -File csvReportFile = new File( reportsDir, "diff-coverage.csv" ); -if ( !csvReportFile.exists() || !csvReportFile.isFile() ) { - throw new RuntimeException( "CSV report file wasn't found: " + csvReportFile.getAbsolutePath() ); +File csvModuleAFile = new File( moduleADir, "diff-coverage.csv" ); +if ( !csvModuleAFile.exists() || !csvModuleAFile.isFile() ) { + throw new RuntimeException( "CSV report file wasn't found: " + csvModuleAFile.getAbsolutePath() ); } + +File moduleBDir = new File(basedir, "/moduleB/target/site/diffCoverage"); +File htmlModuleBDir = new File( moduleBDir, "/html" ); +if ( !htmlModuleBDir.exists() || !htmlModuleBDir.isDirectory() ) { + throw new RuntimeException( "Html report dir wasn't found: " + htmlModuleBDir.getAbsolutePath() ); +} + +File xmlModuleBFile = new File( moduleBDir, "diff-coverage.xml" ); +if ( !xmlModuleBFile.exists() || !xmlModuleBFile.isFile() ) { + throw new RuntimeException( "Xml report file wasn't found: " + xmlModuleBFile.getAbsolutePath() ); +} + +File csvModuleBFile = new File( moduleBDir, "diff-coverage.csv" ); +if ( !csvModuleBFile.exists() || !csvModuleBFile.isFile() ) { + throw new RuntimeException( "CSV report file wasn't found: " + csvModuleBFile.getAbsolutePath() ); +} \ No newline at end of file diff --git a/src/it/multi-project-check/B/pom.xml b/src/it/multi-project-check/B/pom.xml new file mode 100644 index 0000000..a450998 --- /dev/null +++ b/src/it/multi-project-check/B/pom.xml @@ -0,0 +1,42 @@ + + + 4.0.0 + + com.example + demo + 0.0.1-SNAPSHOT + + com.example + B + 0.0.1-SNAPSHOT + B + B + + 11 + + + + org.springframework.boot + spring-boot-starter + 2.7.0 + + + + org.springframework.boot + spring-boot-starter-test + 2.7.0 + test + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + + diff --git a/src/it/multi-project-check/B/src/main/java/com/example/b/BApplication.java b/src/it/multi-project-check/B/src/main/java/com/example/b/BApplication.java new file mode 100644 index 0000000..20737f6 --- /dev/null +++ b/src/it/multi-project-check/B/src/main/java/com/example/b/BApplication.java @@ -0,0 +1,24 @@ +package com.example.b; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class BApplication { + + public static void main(String[] args) { + SpringApplication.run(BApplication.class, args); + } + + + + + public int A() { + return 1; + } + + public int test() { + return 2; + } + +} diff --git a/src/it/multi-project-check/B/src/test/java/com/example/b/BApplicationTests.java b/src/it/multi-project-check/B/src/test/java/com/example/b/BApplicationTests.java new file mode 100644 index 0000000..28ba389 --- /dev/null +++ b/src/it/multi-project-check/B/src/test/java/com/example/b/BApplicationTests.java @@ -0,0 +1,27 @@ +package com.example.b; + +import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import sun.jvm.hotspot.utilities.Assert; + +import static org.junit.jupiter.api.Assertions.assertEquals; + + +@SpringBootTest +class BApplicationTests { + + @Autowired + private BApplication b; + + @Test + void contextLoads() { + } + + @Test + public void doesItWork() { + assertEquals(1, b.A()); + assertEquals(2, b.test()); + } + +} diff --git a/src/it/multi-project-check/C/pom.xml b/src/it/multi-project-check/C/pom.xml new file mode 100644 index 0000000..1c2af64 --- /dev/null +++ b/src/it/multi-project-check/C/pom.xml @@ -0,0 +1,42 @@ + + + 4.0.0 + + com.example + demo + 0.0.1-SNAPSHOT + + com.example + C + 0.0.1-SNAPSHOT + C + C + + 11 + + + + org.springframework.boot + spring-boot-starter + 2.7.0 + + + + org.springframework.boot + spring-boot-starter-test + 2.7.0 + test + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + + diff --git a/src/it/multi-project-check/C/src/main/java/com/example/c/CApplication.java b/src/it/multi-project-check/C/src/main/java/com/example/c/CApplication.java new file mode 100644 index 0000000..3dba258 --- /dev/null +++ b/src/it/multi-project-check/C/src/main/java/com/example/c/CApplication.java @@ -0,0 +1,13 @@ +package com.example.c; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class CApplication { + + public static void main(String[] args) { + SpringApplication.run(CApplication.class, args); + } + +} diff --git a/src/it/multi-project-check/C/src/test/java/com/example/c/CApplicationTests.java b/src/it/multi-project-check/C/src/test/java/com/example/c/CApplicationTests.java new file mode 100644 index 0000000..2a78498 --- /dev/null +++ b/src/it/multi-project-check/C/src/test/java/com/example/c/CApplicationTests.java @@ -0,0 +1,13 @@ +package com.example.c; + +import org.junit.jupiter.api.Test; +import org.springframework.boot.test.context.SpringBootTest; + +@SpringBootTest +class CApplicationTests { + + @Test + void contextLoads() { + } + +} diff --git a/src/it/multi-project-check/pom.xml b/src/it/multi-project-check/pom.xml new file mode 100644 index 0000000..b2b1c86 --- /dev/null +++ b/src/it/multi-project-check/pom.xml @@ -0,0 +1,151 @@ + + + 4.0.0 + com.example + demo + 0.0.1-SNAPSHOT + demo + demo + + + B + C + + pom + + + 11 + 6 + 6 + 1.6 + + + + + + org.springframework.boot + spring-boot-starter + 2.7.0 + + + org.springframework.boot + spring-boot-starter + 2.7.0 + + + + + + + org.springframework.boot + spring-boot-starter + 2.7.0 + + + + org.springframework.boot + spring-boot-starter-test + 2.7.0 + test + + + + + + + + org.springframework.boot + spring-boot-starter-test + 2.7.0 + + + + org.springframework.boot + spring-boot-starter + 2.7.0 + + + org.codehaus.mojo + exec-maven-plugin + 1.5.0 + + + org.jacoco + jacoco-maven-plugin + 0.8.7 + + + com.github.surpsg + diff-coverage-maven-plugin + 0.3.0 + + + org.apache.maven.plugins + maven-surefire-plugin + 3.0.0-M4 + + 1.0C + true + @{jacocoArgLine} -Xmx2G --illegal-access=permit + 3 + + + WARN + + true + + logging.properties + + + + + + + + + + org.jacoco + jacoco-maven-plugin + + + prepare-agent + + prepare-agent + + + jacocoArgLine + + com.example.b.* + com.example.c.* + + + + + coverage-report + post-integration-test + + report + + + + + + com.github.surpsg + diff-coverage-maven-plugin + + + diffFile.patch + + + + + + diffCoverage + + + + + + + + diff --git a/src/it/multi-project-check/verify.bsh b/src/it/multi-project-check/verify.bsh new file mode 100644 index 0000000..ca886e4 --- /dev/null +++ b/src/it/multi-project-check/verify.bsh @@ -0,0 +1,15 @@ +import java.io.*; +import org.codehaus.plexus.util.*; + +String expectedInstructionsErrMsg = "[WARNING] Fail on violations: false. Found violations: 0."; + +String unexpectedErrMsg = "[INFO] New violation: Rule violated for bundle "; + +String buildLog = FileUtils.fileRead( new File( basedir, "build.log" ) ); +if ( !buildLog.contains( expectedInstructionsErrMsg ) ) { + throw new RuntimeException( "Expected message: " + expectedInstructionsErrMsg ); +} +if ( buildLog.contains( unexpectedErrMsg ) ) { + throw new RuntimeException( "UnExpected message: " + unexpectedErrMsg ); +} + From 7e0eb8c2216af1abb671fdd060c1944dcfdb224a Mon Sep 17 00:00:00 2001 From: rrourke Date: Tue, 15 Nov 2022 19:16:53 -0500 Subject: [PATCH 5/7] revert maven changes --- pom.xml | 33 +++++++-------------------------- 1 file changed, 7 insertions(+), 26 deletions(-) diff --git a/pom.xml b/pom.xml index 4c2b17d..a292149 100644 --- a/pom.xml +++ b/pom.xml @@ -40,25 +40,17 @@ jitpack.io https://jitpack.io - - sunnylabs-public - Wavefront Internal Repository - https://repo.wavefront.com/content/groups/public/ - - true - - - true - - - sunnylabs-snapshots - Snapshot Repository - https://repo.wavefront.com/content/repositories/snapshots/ + ossrh + https://oss.sonatype.org/content/repositories/snapshots + + ossrh + https://oss.sonatype.org/service/local/staging/deploy/maven2/ + @@ -78,17 +70,6 @@ JCenter https://jcenter.bintray.com/ - - sunnylabs-public - Wavefront Internal Repository - https://repo.wavefront.com/content/groups/public/ - - true - - - true - - @@ -365,4 +346,4 @@ - + \ No newline at end of file From b07799c047071572dcbcdb020f2f500c714c00b9 Mon Sep 17 00:00:00 2001 From: rrourke Date: Thu, 17 Nov 2022 13:54:17 -0500 Subject: [PATCH 6/7] add missing path files --- .../moduleA/diffFile.patch | 44 +++++++++++++++ .../moduleB/diffFile.patch | 44 +++++++++++++++ src/it/multi-project-check/B/diffFile.patch | 55 +++++++++++++++++++ src/it/multi-project-check/C/diffFile.patch | 55 +++++++++++++++++++ src/it/multi-project-check/diffFile.patch | 55 +++++++++++++++++++ 5 files changed, 253 insertions(+) create mode 100644 src/it/multi-module-reports-generation-check/moduleA/diffFile.patch create mode 100644 src/it/multi-module-reports-generation-check/moduleB/diffFile.patch create mode 100644 src/it/multi-project-check/B/diffFile.patch create mode 100644 src/it/multi-project-check/C/diffFile.patch create mode 100644 src/it/multi-project-check/diffFile.patch diff --git a/src/it/multi-module-reports-generation-check/moduleA/diffFile.patch b/src/it/multi-module-reports-generation-check/moduleA/diffFile.patch new file mode 100644 index 0000000..933e258 --- /dev/null +++ b/src/it/multi-module-reports-generation-check/moduleA/diffFile.patch @@ -0,0 +1,44 @@ +Index: src/it/multi-module-reports-generation-check/moduleB/src/main/java/com/test/moduleB/ClassModuleB.java +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +diff --git a/src/it/multi-module-reports-generation-check/moduleB/src/main/java/com/test/moduleB/ClassModuleB.java b/src/it/multi-module-reports-generation-check/moduleB/src/main/java/com/test/moduleB/ClassModuleB.java +new file mode 100644 +--- /dev/null (date 1628714536415) ++++ b/src/it/multi-module-reports-generation-check/moduleB/src/main/java/com/test/moduleB/ClassModuleB.java (date 1628714536415) +@@ -0,0 +1,12 @@ ++package com.test.moduleB; ++ ++public class ClassModuleB { ++ public void sayHello(boolean a) { ++ if (a) { ++ System.out.println("if"); ++ } else { ++ System.out.println("else"); ++ } ++ System.out.println("return"); ++ } ++} +Index: src/it/multi-module-reports-generation-check/moduleA/src/main/java/com/test/moduleA/ClassModuleA.java +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +diff --git a/src/it/multi-module-reports-generation-check/moduleA/src/main/java/com/test/moduleA/ClassModuleA.java b/src/it/multi-module-reports-generation-check/moduleA/src/main/java/com/test/moduleA/ClassModuleA.java +new file mode 100644 +--- /dev/null (date 1628714375075) ++++ b/src/it/multi-module-reports-generation-check/moduleA/src/main/java/com/test/moduleA/ClassModuleA.java (date 1628714375075) +@@ -0,0 +1,12 @@ ++package com.test.moduleA; ++ ++public class ClassModuleA { ++ public void sayHello(boolean a) { ++ if (a) { ++ System.out.println("if"); ++ } else { ++ System.out.println("else"); ++ } ++ System.out.println("return"); ++ } ++} \ No newline at end of file diff --git a/src/it/multi-module-reports-generation-check/moduleB/diffFile.patch b/src/it/multi-module-reports-generation-check/moduleB/diffFile.patch new file mode 100644 index 0000000..933e258 --- /dev/null +++ b/src/it/multi-module-reports-generation-check/moduleB/diffFile.patch @@ -0,0 +1,44 @@ +Index: src/it/multi-module-reports-generation-check/moduleB/src/main/java/com/test/moduleB/ClassModuleB.java +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +diff --git a/src/it/multi-module-reports-generation-check/moduleB/src/main/java/com/test/moduleB/ClassModuleB.java b/src/it/multi-module-reports-generation-check/moduleB/src/main/java/com/test/moduleB/ClassModuleB.java +new file mode 100644 +--- /dev/null (date 1628714536415) ++++ b/src/it/multi-module-reports-generation-check/moduleB/src/main/java/com/test/moduleB/ClassModuleB.java (date 1628714536415) +@@ -0,0 +1,12 @@ ++package com.test.moduleB; ++ ++public class ClassModuleB { ++ public void sayHello(boolean a) { ++ if (a) { ++ System.out.println("if"); ++ } else { ++ System.out.println("else"); ++ } ++ System.out.println("return"); ++ } ++} +Index: src/it/multi-module-reports-generation-check/moduleA/src/main/java/com/test/moduleA/ClassModuleA.java +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +diff --git a/src/it/multi-module-reports-generation-check/moduleA/src/main/java/com/test/moduleA/ClassModuleA.java b/src/it/multi-module-reports-generation-check/moduleA/src/main/java/com/test/moduleA/ClassModuleA.java +new file mode 100644 +--- /dev/null (date 1628714375075) ++++ b/src/it/multi-module-reports-generation-check/moduleA/src/main/java/com/test/moduleA/ClassModuleA.java (date 1628714375075) +@@ -0,0 +1,12 @@ ++package com.test.moduleA; ++ ++public class ClassModuleA { ++ public void sayHello(boolean a) { ++ if (a) { ++ System.out.println("if"); ++ } else { ++ System.out.println("else"); ++ } ++ System.out.println("return"); ++ } ++} \ No newline at end of file diff --git a/src/it/multi-project-check/B/diffFile.patch b/src/it/multi-project-check/B/diffFile.patch new file mode 100644 index 0000000..462ed84 --- /dev/null +++ b/src/it/multi-project-check/B/diffFile.patch @@ -0,0 +1,55 @@ +diff --git a/B/src/main/java/com/example/b/BApplication.java b/B/src/main/java/com/example/b/BApplication.java +index c82bb4d..20737f6 100644 +--- a/B/src/main/java/com/example/b/BApplication.java ++++ b/B/src/main/java/com/example/b/BApplication.java +@@ -17,4 +17,8 @@ public class BApplication { + return 1; + } + ++ public int test() { ++ return 2; ++ } ++ + } +diff --git a/B/src/test/java/com/example/b/BApplicationTests.java b/B/src/test/java/com/example/b/BApplicationTests.java +index 0ec3368..28ba389 100644 +--- a/B/src/test/java/com/example/b/BApplicationTests.java ++++ b/B/src/test/java/com/example/b/BApplicationTests.java +@@ -21,7 +21,7 @@ class BApplicationTests { + @Test + public void doesItWork() { + assertEquals(1, b.A()); +- System.out.println("HEREIAMONCEAGAIN\n\n\n\n\n\n\n\n\n\n\n"); ++ assertEquals(2, b.test()); + } + + } +diff --git a/pom.xml b/pom.xml +index 52c8385..8b1cad2 100644 +--- a/pom.xml ++++ b/pom.xml +@@ -77,7 +77,7 @@ + + com.github.surpsg + diff-coverage-maven-plugin +- 0.3.2-SNAPSHOT ++ 0.3.1 + + + org.apache.maven.plugins +@@ -101,6 +101,7 @@ + + + ++ + + + org.jacoco +@@ -136,7 +137,6 @@ + + diffCoverage + +- github + + + diff --git a/src/it/multi-project-check/C/diffFile.patch b/src/it/multi-project-check/C/diffFile.patch new file mode 100644 index 0000000..462ed84 --- /dev/null +++ b/src/it/multi-project-check/C/diffFile.patch @@ -0,0 +1,55 @@ +diff --git a/B/src/main/java/com/example/b/BApplication.java b/B/src/main/java/com/example/b/BApplication.java +index c82bb4d..20737f6 100644 +--- a/B/src/main/java/com/example/b/BApplication.java ++++ b/B/src/main/java/com/example/b/BApplication.java +@@ -17,4 +17,8 @@ public class BApplication { + return 1; + } + ++ public int test() { ++ return 2; ++ } ++ + } +diff --git a/B/src/test/java/com/example/b/BApplicationTests.java b/B/src/test/java/com/example/b/BApplicationTests.java +index 0ec3368..28ba389 100644 +--- a/B/src/test/java/com/example/b/BApplicationTests.java ++++ b/B/src/test/java/com/example/b/BApplicationTests.java +@@ -21,7 +21,7 @@ class BApplicationTests { + @Test + public void doesItWork() { + assertEquals(1, b.A()); +- System.out.println("HEREIAMONCEAGAIN\n\n\n\n\n\n\n\n\n\n\n"); ++ assertEquals(2, b.test()); + } + + } +diff --git a/pom.xml b/pom.xml +index 52c8385..8b1cad2 100644 +--- a/pom.xml ++++ b/pom.xml +@@ -77,7 +77,7 @@ + + com.github.surpsg + diff-coverage-maven-plugin +- 0.3.2-SNAPSHOT ++ 0.3.1 + + + org.apache.maven.plugins +@@ -101,6 +101,7 @@ + + + ++ + + + org.jacoco +@@ -136,7 +137,6 @@ + + diffCoverage + +- github + + + diff --git a/src/it/multi-project-check/diffFile.patch b/src/it/multi-project-check/diffFile.patch new file mode 100644 index 0000000..462ed84 --- /dev/null +++ b/src/it/multi-project-check/diffFile.patch @@ -0,0 +1,55 @@ +diff --git a/B/src/main/java/com/example/b/BApplication.java b/B/src/main/java/com/example/b/BApplication.java +index c82bb4d..20737f6 100644 +--- a/B/src/main/java/com/example/b/BApplication.java ++++ b/B/src/main/java/com/example/b/BApplication.java +@@ -17,4 +17,8 @@ public class BApplication { + return 1; + } + ++ public int test() { ++ return 2; ++ } ++ + } +diff --git a/B/src/test/java/com/example/b/BApplicationTests.java b/B/src/test/java/com/example/b/BApplicationTests.java +index 0ec3368..28ba389 100644 +--- a/B/src/test/java/com/example/b/BApplicationTests.java ++++ b/B/src/test/java/com/example/b/BApplicationTests.java +@@ -21,7 +21,7 @@ class BApplicationTests { + @Test + public void doesItWork() { + assertEquals(1, b.A()); +- System.out.println("HEREIAMONCEAGAIN\n\n\n\n\n\n\n\n\n\n\n"); ++ assertEquals(2, b.test()); + } + + } +diff --git a/pom.xml b/pom.xml +index 52c8385..8b1cad2 100644 +--- a/pom.xml ++++ b/pom.xml +@@ -77,7 +77,7 @@ + + com.github.surpsg + diff-coverage-maven-plugin +- 0.3.2-SNAPSHOT ++ 0.3.1 + + + org.apache.maven.plugins +@@ -101,6 +101,7 @@ + + + ++ + + + org.jacoco +@@ -136,7 +137,6 @@ + + diffCoverage + +- github + + + From 042281633aed64aee834f4c357a5e82a88c2672a Mon Sep 17 00:00:00 2001 From: rrourke Date: Mon, 12 Feb 2024 13:05:47 -0500 Subject: [PATCH 7/7] fixes --- pom.xml | 34 +++++++++++++++++++++++----------- 1 file changed, 23 insertions(+), 11 deletions(-) diff --git a/pom.xml b/pom.xml index a292149..35d0cd8 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ diff-coverage-maven-plugin ${project.groupId}:${project.artifactId} maven-plugin - 0.3.2 + 0.3.2.2 Diff coverage maven plugin builds code coverage report of new and modified code based on a provided diff @@ -55,13 +55,19 @@ UTF-8 + official + HEAD + + 3.9.4 + 3.9.0 + 1.4.32 true - official 4.13.2 - 3.8.6 - HEAD + 0.8.10 + 0.9.5 + 0.3.2 @@ -82,7 +88,7 @@ org.apache.maven.plugin-tools maven-plugin-annotations - 3.6.4 + ${maven.plugin.tools.version} provided @@ -107,17 +113,17 @@ com.github.form-com.diff-coverage-gradle jacoco-filtering-extension - 0.9.5 + ${delt.coverage.core.version} org.jacoco org.jacoco.core - 0.8.8 + ${jacoco.version} org.jacoco org.jacoco.report - 0.8.8 + ${jacoco.version} org.eclipse.jgit @@ -125,6 +131,12 @@ 6.2.0.202206071550-r + + org.codehaus.plexus + plexus-utils + 3.5.1 + + junit junit @@ -159,13 +171,13 @@ org.apache.maven.plugins maven-plugin-plugin - 3.6.4 + ${maven.plugin.tools.version} org.jacoco jacoco-maven-plugin - 0.8.8 + ${jacoco.version} pre-unit-test @@ -257,7 +269,7 @@ com.github.surpsg diff-coverage-maven-plugin - 0.3.0 + ${diff.coverage.plugin.version} ${project.build.directory}/fullCoverage.exec