<?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>integrations-mac</artifactId>
	<version>1.5.0-beta3</version>

	<name>Cryptomator Integrations for macOS</name>
	<description>Provides optional macOS services used by Cryptomator</description>
	<url>https://github.com/cryptomator/integrations-mac</url>

	<scm>
		<connection>scm:git:git@github.com:cryptomator/integrations-mac.git</connection>
		<developerConnection>scm:git:git@github.com:cryptomator/integrations-mac.git</developerConnection>
		<url>https://github.com/cryptomator/integrations-mac</url>
	</scm>

	<developers>
		<developer>
			<name>Sebastian Stenzel</name>
			<email>sebastian.stenzel@skymatic.de</email>
			<timezone>+1</timezone>
			<organization>Skymatic GmbH</organization>
			<organizationUrl>http://skymatic.de</organizationUrl>
		</developer>
	</developers>

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

		<!-- runtime dependencies -->
		<api.version>1.8.0-beta1</api.version>
		<slf4j.version>2.0.17</slf4j.version>

		<!-- test dependencies -->
		<junit.jupiter.version>6.0.1</junit.jupiter.version>
		<mockito.version>5.21.0</mockito.version>

		<!-- build plugin dependencies -->
		<mvn-clean.version>3.5.0</mvn-clean.version>
		<mvn-compiler.version>3.14.1</mvn-compiler.version>
		<mvn-dependency.version>3.9.0</mvn-dependency.version>
		<mvn-deploy.version>3.1.4</mvn-deploy.version>
		<mvn-enforcer.version>3.6.2</mvn-enforcer.version>
		<mvn-javadoc.version>3.12.0</mvn-javadoc.version>
		<mvn-gpg.version>3.2.8</mvn-gpg.version>
		<mvn-resources.version>3.4.0</mvn-resources.version>
		<mvn-source.version>3.4.0</mvn-source.version>
		<mvn-surefire.version>3.5.4</mvn-surefire.version>
		<central-publishing.version>0.9.0</central-publishing.version>
		<dependency-check.version>12.1.9</dependency-check.version>
		<exec-maven.version>3.6.3</exec-maven.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>

	<repositories>
		<repository>
			<name>Central Portal Snapshots</name>
			<id>central-portal-snapshots</id>
			<url>https://central.sonatype.com/repository/maven-snapshots/</url>
			<releases>
				<enabled>false</enabled>
			</releases>
			<snapshots>
				<enabled>true</enabled>
			</snapshots>
		</repository>
	</repositories>

	<dependencies>
		<dependency>
			<groupId>org.cryptomator</groupId>
			<artifactId>integrations-api</artifactId>
			<version>${api.version}</version>
		</dependency>
		<dependency>
			<groupId>org.slf4j</groupId>
			<artifactId>slf4j-api</artifactId>
			<version>${slf4j.version}</version>
		</dependency>

		<!-- JUnit / Mockito / Hamcrest -->
		<dependency>
			<groupId>org.slf4j</groupId>
			<artifactId>slf4j-simple</artifactId>
			<version>${slf4j.version}</version>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>org.junit.jupiter</groupId>
			<artifactId>junit-jupiter</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>
	</dependencies>

	<build>
		<plugins>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-clean-plugin</artifactId>
				<version>${mvn-clean.version}</version>
				<configuration>
					<filesets>
						<fileset>
							<directory>${project.basedir}/src/main/headers</directory>
							<followSymlinks>false</followSymlinks>
							<includes>
								<include>*.h</include>
							</includes>
						</fileset>
					</filesets>
				</configuration>
			</plugin>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-compiler-plugin</artifactId>
				<version>${mvn-compiler.version}</version>
				<configuration>
					<compilerArgs>
						<arg>-h</arg>
						<arg>${project.basedir}/src/main/headers</arg>
					</compilerArgs>
					<release>${project.jdk.version}</release>
				</configuration>
			</plugin>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-enforcer-plugin</artifactId>
				<version>${mvn-enforcer.version}</version>
				<executions>
					<execution>
						<id>check-preconditions</id>
						<goals>
							<goal>enforce</goal>
						</goals>
						<configuration>
							<rules>
								<requireOS>
									<family>mac</family>
									<message>This build configuration requires macOS.</message>
								</requireOS>
								<requireFilesExist>
									<files>
										<file>/usr/bin/xcodebuild</file>
									</files>
									<message>This build configuration requires Xcode command line tools. Missing
										"xcodebuild" command.
									</message>
								</requireFilesExist>
							</rules>
						</configuration>
					</execution>
				</executions>
			</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.codehaus.mojo</groupId>
				<artifactId>exec-maven-plugin</artifactId>
				<version>${exec-maven.version}</version>
				<executions>
					<execution>
						<id>xcode-build-intel</id>
						<goals>
							<goal>exec</goal>
						</goals>
						<phase>compile</phase>
						<configuration>
							<executable>xcodebuild</executable>
							<workingDirectory>${project.basedir}/src/main/native</workingDirectory>
							<arguments>
								<argument>-project</argument>
								<argument>Integrations.xcodeproj</argument>
								<argument>-scheme</argument>
								<argument>Integrations</argument>
								<argument>-configuration</argument>
								<argument>Release</argument>
								<argument>-arch</argument>
								<argument>x86_64</argument>
								<argument>-archivePath</argument>
								<argument>${project.build.directory}/integrations-x86_64.xcarchive</argument>
								<argument>-quiet</argument>
								<argument>clean</argument>
								<argument>archive</argument>
								<argument>JAVA_HOME="${java.home}"</argument>
							</arguments>
						</configuration>
					</execution>
					<execution>
						<id>xcode-build-arm</id>
						<goals>
							<goal>exec</goal>
						</goals>
						<phase>compile</phase>
						<configuration>
							<executable>xcodebuild</executable>
							<workingDirectory>${project.basedir}/src/main/native</workingDirectory>
							<arguments>
								<argument>-project</argument>
								<argument>Integrations.xcodeproj</argument>
								<argument>-scheme</argument>
								<argument>Integrations</argument>
								<argument>-configuration</argument>
								<argument>Release</argument>
								<argument>-arch</argument>
								<argument>arm64</argument>
								<argument>-archivePath</argument>
								<argument>${project.build.directory}/integrations-arm64.xcarchive</argument>
								<argument>-quiet</argument>
								<argument>clean</argument>
								<argument>archive</argument>
								<argument>JAVA_HOME="${java.home}"</argument>
							</arguments>
						</configuration>
					</execution>
					<execution>
						<id>build-universal-binary</id>
						<goals>
							<goal>exec</goal>
						</goals>
						<phase>compile</phase>
						<configuration>
							<executable>lipo</executable>
							<workingDirectory>${project.build.directory}</workingDirectory>
							<arguments>
								<argument>-create</argument>
								<argument>integrations-x86_64.xcarchive/Products/usr/local/lib/libIntegrations.dylib</argument>
								<argument>integrations-arm64.xcarchive/Products/usr/local/lib/libIntegrations.dylib</argument>
								<argument>-output</argument>
								<argument>libIntegrations.dylib</argument>
							</arguments>
						</configuration>
					</execution>
				</executions>
			</plugin>
			<plugin>
				<artifactId>maven-resources-plugin</artifactId>
				<version>${mvn-resources.version}</version>
				<executions>
					<execution>
						<goals>
							<goal>copy-resources</goal>
						</goals>
						<phase>process-classes</phase>
						<configuration>
							<outputDirectory>${project.build.directory}/classes</outputDirectory>
							<resources>
								<resource>
									<directory>${project.build.directory}</directory>
									<includes>
										<include>libIntegrations.dylib</include>
									</includes>
								</resource>
							</resources>
						</configuration>
					</execution>
				</executions>
			</plugin>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-surefire-plugin</artifactId>
				<version>${mvn-surefire.version}</version>
				<configuration>
					<argLine>-javaagent:"${org.mockito:mockito-core:jar}"</argLine>
				</configuration>
			</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>
					</execution>
				</executions>
				<configuration>
					<quiet>true</quiet>
					<release>${project.jdk.version}</release>
					<tags>
						<!-- workaround for "unknown tag: implNote", see https://blog.codefx.org/java/new-javadoc-tags/#Maven  -->
						<tag>
							<name>apiNote</name>
							<placement>a</placement>
							<head>API Note:</head>
						</tag>
						<tag>
							<name>implSpec</name>
							<placement>a</placement>
							<head>Implementation Requirements:</head>
						</tag>
						<tag>
							<name>implNote</name>
							<placement>a</placement>
							<head>Implementation Note:</head>
						</tag>
						<tag>
							<name>param</name>
						</tag>
						<tag>
							<name>return</name>
						</tag>
						<tag>
							<name>throws</name>
						</tag>
						<tag>
							<name>since</name>
						</tag>
						<tag>
							<name>version</name>
						</tag>
						<tag>
							<name>serialData</name>
						</tag>
						<tag>
							<name>see</name>
						</tag>
					</tags>
				</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>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>

		<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/integrations-mac</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>
