<?xml version="1.0" encoding="UTF-8"?>
<!--
  ~ Licensed to the Apache Software Foundation (ASF) under one
  ~ or more contributor license agreements.  See the NOTICE file
  ~ distributed with this work for additional information
  ~ regarding copyright ownership.  The ASF licenses this file
  ~ to you under the Apache License, Version 2.0 (the
  ~ "License"); you may not use this file except in compliance
  ~ with the License.  You may obtain a copy of the License at
  ~
  ~   http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~ Unless required by applicable law or agreed to in writing,
  ~ software distributed under the License is distributed on an
  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  ~ KIND, either express or implied.  See the License for the
  ~ specific language governing permissions and limitations
  ~ under the License.
  -->

<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <parent>
        <groupId>io.kestros.commons</groupId>
        <artifactId>kestros-root-project</artifactId>
        <version>0.2.3</version>
    </parent>

    <groupId>io.kestros.commons</groupId>
    <artifactId>kestros-parent</artifactId>
    <version>0.3.3</version>

    <name>Kestros Parent</name>
    <description>Base Sling project build manager. Contains dependency and plugin versions for
        building and installing Bundles and Packages to Sling instances.
    </description>
    <packaging>pom</packaging>

    <build>
        <pluginManagement>
            <plugins>
                <!-- Mutation Testing -->
                <plugin>
                    <groupId>org.pitest</groupId>
                    <artifactId>pitest-maven</artifactId>
                    <version>1.15.2</version>
                </plugin>

                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-checkstyle-plugin</artifactId>
                    <version>3.1.1</version>
                    <inherited>true</inherited>
                    <dependencies>
                        <dependency>
                            <groupId>io.kestros.commons</groupId>
                            <artifactId>kestros-build-tools</artifactId>
                            <version>[0.2.2,1.0.0]</version>
                        </dependency>
                    </dependencies>
                    <executions>
                        <execution>
                            <id>validate</id>
                            <phase>validate</phase>
                            <goals>
                                <goal>check</goal>
                            </goals>
                            <configuration>
                                <configLocation>checkstyle.xml</configLocation>
                                <encoding>UTF-8</encoding>
                                <consoleOutput>true</consoleOutput>
                                <failsOnError>true</failsOnError>
                                <failOnViolation>true</failOnViolation>
                                <violationSeverity>warning</violationSeverity>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>

                <plugin>
                    <groupId>com.github.spotbugs</groupId>
                    <artifactId>spotbugs-maven-plugin</artifactId>
                    <version>4.7.2.1</version>
                    <dependencies>
                        <!-- overwrite dependency on spotbugs if you want to specify the version of spotbugs -->
                        <dependency>
                            <groupId>com.github.spotbugs</groupId>
                            <artifactId>spotbugs</artifactId>
                            <version>4.7.3</version>
                        </dependency>
                    </dependencies>
                    <configuration>
                        <plugins>
                            <plugin>
                                <groupId>com.h3xstream.findsecbugs</groupId>
                                <artifactId>findsecbugs-plugin</artifactId>
                                <version>1.12.0</version>
                            </plugin>
                            <plugin>
                                <groupId>com.mebigfatguy.fb-contrib</groupId>
                                <artifactId>fb-contrib</artifactId>
                                <version>7.6.4</version>
                            </plugin>
                            <plugin>
                                <groupId>io.kestros.commons</groupId>
                                <artifactId>kestros-spotbugs-plugins</artifactId>
                                <version>RELEASE</version>
                            </plugin>
                        </plugins>
                        <effort>Max</effort>
                        <threshold>Low</threshold>
                        <xmlOutput>true</xmlOutput>
                    </configuration>
                    <executions>
                        <execution>
                            <goals>
                                <goal>check</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>

                <!--                <plugin>-->
                <!--                    <groupId>org.codehaus.mojo</groupId>-->
                <!--                    <artifactId>findbugs-maven-plugin</artifactId>-->
                <!--                    <version>3.0.5</version>-->
                <!--                    <configuration>-->
                <!--                        <effort>Max</effort>-->
                <!--                        <threshold>Low</threshold>-->
                <!--                        <xmlOutput>true</xmlOutput>-->
                <!--                        <failOnError>true</failOnError>-->
                <!--                    </configuration>-->
                <!--                    <executions>-->
                <!--                        <execution>-->
                <!--                            <goals>-->
                <!--                                <goal>check</goal>-->
                <!--                            </goals>-->
                <!--                        </execution>-->
                <!--                    </executions>-->
                <!--                </plugin>-->

                <plugin>
                    <groupId>org.apache.rat</groupId>
                    <artifactId>apache-rat-plugin</artifactId>
                    <version>0.13</version>
                    <configuration>
                        <excludes>
                            <!-- don't check anything in target -->
                            <exclude>target/*</exclude>
                            <!-- Fixing issues with deleted modules -->
                            <exclude>**/target/*</exclude>
                            <exclude>**/target/**/*</exclude>
                            <exclude>**/*.iml</exclude>
                            <exclude>node/**/*</exclude>
                            <exclude>node_modules/**/*</exclude>
                            <exclude>**/README.md</exclude>
                            <exclude>package.json</exclude>
                            <exclude>package-lock.json</exclude>
                            <exclude>*-maven-settings.xml</exclude>
                            <exclude>coverage/**/*</exclude>
                            <exclude>.nyc_output/**/*</exclude>
                            <exclude>.eslintrc.json</exclude>
                            <exclude>.stylelintrc.json</exclude>
                        </excludes>
                    </configuration>
                    <executions>
                        <execution>
                            <phase>validate</phase>
                            <goals>
                                <goal>check</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>

            </plugins>
        </pluginManagement>
    </build>

    <profiles>
        <profile>
            <id>strict</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-checkstyle-plugin</artifactId>
                    </plugin>
                    <plugin>
                        <groupId>com.github.spotbugs</groupId>
                        <artifactId>spotbugs-maven-plugin</artifactId>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.rat</groupId>
                        <artifactId>apache-rat-plugin</artifactId>
                    </plugin>
                    <plugin>
                        <groupId>org.jacoco</groupId>
                        <artifactId>jacoco-maven-plugin</artifactId>
                        <version>0.8.12</version>
                        <executions>
                            <execution>
                                <id>default-prepare-agent</id>
                                <goals>
                                    <goal>prepare-agent</goal>
                                </goals>
                            </execution>
                            <execution>
                                <id>check</id>
                                <goals>
                                    <goal>check</goal>
                                </goals>
                                <configuration>
                                    <rules>
                                        <rule>
                                            <element>BUNDLE</element>
                                            <limits>
                                                <limit>
                                                    <counter>LINE</counter>
                                                    <value>COVEREDRATIO</value>
                                                    <minimum>0.80</minimum>
                                                </limit>
                                                <limit>
                                                    <counter>BRANCH</counter>
                                                    <value>COVEREDRATIO</value>
                                                    <minimum>0.80</minimum>
                                                </limit>
                                            </limits>
                                        </rule>
                                    </rules>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                    <!-- Maven Javadoc -->
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-javadoc-plugin</artifactId>
                        <version>3.1.1</version>
                        <configuration>
                            <source>11</source>
                        </configuration>
                        <executions>
                            <execution>
                                <id>attach-javadocs</id>
                                <goals>
                                    <goal>jar</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>mutationTest</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.pitest</groupId>
                        <artifactId>pitest-maven</artifactId>
                        <version>1.15.2</version>
                        <executions>
                            <execution>
                                <goals>
                                    <goal>mutationCoverage</goal>
                                </goals>
                            </execution>
                        </executions>
                        <configuration>
                            <outputFormats>
                                <outputFormat>XML</outputFormat>
                                <outputFormat>HTML</outputFormat>
                            </outputFormats>
                            <features>
                                <feature>+FLOGCALL</feature>
                            </features>
                            <mutators>
                                <mutator>CONDITIONALS_BOUNDARY</mutator>
                                <mutators>NEGATE_CONDITIONALS</mutators>
                                <mutators>REMOVE_CONDITIONALS</mutators>
                                <mutators>MATH</mutators>
                                <mutators>INCREMENTS</mutators>
                                <mutators>INVERT_NEGS</mutators>
                                <mutators>INLINE_CONSTS</mutators>
                                <!--                                <mutators>RETURN_VALS</mutators>-->
                                <mutators>VOID_METHOD_CALLS</mutators>
                                <mutators>TRUE_RETURNS</mutators>
                                <mutators>FALSE_RETURNS</mutators>
                                <mutators>PRIMITIVE_RETURNS</mutators>
                                <mutators>EMPTY_RETURNS</mutators>
                                <mutators>NULL_RETURNS</mutators>
                                <mutators>NON_VOID_METHOD_CALLS</mutators>
                                <mutators>CONSTRUCTOR_CALLS</mutators>
                                <mutators>EXPERIMENTAL_MEMBER_VARIABLE</mutators>
                                <mutators>EXPERIMENTAL_SWITCH</mutators>
                            </mutators>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>mutationTestStrict</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.pitest</groupId>
                        <artifactId>pitest-maven</artifactId>
                        <version>1.15.2</version>
                        <executions>
                            <execution>
                                <goals>
                                    <goal>mutationCoverage</goal>
                                </goals>
                            </execution>
                        </executions>
                        <configuration>
                            <mutationThreshold>80</mutationThreshold>
                            <outputFormats>
                                <outputFormat>XML</outputFormat>
                                <outputFormat>HTML</outputFormat>
                            </outputFormats>
                            <features>
                                <feature>+FLOGCALL</feature>
                            </features>
                            <mutators>
                                <mutator>CONDITIONALS_BOUNDARY</mutator>
                                <mutators>NEGATE_CONDITIONALS</mutators>
                                <mutators>REMOVE_CONDITIONALS</mutators>
                                <mutators>MATH</mutators>
                                <mutators>INCREMENTS</mutators>
                                <mutators>INVERT_NEGS</mutators>
                                <mutators>INLINE_CONSTS</mutators>
                                <!--                                <mutators>RETURN_VALS</mutators>-->
                                <mutators>VOID_METHOD_CALLS</mutators>
                                <mutators>TRUE_RETURNS</mutators>
                                <mutators>FALSE_RETURNS</mutators>
                                <mutators>PRIMITIVE_RETURNS</mutators>
                                <mutators>EMPTY_RETURNS</mutators>
                                <mutators>NULL_RETURNS</mutators>
                                <mutators>NON_VOID_METHOD_CALLS</mutators>
                                <mutators>CONSTRUCTOR_CALLS</mutators>
                                <mutators>EXPERIMENTAL_MEMBER_VARIABLE</mutators>
                                <mutators>EXPERIMENTAL_SWITCH</mutators>
                            </mutators>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>

    </profiles>

</project>
