<?xml version="1.0" encoding="UTF-8"?>
<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>

    <groupId>de.redsix</groupId>
    <artifactId>dmn-check</artifactId>
    <packaging>pom</packaging>
    <version>1.2.2</version>

    <modules>
        <module>core</module>
        <module>validators</module>
        <module>server</module>
        <module>maven-plugin</module>
        <module>plugin-base</module>
    </modules>

    <name>dmn-check</name>
    <url>https://github.com/red6/dmn-check</url>
    <description>A Maven plugin which performs various static analyses on Decision Model Notation (DMN) files to detect bugs</description>

    <organization>
        <name>red6 enterprise software GmbH</name>
        <url>https://red6-es.de/</url>
    </organization>

    <developers>
        <developer>
            <name>Jan Deutelmoser</name>
        </developer>

        <developer>
            <name>Pascal Wittmann</name>
        </developer>
    </developers>

    <licenses>
        <license>
            <name>The Apache Software License, Version 2.0</name>
            <url>https://www.apache.org/licenses/LICENSE-2.0.txt</url>
            <distribution>repo</distribution>
        </license>
    </licenses>

    <issueManagement>
        <system>GitHub</system>
        <url>https://github.com/red6/dmn-check/issues</url>
    </issueManagement>

    <scm>
        <connection>scm:git:git@github.com:red6/dmn-check.git</connection>
        <developerConnection>scm:git:git@github.com:red6/dmn-check.git</developerConnection>
        <url>https://github.com/red6/dmn-check.git</url>
        <tag>HEAD</tag>
    </scm>

    <distributionManagement>
        <snapshotRepository>
            <id>ossrh</id>
            <url>https://oss.sonatype.org/content/repositories/snapshots</url>
        </snapshotRepository>
        <repository>
            <id>ossrh</id>
            <url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
        </repository>
    </distributionManagement>

    <properties>
        <java.version>11</java.version>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

        <checker.framework.version>3.18.0</checker.framework.version>

        <junit-minor.version>7.0</junit-minor.version>
        <junit.version>5.${junit-minor.version}</junit.version>
        <mockito.version>3.12.4</mockito.version>
        <derive4j.version>1.1.1</derive4j.version>

        <compiler-plugin.version>3.8.1</compiler-plugin.version>
    </properties>

    <build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>${compiler-plugin.version}</version>
                    <configuration>
                        <release>${java.version}</release>

                        <useIncrementalCompilation>false</useIncrementalCompilation>

                        <annotationProcessorPaths>
                            <path>
                                <groupId>org.derive4j</groupId>
                                <artifactId>derive4j</artifactId>
                                <version>${derive4j.version}</version>
                            </path>
                        </annotationProcessorPaths>
                    </configuration>
                </plugin>
            </plugins>
        </pluginManagement>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-enforcer-plugin</artifactId>
                <version>3.0.0-M3</version>
                <executions>
                    <execution>
                        <id>enforce-maven</id>
                        <goals>
                            <goal>enforce</goal>
                        </goals>
                        <configuration>
                            <rules>
                                <requireMavenVersion>
                                    <version>3.5.0</version>
                                </requireMavenVersion>
                            </rules>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.22.2</version>

                <configuration>
                    <redirectTestOutputToFile>true</redirectTestOutputToFile>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.eluder.coveralls</groupId>
                <artifactId>coveralls-maven-plugin</artifactId>
                <version>4.3.0</version>
            </plugin>

            <plugin>
                <groupId>org.jacoco</groupId>
                <artifactId>jacoco-maven-plugin</artifactId>
                <version>0.8.6</version>
                <configuration>
                    <!-- Exclude code generated by derive4j -->
                    <excludes>
                        <exclude>**/ExpressionTypes.*</exclude>
                        <exclude>**/ExpressionTypes$*.*</exclude>
                        <exclude>**/FeelExpressions.*</exclude>
                        <exclude>**/FeelExpressions$*.*</exclude>
                        <exclude>**/Eithers.*</exclude>
                        <exclude>**/Eithers$*.*</exclude>
                    </excludes>
                </configuration>
                <executions>
                    <execution>
                        <id>prepare-agent</id>
                        <goals>
                            <goal>prepare-agent</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>build-helper-maven-plugin</artifactId>
                <version>3.2.0</version>
                <executions>
                    <execution>
                        <id>test</id>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>add-source</goal>
                        </goals>
                        <configuration>
                            <sources>
                                <source>${basedir}/target/generated-sources</source>
                            </sources>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <profile>
            <id>checkerframework</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-compiler-plugin</artifactId>
                        <version>${compiler-plugin.version}</version>

                        <executions>
                            <execution>
                                <id>default-compile</id>
                                <goals>
                                    <goal>compile</goal>
                                </goals>

                                <configuration>
                                    <useIncrementalCompilation>false</useIncrementalCompilation>
                                    <annotationProcessors>
                                        <annotationProcessor>org.derive4j.processor.DerivingProcessor</annotationProcessor>
                                    </annotationProcessors>

                                    <annotationProcessorPaths>
                                        <path>
                                            <groupId>org.derive4j</groupId>
                                            <artifactId>derive4j</artifactId>
                                            <version>${derive4j.version}</version>
                                        </path>
                                    </annotationProcessorPaths>
                                </configuration>
                            </execution>

                            <execution>
                                <id>verify-with-checkerframework</id>
                                <goals>
                                    <goal>compile</goal>
                                </goals>

                                <configuration>
                                    <useIncrementalCompilation>true</useIncrementalCompilation>

                                    <annotationProcessors>
                                        <annotationProcessor>org.checkerframework.checker.regex.RegexChecker</annotationProcessor>
                                        <annotationProcessor>org.checkerframework.checker.nullness.NullnessChecker</annotationProcessor>
                                        <annotationProcessor>org.checkerframework.checker.formatter.FormatterChecker</annotationProcessor>
                                    </annotationProcessors>

                                    <annotationProcessorPaths>
                                        <path>
                                            <groupId>org.checkerframework</groupId>
                                            <artifactId>checker</artifactId>
                                            <version>${checker.framework.version}</version>
                                        </path>
                                    </annotationProcessorPaths>

                                    <fork>true</fork>

                                    <compilerArgs>
                                        <arg>-J--add-opens=jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED</arg>
                                        <arg>-Astubs=checkerframework/stubs</arg>
                                        <arg>-AstubWarnIfNotFound</arg>
                                    </compilerArgs>

                                    <!-- Exclude code generated by derive4j -->
                                    <excludes>
                                        <exclude>**/ExpressionTypes.*</exclude>
                                        <exclude>**/ExpressionTypes$*.*</exclude>
                                        <exclude>**/FeelExpressions.*</exclude>
                                        <exclude>**/FeelExpressions$*.*</exclude>
                                        <exclude>**/Eithers.*</exclude>
                                        <exclude>**/Eithers$*.*</exclude>
                                    </excludes>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <profile>
            <id>release</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.sonatype.plugins</groupId>
                        <artifactId>nexus-staging-maven-plugin</artifactId>
                        <version>1.6.8</version>
                        <extensions>true</extensions>
                        <configuration>
                            <serverId>ossrh</serverId>
                            <nexusUrl>https://oss.sonatype.org/</nexusUrl>
                        </configuration>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-source-plugin</artifactId>
                        <version>3.2.1</version>
                        <executions>
                            <execution>
                                <id>attach-sources</id>
                                <goals>
                                    <goal>jar-no-fork</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-javadoc-plugin</artifactId>
                        <version>3.2.0</version>
                        <executions>
                            <execution>
                                <id>attach-javadocs</id>
                                <goals>
                                    <goal>jar</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-gpg-plugin</artifactId>
                        <version>1.6</version>
                        <executions>
                            <execution>
                                <id>sign-artifacts</id>
                                <phase>verify</phase>
                                <goals>
                                    <goal>sign</goal>
                                </goals>
                                <configuration>
                                    <!-- Prevent `gpg` from using pinentry programs -->
                                    <gpgArguments>
                                        <arg>--pinentry-mode</arg>
                                        <arg>loopback</arg>
                                    </gpgArguments>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

    <dependencies>

        <dependency>
            <groupId>org.junit.platform</groupId>
            <artifactId>junit-platform-launcher</artifactId>
            <version>1.${junit-minor.version}</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-engine</artifactId>
            <version>${junit.version}</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-api</artifactId>
            <version>${junit.version}</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-params</artifactId>
            <version>${junit.version}</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.hamcrest</groupId>
            <artifactId>hamcrest-all</artifactId>
            <version>1.3</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.checkerframework</groupId>
            <artifactId>checker-qual</artifactId>
            <version>${checker.framework.version}</version>
        </dependency>

        <dependency>
            <groupId>com.google.code.findbugs</groupId>
            <artifactId>annotations</artifactId>
            <version>3.0.1u2</version>
        </dependency>

        <dependency>
            <groupId>org.derive4j</groupId>
            <artifactId>derive4j</artifactId>
            <version>${derive4j.version}</version>
            <optional>true</optional>
        </dependency>

    </dependencies>
</project>
