Add aggragate coverage support 35/78235/2
authorRobert Varga <robert.varga@pantheon.tech>
Tue, 27 Nov 2018 23:31:08 +0000 (00:31 +0100)
committerRobert Varga <robert.varga@pantheon.tech>
Wed, 28 Nov 2018 00:13:44 +0000 (01:13 +0100)
This adds the build-system-side of aggragating jacoco reports
for sonar.

Change-Id: Ia81dbc428e62c530de0cc5cc0ffdeb77d6dee1eb
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
pom.xml

diff --git a/pom.xml b/pom.xml
index 9fd2e116a8337ac9b071d6616557461eb9f4d5f6..df8602e9ec8a7ba8299cbdcf2bdebfba044d830c 100644 (file)
--- a/pom.xml
+++ b/pom.xml
         <module>karaf</module>
       </modules>
     </profile>
+
+    <profile>
+      <id>sonar-jacoco-aggregate</id>
+      <activation>
+        <property>
+          <name>odl.jacoco.aggregateFile</name>
+        </property>
+      </activation>
+      <build>
+        <plugins>
+          <plugin>
+            <groupId>org.jacoco</groupId>
+            <artifactId>jacoco-maven-plugin</artifactId>
+            <executions>
+              <execution>
+                <id>merge</id>
+                <goals>
+                  <goal>merge</goal>
+                </goals>
+                <phase>generate-resources</phase>
+                <configuration>
+                  <destFile>${odl.jacoco.aggregateFile}</destFile>
+                  <fileSets>
+                    <fileSet>
+                      <directory>${project.basedir}</directory>
+                      <includes>
+                        <include>**/target/code-coverage/*.exec</include>
+                      </includes>
+                    </fileSet>
+                  </fileSets>
+                </configuration>
+              </execution>
+            </executions>
+          </plugin>
+        </plugins>
+      </build>
+    </profile>
   </profiles>
 
   <build>