diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 9ad4dea571b42157b874a8fb8af07c65f90a9ed6..dff940111ec350534a31a00fcd12117c761981c6 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -14,7 +14,7 @@ variables: GRADLE_OPTS: "-Dorg.gradle.daemon=false" TEST_REPORTS: "eraser-base/build/reports/tests/" TEST_LOG: "eraser-base/logs/eraser-test.log" - JACOCO_REPORT: "eraser-base/build/reports/jacoco/test/jacocoTestReport.xml" + JACOCO_REPORT: "*/build/reports/jacoco/all-tests/jacocoTestReport.xml" # settings for influxdb INFLUXDB_DB: "jastaddHistory" INFLUXDB_USER: "root" @@ -32,7 +32,7 @@ build: image: openjdk:8 stage: build script: - - ./gradlew --console=plain --build-cache assemble + - ./gradlew --console=plain assemble artifacts: paths: - "eraser-base/src/gen" @@ -50,7 +50,7 @@ test: needs: - build script: - - ./gradlew --continue --console=plain --info allTests jacocoTestReport + - ./gradlew --console=plain --info allTests artifacts: when: always paths: diff --git a/buildSrc/src/main/groovy/eraser.java-common-conventions.gradle b/buildSrc/src/main/groovy/eraser.java-common-conventions.gradle index 96d9e23ecd2a9d5750d9bd534bb884a2a066b910..d74d31f0b55eb2523033a65bb96a80eb24a8ca60 100644 --- a/buildSrc/src/main/groovy/eraser.java-common-conventions.gradle +++ b/buildSrc/src/main/groovy/eraser.java-common-conventions.gradle @@ -2,6 +2,7 @@ plugins { id 'java' id 'idea' id 'com.github.ben-manes.versions' + id 'jacoco' } repositories { @@ -30,3 +31,19 @@ task allTests(type: Test, dependsOn: testClasses) { includeTags 'mqtt | influx' } } + +// extension for all Test tasks similar to https://stackoverflow.com/a/57330075/2493208 +jacocoTestReport { + executionData tasks.withType(Test).findAll { it.state.executed } + getExecutionData().setFrom(fileTree(buildDir).include("/jacoco/*.exec")) + + reports { + xml.enabled true + xml.destination(file("${jacoco.reportsDir}/all-tests/jacocoAllTestReport.xml")) + html.enabled false + } +} + +tasks.withType(Test) { + finalizedBy jacocoTestReport +} diff --git a/eraser-base/build.gradle b/eraser-base/build.gradle index ea7aebfe4b2467cb074c1d4d23a256f2e1e3b8c5..75c4c27c466bb8f89a14b9174e4e8d29af2dc4dd 100644 --- a/eraser-base/build.gradle +++ b/eraser-base/build.gradle @@ -9,7 +9,6 @@ buildscript { plugins { id 'eraser.java-application-conventions' id 'eraser.java-jastadd-conventions' - id 'jacoco' } apply plugin: 'jastadd' @@ -30,16 +29,6 @@ application { mainClass = 'de.tudresden.inf.st.eraser.Main' } -// extension for all Test tasks similar to https://stackoverflow.com/a/57330075/2493208 -jacocoTestReport { - executionData tasks.withType(Test).findAll { it.state.executed } - reports { - xml.enabled true - xml.destination(file("${jacoco.reportsDir}/all-tests/jacocoAllTestReport.xml")) - html.enabled false - } -} - def relastFiles = fileTree('src/main/jastadd/') { include '**/*.relast' }.toList().toArray() String[] relastArguments = [