Add coverage aggregation 31/79831/2
authorRobert Varga <robert.varga@pantheon.tech>
Tue, 22 Jan 2019 23:18:15 +0000 (00:18 +0100)
committerRobert Varga <nite@hq.sk>
Wed, 23 Jan 2019 07:05:30 +0000 (07:05 +0000)
This recognizes sonar build and runs jacoco report aggregation,
so that test coverage across modules is accounted for.

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

diff --git a/pom.xml b/pom.xml
index 2f7da37091308fbe4efcf7f9d338809b8de34e86..3e94309d10278fd41d39dfdf6233e37afc13e9cd 100644 (file)
--- a/pom.xml
+++ b/pom.xml
@@ -81,6 +81,42 @@ and is available at http://www.eclipse.org/legal/epl-v10.html
             <!-- When enabled, this empty profile disables the “sfc” profile above -->
             <id>no-sfc</id>
         </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>
 
     <!-- DO NOT install or deploy the repo root pom as it's only needed to initiate a build -->