<?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>
    <parent>
        <groupId>de.skuzzle</groupId>
        <artifactId>skuzzle-parent</artifactId>
        <version>4.0.0-rc1</version>
        <relativePath/>
    </parent>

    <groupId>de.skuzzle.enforcer</groupId>
    <artifactId>restrict-imports-enforcer-rule-parent</artifactId>
    <version>2.4.0</version>
    <packaging>pom</packaging>
    <name>Restrict Imports Enforcer Rule Aggregator</name>
    <description>Bans imports of specified classes/packages</description>
    <url>https://github.com/skuzzle/restrict-imports-enforcer-rule</url>
    <scm>
        <developerConnection>scm:git:https://github.com/skuzzle/restrict-imports-enforcer-rule.git</developerConnection>
        <tag>HEAD</tag>
    </scm>

    <properties>
        <maven.compiler.target>8</maven.compiler.target>
        <maven.compiler.source>8</maven.compiler.source>
        <maven.compiler.release>8</maven.compiler.release>
        <version.enforcer-api>3.3.0</version.enforcer-api>
        <version.maven>3.9.3</version.maven>
        <version.junit>5.9.3</version.junit>
        <version.assertj>3.24.2</version.assertj>
        <version.byte-buddy>1.14.5</version.byte-buddy>
        <version.equals-verifier>3.15</version.equals-verifier>
        <version.slf4j>1.7.36</version.slf4j>
        <version.mockito>5.4.0</version.mockito>
        <version.jimfs>1.2</version.jimfs>
        <version.java-parser>3.25.2</version.java-parser>
        <version.resources-plugin>3.3.1</version.resources-plugin>
        <version.invoker-plugin>3.6.0</version.invoker-plugin>
        <version.sisu-inject>0.3.5</version.sisu-inject>

        <!-- DO NOT UPDATE spotless UNTIL #64 IS RESOLVED -->
        <!-- https://github.com/skuzzle/restrict-imports-enforcer-rule/issues/64 -->
        <version.spotless-plugin>2.34.0</version.spotless-plugin>

        <version.min-supported-enforcer-plugin>1.4.1</version.min-supported-enforcer-plugin>
        <version.max-supported-enforcer-plugin>3.3.0</version.max-supported-enforcer-plugin>
        <integration-test-threads>2C</integration-test-threads>

        <site.name>restrict-imports-enforcer-rule</site.name>
        <github.name>restrict-imports-enforcer-rule</github.name>
    </properties>

    <modules>
        <module>enforcer-rule-maven-it</module>
        <module>core</module>
        <module>enforcer-rule</module>
    </modules>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.junit</groupId>
                <artifactId>junit-bom</artifactId>
                <version>${version.junit}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>

            <dependency>
                <groupId>${project.groupId}</groupId>
                <artifactId>restrict-imports-enforcer-rule-core</artifactId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>${project.groupId}</groupId>
                <artifactId>restrict-imports-enforcer-rule</artifactId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>org.apache.maven</groupId>
                <artifactId>maven-core</artifactId>
                <version>${version.maven}</version>
            </dependency>
            <dependency>
                <groupId>org.apache.maven</groupId>
                <artifactId>maven-plugin-api</artifactId>
                <version>${version.maven}</version>
            </dependency>
            <dependency>
                <groupId>org.apache.maven.enforcer</groupId>
                <artifactId>enforcer-api</artifactId>
                <version>${version.enforcer-api}</version>
            </dependency>
            <dependency>
                <groupId>com.github.javaparser</groupId>
                <artifactId>javaparser-core</artifactId>
                <version>${version.java-parser}</version>
            </dependency>
            <dependency>
                <groupId>org.slf4j</groupId>
                <artifactId>slf4j-api</artifactId>
                <version>${version.slf4j}</version>
            </dependency>
            <dependency>
                <groupId>org.assertj</groupId>
                <artifactId>assertj-core</artifactId>
                <version>${version.assertj}</version>
            </dependency>
            <dependency>
                <groupId>nl.jqno.equalsverifier</groupId>
                <artifactId>equalsverifier</artifactId>
                <version>${version.equals-verifier}</version>
            </dependency>
            <dependency>
                <groupId>com.google.jimfs</groupId>
                <artifactId>jimfs</artifactId>
                <version>${version.jimfs}</version>
            </dependency>
            <dependency>
                <groupId>org.mockito</groupId>
                <artifactId>mockito-core</artifactId>
                <version>${version.mockito}</version>
            </dependency>
            <dependency>
                <groupId>net.bytebuddy</groupId>
                <artifactId>byte-buddy</artifactId>
                <version>${version.byte-buddy}</version>
            </dependency>
            <dependency>
                <groupId>net.bytebuddy</groupId>
                <artifactId>byte-buddy-agent</artifactId>
                <version>${version.byte-buddy}</version>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <profiles>
        <profile>
            <id>with-coverage</id>
            <properties>
                <integration-test-threads>1</integration-test-threads>
            </properties>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.jacoco</groupId>
                        <artifactId>jacoco-maven-plugin</artifactId>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

    <build>
        <plugins>
            <plugin>
                <groupId>com.diffplug.spotless</groupId>
                <artifactId>spotless-maven-plugin</artifactId>
                <version>${version.spotless-plugin}</version>
                <configuration>
                    <formats>
                        <!-- you can define as many formats as you want, each is independent -->
                        <format>
                            <!-- define the files to apply to -->
                            <includes>
                                <include>*.md</include>
                                <include>.gitignore</include>
                                <include>pom.xml</include>
                            </includes>
                            <!-- define the steps to apply to those files -->
                            <trimTrailingWhitespace/>
                            <endWithNewline/>
                            <indent>
                                <spaces>true</spaces>
                                <spacesPerTab>4</spacesPerTab>
                            </indent>
                        </format>
                    </formats>
                    <!-- define a language-specific format -->
                    <java>
                        <eclipse>
                            <file>${maven.multiModuleProjectDirectory}/spotless/formatter-settings.xml</file>
                        </eclipse>
                        <importOrder>
                            <wildcardsLast>false</wildcardsLast>
                            <file>${maven.multiModuleProjectDirectory}/spotless/eclipse.importorder</file>
                        </importOrder>
                        <removeUnusedImports/>
                        <formatAnnotations/>
                        <trimTrailingWhitespace/>
                        <endWithNewline/>
                    </java>
                </configuration>
                <executions>
                    <execution>
                        <goals>
                            <goal>check</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-resources-plugin</artifactId>
                <version>${version.resources-plugin}</version>
                <executions>
                    <execution>
                        <inherited>false</inherited>
                        <goals>
                            <goal>copy-resources</goal>
                        </goals>
                        <phase>validate</phase>
                        <configuration>
                            <outputDirectory>${maven.multiModuleProjectDirectory}</outputDirectory>
                            <resources>
                                <resource>
                                    <directory>readme/</directory>
                                    <filtering>true</filtering>
                                </resource>
                            </resources>
                            <escapeString>\</escapeString>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>com.amashchenko.maven.plugin</groupId>
                <artifactId>gitflow-maven-plugin</artifactId>
                <configuration>
                    <postReleaseGoals>deploy</postReleaseGoals>
                    <detail>true</detail>
                    <verbose>true</verbose>
                    <skipTestProject>true</skipTestProject>
                    <gitFlowConfig>
                        <productionBranch>master</productionBranch>
                        <developmentBranch>develop</developmentBranch>
                    </gitFlowConfig>
                </configuration>
            </plugin>
            <plugin>
                <groupId>com.ragedunicorn.tools.maven</groupId>
                <artifactId>github-release-maven-plugin</artifactId>
                <configuration>
                    <owner>skuzzle</owner>
                    <repository>${github.name}</repository>
                    <authToken>${github.release-token}</authToken>
                    <tagName>v${project.version}</tagName>
                    <name>${project.version}</name>
                    <targetCommitish>master</targetCommitish>
                    <releaseNotes>RELEASE_NOTES.md</releaseNotes>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-enforcer-plugin</artifactId>
                <version>${version.max-supported-enforcer-plugin}</version>
                <dependencies>
                    <dependency>
                        <groupId>${project.groupId}</groupId>
                        <artifactId>restrict-imports-enforcer-rule</artifactId>
                        <version>2.4.0-rc1</version>
                    </dependency>
                </dependencies>
                <executions>
                    <execution>
                        <id>forbid-guava</id>
                        <phase>process-sources</phase>
                        <goals>
                            <goal>enforce</goal>
                        </goals>
                        <configuration>
                            <rules>
                                <RestrictImports>
                                    <reason>Don't use guava classes</reason>
                                    <bannedImport>com.google.common.**</bannedImport>
                                    <allowedImport>com.google.common.jimfs.**</allowedImport>
                                </RestrictImports>
                            </rules>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>
