<?xml version="1.0"?>
<!--
Copyright (C) 2013-2020 TU Dortmund
This file is part of LearnLib, http://www.learnlib.de/.

Licensed 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>de.learnlib</groupId>
        <artifactId>learnlib-parent</artifactId>
        <version>0.16.0</version>
        <relativePath>../pom.xml</relativePath>
    </parent>

    <artifactId>learnlib-build-parent</artifactId>
    <packaging>pom</packaging>

    <name>LearnLib :: Build Parent</name>
    <description>
        A utility parent, that defines certain plugin executions for the build process. May be used to define
        dependencies on the "build-tools" artifact without introducing cyclic dependencies with the general parent.
    </description>

    <build>
        <pluginManagement>
            <plugins>
                <!-- If we run coverage analysis, skip generated sources -->
                <plugin>
                    <groupId>org.jacoco</groupId>
                    <artifactId>jacoco-maven-plugin</artifactId>
                    <configuration>
                        <excludes>
                            <!-- generated builders for learning algorithms -->
                            <exclude>**/ADTLearnerBuilder.class</exclude>
                            <exclude>**/MealyDHCBuilder.class</exclude>
                            <exclude>**/DTLearner*Builder.class</exclude>
                            <exclude>**/DTLearnerVPDABuilder.class</exclude>
                            <exclude>**/KearnsVazirani*Builder.class</exclude>
                            <exclude>**/ClassicLStar*Builder.class</exclude>
                            <exclude>**/ExtensibleLStar*Builder.class</exclude>
                            <exclude>**/MalerPnueli*Builder.class</exclude>
                            <exclude>**/RivestSchapire*Builder.class</exclude>
                            <exclude>**/NLStarLearnerBuilder.class</exclude>
                            <exclude>**/TTTLearner*Builder.class</exclude>
                            <exclude>**/TTTLearnerVPDABuilder.class</exclude>

                            <!-- generated refinements for oracles -->
                            <exclude>de/learnlib/filter/statistic/**/DFA*.class</exclude>
                            <exclude>de/learnlib/filter/statistic/**/Mealy*.class</exclude>
                            <exclude>de/learnlib/oracle/emptiness/DFA*.class</exclude>
                            <exclude>de/learnlib/oracle/emptiness/Mealy*.class</exclude>
                            <exclude>de/learnlib/oracle/equivalence/DFA*.class</exclude>
                            <exclude>de/learnlib/oracle/equivalence/Mealy*.class</exclude>
                            <exclude>de/learnlib/oracle/property/DFA*Chain.class</exclude>
                            <exclude>de/learnlib/oracle/property/Mealy*Chain.class</exclude>
                        </excludes>
                    </configuration>
                </plugin>
            </plugins>
        </pluginManagement>
    </build>

    <profiles>
        <profile>
            <id>code-analysis</id>
            <build>
                <pluginManagement>
                    <plugins>
                        <plugin>
                            <groupId>com.github.spotbugs</groupId>
                            <artifactId>spotbugs-maven-plugin</artifactId>
                            <configuration>
                                <excludeFilterFile>/learnlib-spotbugs-exclusions.xml</excludeFilterFile>
                                <effort>Max</effort>
                            </configuration>
                            <dependencies>
                                <dependency>
                                    <groupId>de.learnlib</groupId>
                                    <artifactId>learnlib-build-config</artifactId>
                                    <version>${project.version}</version>
                                </dependency>
                            </dependencies>
                        </plugin>
                        <plugin>
                            <groupId>org.apache.maven.plugins</groupId>
                            <artifactId>maven-pmd-plugin</artifactId>
                            <configuration>
                                <rulesets>
                                    <ruleset>/learnlib-pmd-ruleset.xml</ruleset>
                                </rulesets>
                            </configuration>
                            <dependencies>
                                <dependency>
                                    <groupId>de.learnlib</groupId>
                                    <artifactId>learnlib-build-config</artifactId>
                                    <version>${project.version}</version>
                                </dependency>
                            </dependencies>
                        </plugin>
                        <plugin>
                            <groupId>org.apache.maven.plugins</groupId>
                            <artifactId>maven-checkstyle-plugin</artifactId>
                            <configuration>
                                <configLocation>/automatalib-learnlib-checkstyle.xml</configLocation>
                                <headerLocation>/license-header-java.txt</headerLocation>
                                <suppressionsLocation>/learnlib-checkstyle-suppressions.xml</suppressionsLocation>
                                <includeTestSourceDirectory>true</includeTestSourceDirectory>
                                <linkXRef>false</linkXRef>
                            </configuration>
                            <dependencies>
                                <dependency>
                                    <groupId>com.puppycrawl.tools</groupId>
                                    <artifactId>checkstyle</artifactId>
                                    <version>${checkstyle.version}</version>
                                </dependency>
                                <dependency>
                                    <groupId>de.learnlib</groupId>
                                    <artifactId>learnlib-build-config</artifactId>
                                    <version>${project.version}</version>
                                </dependency>
                            </dependencies>
                        </plugin>
                    </plugins>
                </pluginManagement>
                <plugins>
                    <plugin>
                        <groupId>com.github.spotbugs</groupId>
                        <artifactId>spotbugs-maven-plugin</artifactId>
                        <executions>
                            <execution>
                                <phase>verify</phase>
                                <goals>
                                    <goal>check</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-pmd-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>pmd</id>
                                <phase>verify</phase>
                                <goals>
                                    <goal>check</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-checkstyle-plugin</artifactId>
                        <executions>
                            <execution>
                                <phase>verify</phase>
                                <goals>
                                    <goal>check</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>cf</id>
            <dependencies>
                <!-- utility dependency so that the classloader can correctly resolve annotations -->
                <dependency>
                    <groupId>com.google.code.findbugs</groupId>
                    <artifactId>jsr305</artifactId>
                    <version>${jsr305.version}</version>
                </dependency>
                <dependency>
                    <groupId>com.google.errorprone</groupId>
                    <artifactId>javac</artifactId>
                    <version>${error-prone.version}</version>
                </dependency>
            </dependencies>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-dependency-plugin</artifactId>
                        <executions>
                            <execution>
                                <goals>
                                    <goal>properties</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <artifactId>maven-compiler-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>cf-compile</id>
                                <phase>compile</phase>
                                <goals>
                                    <goal>compile</goal>
                                </goals>
                                <configuration>
                                    <skipMain>${learnlib.java9OrNewer}</skipMain>
                                    <failOnWarning>true</failOnWarning>
                                    <fork>true</fork>
                                    <outputDirectory>${project.build.directory}/checkerframework</outputDirectory>
                                    <annotationProcessorPaths>
                                        <path>
                                            <groupId>org.checkerframework</groupId>
                                            <artifactId>checker</artifactId>
                                            <version>${checkerframework.version}</version>
                                        </path>
                                    </annotationProcessorPaths>
                                    <annotationProcessors>
                                        <annotationProcessor>org.checkerframework.checker.nullness.NullnessChecker</annotationProcessor>
                                    </annotationProcessors>
                                    <compilerArgs>
                                        <arg>-J-Xbootclasspath/p:${com.google.errorprone:javac:jar}</arg>
                                        <arg>-AskipDefs=^de.learnlib.algorithms.adt.*|\
                                                        ^de.learnlib.algorithms.discriminationtree.*.vpda.*|\
                                                        ^de.learnlib.algorithms.ttt.*|\
                                                        ^de.learnlib.datastructure.discriminationtree.*|\
                                        </arg>
                                        <arg>-AskipUses=^de.learnlib.algorithms.adt.*|\
                                                        ^de.learnlib.algorithms.ttt.*|\
                                                        ^de.learnlib.datastructure.discriminationtree.*|\
                                                        ^java.lang.ThreadLocal|\
                                                        ^net.automatalib.*|\
                                                        ^org.testng.*|\
                                        </arg>
                                        <arg>-AsuppressWarnings=uninitialized</arg>
                                        <arg>-AassumeAssertionsAreEnabled</arg>
                                        <arg>-Astubs=jdk8.astub:collection-object-parameters-may-be-null.astub</arg>
                                    </compilerArgs>
                                </configuration>
                            </execution>
                            <execution>
                                <id>cf-test-compile</id>
                                <phase>test-compile</phase>
                                <goals>
                                    <goal>testCompile</goal>
                                </goals>
                                <configuration>
                                    <skip>${learnlib.java9OrNewer}</skip>
                                    <failOnWarning>true</failOnWarning>
                                    <fork>true</fork>
                                    <outputDirectory>${project.build.directory}/checkerframework</outputDirectory>
                                    <annotationProcessorPaths>
                                        <path>
                                            <groupId>org.checkerframework</groupId>
                                            <artifactId>checker</artifactId>
                                            <version>${checkerframework.version}</version>
                                        </path>
                                    </annotationProcessorPaths>
                                    <annotationProcessors>
                                        <annotationProcessor>org.checkerframework.checker.nullness.NullnessChecker</annotationProcessor>
                                    </annotationProcessors>
                                    <compilerArgs>
                                        <arg>-J-Xbootclasspath/p:${com.google.errorprone:javac:jar}</arg>
                                        <arg>-AonlyDefs=^de\.learnlib</arg>
                                        <arg>-AskipUses=.*</arg>
                                        <arg>-AsuppressWarnings=uninitialized</arg>
                                        <arg>-AassumeAssertionsAreEnabled</arg>
                                    </compilerArgs>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>
