<?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>org.cryptomator</groupId>
    <artifactId>fuse-nio-adapter</artifactId>
    <version>7.0.0</version>
    <name>FUSE-NIO-Adapter</name>
    <description>Access resources at a given NIO path via FUSE.</description>
    <url>https://github.com/cryptomator/fuse-nio-adapter</url>

    <scm>
        <connection>scm:git:git@github.com:cryptomator/fuse-nio-adapter.git</connection>
        <developerConnection>scm:git:git@github.com:cryptomator/fuse-nio-adapter.git</developerConnection>
        <url>https://github.com/cryptomator/fuse-nio-adapter</url>
    </scm>

    <properties>
        <argLine></argLine>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.build.jdk>25</project.build.jdk>

        <!-- dependencies -->
        <integrations-api.version>1.9.1</integrations-api.version>
        <jfuse.version>0.7.3</jfuse.version>
        <slf4j.version>2.0.20</slf4j.version>
        <caffeine.version>3.3.0</caffeine.version>

        <!-- test dependencies -->
        <junit.jupiter.version>6.1.3</junit.jupiter.version>
        <mockito.version>5.24.0</mockito.version>
        <cryptofs.version>2.10.0</cryptofs.version>

        <!-- build dependencies -->
        <mvn-clean.version>3.5.0</mvn-clean.version>
        <mvn-compiler.version>3.16.0</mvn-compiler.version>
        <mvn-dependency.version>3.11.0</mvn-dependency.version>
        <mvn-deploy.version>3.2.0</mvn-deploy.version>
        <mvn-jar.version>3.5.1</mvn-jar.version>
        <mvn-javadoc.version>3.12.0</mvn-javadoc.version>
        <mvn-gpg.version>3.2.8</mvn-gpg.version>
        <mvn-source.version>3.4.0</mvn-source.version>
        <mvn-surefire.version>3.6.0</mvn-surefire.version>
        <mvn-exec.version>3.6.4</mvn-exec.version>
        <central-publishing.version>0.11.0</central-publishing.version>
        <dependency-check.version>13.0.0</dependency-check.version>
        <jacoco.version>0.8.15</jacoco.version>
    </properties>

    <licenses>
        <license>
            <name>GNU Affero General Public License (AGPL) version 3.0</name>
            <url>https://www.gnu.org/licenses/agpl.txt</url>
            <distribution>repo</distribution>
        </license>
    </licenses>

    <developers>
        <developer>
            <name>Sebastian Stenzel</name>
            <email>sebastian.stenzel@gmail.com</email>
            <timezone>+1</timezone>
            <organization>cryptomator.org</organization>
            <organizationUrl>http://cryptomator.org</organizationUrl>
        </developer>
    </developers>

    <dependencies>
        <!-- FUSE -->
        <dependency>
            <groupId>org.cryptomator</groupId>
            <artifactId>jfuse</artifactId>
            <version>${jfuse.version}</version>
        </dependency>

        <!-- Mount API -->
        <dependency>
            <groupId>org.cryptomator</groupId>
            <artifactId>integrations-api</artifactId>
            <version>${integrations-api.version}</version>
        </dependency>

        <!-- Cache -->
        <dependency>
            <groupId>com.github.ben-manes.caffeine</groupId>
            <artifactId>caffeine</artifactId>
            <version>${caffeine.version}</version>
            <exclusions>
                <exclusion>
                    <groupId>org.checkerframework</groupId>
                    <artifactId>checker-qual</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>com.google.errorprone</groupId>
                    <artifactId>error_prone_annotations</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <!-- Correctness -->
        <dependency>
            <groupId>org.jetbrains</groupId>
            <artifactId>annotations</artifactId>
            <version>26.1.0</version>
            <scope>provided</scope>
        </dependency>

        <!-- Logging -->
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <version>${slf4j.version}</version>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-simple</artifactId>
            <version>${slf4j.version}</version>
            <scope>test</scope>
        </dependency>

        <!-- Testing -->
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-api</artifactId>
            <version>${junit.jupiter.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-engine</artifactId>
            <version>${junit.jupiter.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-params</artifactId>
            <version>${junit.jupiter.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-core</artifactId>
            <version>${mockito.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.cryptomator</groupId>
            <artifactId>cryptofs</artifactId>
            <version>${cryptofs.version}</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <repositories>
        <repository>
            <id>maven-central</id>
            <name>Maven Central Repo</name>
            <url>https://repo.maven.apache.org/maven2</url>
        </repository>
    </repositories>

    <build>
        <pluginManagement>
            <plugins>
                <!-- shared setup of the mirror and crypto-mirror profiles, which run the interactive MirroringFuseMountTest -->
                <plugin>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>exec-maven-plugin</artifactId>
                    <version>${mvn-exec.version}</version>
                    <executions>
                        <execution>
                            <id>run-mirror</id>
                            <phase>test</phase>
                            <goals>
                                <goal>exec</goal>
                            </goals>
                        </execution>
                    </executions>
                    <configuration>
                        <executable>${java.home}/bin/java</executable>
                        <classpathScope>test</classpathScope>
                        <arguments>
                            <argument>--enable-native-access=ALL-UNNAMED</argument>
                            <argument>-classpath</argument>
                            <classpath/>
                            <argument>${mirror.mainClass}</argument>
                        </arguments>
                    </configuration>
                </plugin>
            </plugins>
        </pluginManagement>
        <plugins>
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>${mvn-compiler.version}</version>
                <configuration>
                    <showWarnings>true</showWarnings>
                    <release>${project.build.jdk}</release>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <version>${mvn-dependency.version}</version>
                <executions>
                    <execution>
                        <id>jar-paths-to-properties</id>
                        <goals>
                            <goal>properties</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.jacoco</groupId>
                <artifactId>jacoco-maven-plugin</artifactId>
                <version>${jacoco.version}</version>
                <executions>
                    <execution>
                        <id>prepare-agent</id>
                        <goals>
                            <goal>prepare-agent</goal>
                        </goals>
                        <configuration>
                            <propertyName>surefire.jacoco.args</propertyName>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>${mvn-surefire.version}</version>
                <configuration>
                    <argLine>@{surefire.jacoco.args} -javaagent:"${org.mockito:mockito-core:jar}"</argLine>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <version>${mvn-jar.version}</version>
            </plugin>
            <plugin>
                <artifactId>maven-source-plugin</artifactId>
                <version>${mvn-source.version}</version>
                <executions>
                    <execution>
                        <id>attach-sources</id>
                        <goals>
                            <goal>jar-no-fork</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <artifactId>maven-javadoc-plugin</artifactId>
                <version>${mvn-javadoc.version}</version>
                <executions>
                    <execution>
                        <id>attach-javadocs</id>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                        <configuration>
                            <release>${project.build.jdk}</release>
                        </configuration>
                    </execution>
                </executions>
                <configuration>
                    <sourceFileExcludes>
                        <sourceFileExclude>**/*_*</sourceFileExclude>
                        <sourceFileExclude>**/Dagger*</sourceFileExclude>
                    </sourceFileExcludes>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <profile>
            <id>dependency-check</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.owasp</groupId>
                        <artifactId>dependency-check-maven</artifactId>
                        <version>${dependency-check.version}</version>
                        <configuration>
                            <nvdValidForHours>24</nvdValidForHours>
                            <failBuildOnCVSS>0</failBuildOnCVSS>
                            <skipTestScope>true</skipTestScope>
                            <detail>true</detail>
                            <suppressionFile>suppression.xml</suppressionFile>
                            <nvdApiKeyEnvironmentVariable>NVD_API_KEY</nvdApiKeyEnvironmentVariable>
                        </configuration>
                        <executions>
                            <execution>
                                <goals>
                                    <goal>check</goal>
                                </goals>
                                <phase>validate</phase>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <profile>
            <id>coverage</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.jacoco</groupId>
                        <artifactId>jacoco-maven-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>report</id>
                                <goals>
                                    <goal>report</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <profile>
            <id>sign</id>
            <build>
                <plugins>
                    <plugin>
                        <artifactId>maven-gpg-plugin</artifactId>
                        <version>${mvn-gpg.version}</version>
                        <executions>
                            <execution>
                                <id>sign-artifacts</id>
                                <phase>verify</phase>
                                <goals>
                                    <goal>sign</goal>
                                </goals>
                                <configuration>
                                    <signer>bc</signer>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <!-- Mirrors a directory, see `mvn test -Pmirror` -->
        <profile>
            <id>mirror</id>
            <properties>
                <mirror.mainClass>org.cryptomator.frontend.fuse.mount.MirroringFuseMountTest$Mirror</mirror.mainClass>
                <!-- test classes are still compiled, only surefire is skipped -->
                <skipTests>true</skipTests>
            </properties>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.codehaus.mojo</groupId>
                        <artifactId>exec-maven-plugin</artifactId>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <!-- Mirrors a vault, see `mvn test -Pcrypto-mirror` -->
        <profile>
            <id>crypto-mirror</id>
            <properties>
                <mirror.mainClass>org.cryptomator.frontend.fuse.mount.MirroringFuseMountTest$CryptoFsMirror</mirror.mainClass>
                <!-- test classes are still compiled, only surefire is skipped -->
                <skipTests>true</skipTests>
            </properties>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.codehaus.mojo</groupId>
                        <artifactId>exec-maven-plugin</artifactId>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <profile>
            <id>deploy-central</id>
            <build>
                <plugins>
					<plugin>
						<groupId>org.sonatype.central</groupId>
 						<artifactId>central-publishing-maven-plugin</artifactId>
 						<version>${central-publishing.version}</version>
						<extensions>true</extensions>
						<configuration>
							<publishingServerId>central</publishingServerId>
  							<autoPublish>true</autoPublish>
						</configuration>
					</plugin>
                </plugins>
            </build>
        </profile>

        <profile>
            <id>deploy-github</id>
            <distributionManagement>
                <repository>
                    <id>github</id>
                    <name>GitHub Packages</name>
                    <url>https://maven.pkg.github.com/cryptomator/fuse-nio-adapter</url>
                </repository>
            </distributionManagement>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-deploy-plugin</artifactId>
                        <version>${mvn-deploy.version}</version>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>
