File tree Expand file tree Collapse file tree 3 files changed +15
-11
lines changed
marklogic-spark-connector Expand file tree Collapse file tree 3 files changed +15
-11
lines changed Original file line number Diff line number Diff line change 1
1
@Library (' shared-libraries' ) _
2
2
3
+ // Using testCodeCoverageReport from the jacoco-report-aggregation plugin to produce an aggregated code coverage
4
+ // report, even though Sonar doesn't seem to be able to make sense of it yet.
3
5
def runtests (String javaVersion ){
4
6
sh label :' test' , script : ''' #!/bin/bash
5
7
export JAVA_HOME=$''' + javaVersion+ '''
@@ -12,7 +14,7 @@ def runtests(String javaVersion){
12
14
./gradlew -i mlDeploy
13
15
echo "Loading data a second time to try to avoid Optic bug with duplicate rows being returned."
14
16
./gradlew -i mlLoadData
15
- ./gradlew test || true
17
+ ./gradlew testCodeCoverageReport || true
16
18
'''
17
19
junit ' **/build/**/*.xml'
18
20
}
Original file line number Diff line number Diff line change 1
1
plugins {
2
2
id " java-library"
3
- id " jacoco-report-aggregation"
4
3
id " org.sonarqube" version " 5.1.0.4882"
5
4
}
6
5
7
- // See https://docs.gradle.org/current/samples/sample_jvm_multi_project_with_code_coverage_standalone.html .
8
- // This isn't picking up jacoco coverage of all the subprojects. Will figure that out soon.
9
- dependencies {
10
- jacocoAggregation project(' :marklogic-langchain4j' )
11
- jacocoAggregation project(' :marklogic-spark-api' )
12
- jacocoAggregation project(' :marklogic-spark-langchain4j' )
13
- jacocoAggregation project(' :marklogic-spark-connector' )
14
- }
15
-
16
6
sonar {
17
7
properties {
18
8
property " sonar.projectKey" , " marklogic-spark"
19
9
property " sonar.host.url" , " http://localhost:9000"
10
+ property " sonar.coverage.jacoco.xmlReportPaths" , " marklogic-spark-connector/build/reports/jacoco/testCodeCoverageReport/testCodeCoverageReport.xml"
20
11
}
21
12
}
22
13
Original file line number Diff line number Diff line change @@ -3,6 +3,12 @@ plugins {
3
3
id ' com.gradleup.shadow' version ' 8.3.3'
4
4
id " com.marklogic.ml-gradle" version " 5.0.0"
5
5
id ' maven-publish'
6
+
7
+ // This is working in terms of nicely aggregating jacoco code coverage data from each subproject. It produces a very
8
+ // nice HTML report under build/reports/jacoco/testCodeCoverageReport. Unfortunately, Sonar doesn't seem able to get
9
+ // all the coverage data from this directory; it only reports coverage from this project. Something to be figured out
10
+ // later.
11
+ id " jacoco-report-aggregation"
6
12
}
7
13
8
14
configurations {
@@ -26,6 +32,11 @@ configurations.all {
26
32
}
27
33
28
34
dependencies {
35
+ // Adding these forces code coverage data to be calculated for these subprojects.
36
+ jacocoAggregation project(' :marklogic-langchain4j' )
37
+ jacocoAggregation project(' :marklogic-spark-api' )
38
+ jacocoAggregation project(' :marklogic-spark-langchain4j' )
39
+
29
40
// This is compileOnly as any environment this is used in will provide the Spark dependencies itself.
30
41
compileOnly(' org.apache.spark:spark-sql_2.12:' + sparkVersion) {
31
42
// Excluded from our ETL tool for size reasons, so excluded here as well to ensure we don't need it.
You can’t perform that action at this time.
0 commit comments