<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/maven-v4_0_0.xsd">
	<!-- mvn deploy -DskipTests -Denv.MAVEN_REPO_URL=ftp://ftp.cluster013.ovh.net/ -->

	<modelVersion>4.0.0</modelVersion>
	<groupId>org.jzy3d</groupId>
	<artifactId>panama-gl</artifactId>
	<version>1.3.0</version>
	<name>Panama GL</name>
	<packaging>pom</packaging>


	<scm>
		<connection>scm:git:https://github.com/jzy3d/panama-gl</connection>
		<tag>panama-gl-1.2</tag>
	</scm>

	<properties>
		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
		<panamagl.bindings.version>${project.version}</panamagl.bindings.version>
		<jdk.version>22</jdk.version>

		<!-- Default Windows native library path. Override on CI with Mesa prepended:
		       mvn package -D"native.lib.path.windows=C:\mesa;C:\Windows\system32" -->
		<native.lib.path.windows>C:\Windows\system32;C:\Users\Martin\Dev\panama-gl\freeglut\bin\x64</native.lib.path.windows>
		<native.lib.path.macos>.:/System/Library/Frameworks/OpenGL.framework/Versions/Current/Libraries/</native.lib.path.macos>
		<native.lib.path.linux>.:/usr/lib/x86_64-linux-gnu/:/usr/lib</native.lib.path.linux>

	</properties>

	<modules>
		<module>panama-gl-api</module>

		<module>panama-gl-ui-awt</module>
		<module>panama-gl-ui-javafx</module>
		<module>panama-gl-ui-swing</module>
		<module>panama-gl-ui-swt</module>

		<module>panama-gl-wrappers-macos</module>
		<module>panama-gl-wrappers-linux</module>
		<module>panama-gl-wrappers-windows</module>

		<module>panama-gl-samples</module>
	</modules>

	<dependencies>

		<!-- OTHER MODULES -->
		<dependency>
			<groupId>org.slf4j</groupId>
			<artifactId>slf4j-api</artifactId>
			<version>2.0.17</version>
		</dependency>
		<dependency>
			<groupId>ch.qos.logback</groupId>
			<artifactId>logback-classic</artifactId>
			<version>1.5.18</version>
		</dependency>

		<dependency>
			<groupId>org.apache.commons</groupId>
			<artifactId>commons-collections4</artifactId>
			<version>4.5.0</version>
		</dependency>
		<dependency>
			<groupId>com.google.guava</groupId>
			<artifactId>guava</artifactId>
			<version>33.4.8-jre</version>
		</dependency>
		<dependency>
			<groupId>junit</groupId>
			<artifactId>junit</artifactId>
			<version>4.13.2</version>
			<type>jar</type>
			<scope>test</scope>
		</dependency>

		<dependency>
			<groupId>org.mockito</groupId>
			<artifactId>mockito-core</artifactId>
			<version>4.11.0</version>
			<scope>test</scope>
		</dependency>

	</dependencies>

	<build>
		<plugins>

			<!-- Add generated folder to build path -->
			<plugin>
				<groupId>org.codehaus.mojo</groupId>
				<artifactId>build-helper-maven-plugin</artifactId>
				<version>3.2.0</version>
				<executions>
					<execution>
						<id>add-source</id>
						<phase>generate-sources</phase>
						<goals>
							<goal>add-source</goal>
						</goals>
						<configuration>
							<sources>
								<source>src/generated/java</source>
							</sources>
						</configuration>
					</execution>
				</executions>
			</plugin>

			<!-- Defines tests to include -->
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-surefire-plugin</artifactId>
				<version>3.0.0-M5</version>
				<configuration>

					<includes>
						<include>**/Test*.java</include>
						<include>**/*Test.java</include>
						<include>**/ITTest*.java</include>
					</includes>

					<!-- Configure Panama -->
					<argLine>
						--enable-native-access=ALL-UNNAMED
					</argLine>

				</configuration>
			</plugin>

			<!-- Defines compiler flags and source/byte code version  -->
			<plugin>
				<artifactId>maven-compiler-plugin</artifactId>
				<version>3.8.1</version>
				<configuration>
					<source>${jdk.version}</source>
					<target>${jdk.version}</target>
					<compilerArgs>
						<!--<arg>enable-preview</arg>-->
					</compilerArgs>
				</configuration>
			</plugin>

			<!-- SOURCE JAR -->

			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-source-plugin</artifactId>
				<version>3.3.1</version>
				<executions>
					<execution>
						<id>attach-sources</id>
						<phase>verify</phase>
						<goals>
							<goal>jar</goal>
						</goals>
					</execution>
				</executions>
			</plugin>

			<!-- TEST JAR -->

			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-jar-plugin</artifactId>
				<version>3.4.1</version>
				<executions>
					<execution>
						<goals>
							<goal>test-jar</goal>
						</goals>
					</execution>
				</executions>
			</plugin>

			<!-- JAVADOC JAR -->

			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-javadoc-plugin</artifactId>
				<version>3.6.3</version>
				<configuration>
					<release>${jdk.version}</release>
					<additionalparam>-Xdoclint:none</additionalparam>
					<doclint>none</doclint>
					<source>8</source>
					<quiet>true</quiet> <!-- only show warnings/errors -->
					<failOnError>false</failOnError>
					<configuration>
						<docfilessubdirs>true</docfilessubdirs>
					</configuration>
				</configuration>
				<executions>
					<execution>
						<id>attach-javadocs</id>
						<phase>verify</phase>
						<goals>
							<goal>jar</goal>
						</goals>
					</execution>
					<execution>
						<id>aggregate</id>
						<goals>
							<goal>aggregate</goal>
						</goals>
					</execution>
				</executions>
			</plugin>

			<!-- RELEASE PLUGIN TO HELP CREATE RELEASE BRANCHES -->
			<plugin>
				<artifactId>maven-release-plugin</artifactId>
				<version>3.8.1</version>
			</plugin>

		</plugins>

		<!-- DEPLOY TO FTP -->

		<extensions>
			<extension>
				<groupId>org.apache.maven.wagon</groupId>
				<artifactId>wagon-ftp</artifactId>
				<version>3.5.3</version>
			</extension>
		</extensions>

	</build>

	<!-- ============================================================== -->

	<!-- This section defines the path to natives. Debug how the OS and CPU
		names are detected by maven with mvn enforcer:display-info -->

	<profiles>

		<!-- Unix related settings -->
		<profile>
			<id>Unix</id>
			<activation>
				<os>
					<family>unix</family>
				</os>
			</activation>

			<build>
				<plugins>
					<plugin>
						<groupId>org.apache.maven.plugins</groupId>
						<artifactId>maven-surefire-plugin</artifactId>
						<version>3.0.0-M5</version>
						<configuration>
							<!-- Ensure stack trace get displayed -->
							<trimStackTrace>false</trimStackTrace>

							<forkCount>1</forkCount>
							<reuseForks>false</reuseForks>

							<!-- Parallel tests DISABLE PARALLEL TEST OTHERWISE CANVAS DO NOT UPDATE
								PROPERLY (?!)
							<parallel>methods</parallel>
								<forkCount>1</forkCount>-->
							<!--<useUnlimitedThreads>true</useUnlimitedThreads>-->

							<!-- Configure Panama -->
							<argLine>
								--enable-native-access=ALL-UNNAMED -Djava.library.path=${native.lib.path.linux}
							</argLine>
						</configuration>
					</plugin>
				</plugins>
			</build>
		</profile>

		<!-- Mac Intel related settings -->
		<profile>
			<id>MacOS x86_64</id>
			<activation>
				<os>
					<family>mac</family>
					<arch>x86_64</arch>
				</os>
			</activation>

			<build>
				<plugins>
					<plugin>
						<groupId>org.apache.maven.plugins</groupId>
						<artifactId>maven-surefire-plugin</artifactId>
						<version>3.0.0-M5</version>
						<configuration>
							<!-- Ensure stack trace get displayed -->
							<trimStackTrace>false</trimStackTrace>

							<!-- Parallel tests DISABLE PARALLEL TEST OTHERWISE CANVAS DO NOT UPDATE
								PROPERLY (?!)
								<parallel>classes</parallel> <useUnlimitedThreads>true</useUnlimitedThreads>
								<forkCount>1</forkCount>-->

							<!-- Configure Panama -->
							<argLine>
								--enable-native-access=ALL-UNNAMED -Djava.library.path=${native.lib.path.macos}
							</argLine>
						</configuration>
					</plugin>
				</plugins>
			</build>
		</profile>

		<!-- Mac M1 related settings -->
		<profile>
			<id>MacOS Aarch64</id>
			<activation>
				<os>
					<family>mac</family>
					<arch>aarch64</arch>
				</os>
			</activation>

			<build>
				<plugins>
					<plugin>
						<groupId>org.apache.maven.plugins</groupId>
						<artifactId>maven-surefire-plugin</artifactId>
						<version>3.0.0-M5</version>
						<configuration>
							<!-- Ensure stack trace get displayed -->
							<trimStackTrace>false</trimStackTrace>

							<!-- Parallel tests DISABLE PARALLEL TEST OTHERWISE CANVAS DO NOT UPDATE
								PROPERLY (?!)
								<parallel>classes</parallel> <useUnlimitedThreads>true</useUnlimitedThreads>
								<forkCount>1</forkCount>-->

							<!-- Configure Panama -->
							<argLine>
								--enable-native-access=ALL-UNNAMED -Djava.library.path=${native.lib.path.macos}
							</argLine>
						</configuration>
					</plugin>
				</plugins>
			</build>
		</profile>

		<!-- Windows related settings -->
		<profile>
			<id>Windows</id>
			<activation>
				<os>
					<family>Windows</family>
				</os>
			</activation>

			<build>
				<plugins>
					<plugin>
						<groupId>org.apache.maven.plugins</groupId>
						<artifactId>maven-surefire-plugin</artifactId>
						<version>3.0.0-M5</version>
						<configuration>
							<!-- Ensure stack trace get displayed -->
							<trimStackTrace>false</trimStackTrace>

							<!-- Parallel tests DISABLE PARALLEL TEST OTHERWISE CANVAS DO NOT UPDATE
								PROPERLY (?!)
								<parallel>classes</parallel> <useUnlimitedThreads>true</useUnlimitedThreads>
								<forkCount>1</forkCount>-->

								<forkCount>1</forkCount>
								<reuseForks>false</reuseForks>
							<!-- Configure Panama.
							     Override native.lib.path.windows to prepend extra dirs (e.g. Mesa on CI):
							       mvn package -D"native.lib.path.windows=C:\mesa;C:\Windows\system32" -->
							<argLine>
								--enable-native-access=ALL-UNNAMED  -Djava.library.path=${native.lib.path.windows}
							</argLine>
						</configuration>
					</plugin>
				</plugins>
			</build>
		</profile>


		<!-- JDK related activations -->
		<profile>
			<id>disable-java8-doclint</id>
			<activation>
				<jdk>[1.8,)</jdk>
			</activation>
			<properties>
				<additionalparam>-Xdoclint:none</additionalparam>
			</properties>
		</profile>

	</profiles>

	<!-- Extra Maven Repositories to fetch artifacts from -->
	<repositories>
		<repository>
			<id>jzy3d-snapshots</id>
			<name>Jzy3d Snapshots</name>
			<url>https://maven.jzy3d.org/snapshots/</url>
		</repository>
		<repository>
			<id>jzy3d-releases</id>
			<name>Jzy3d Releases</name>
			<url>https://maven.jzy3d.org/releases/</url>
		</repository>
	</repositories>

	<!-- Used to deploy to Panama repository -->
	<distributionManagement>
	<repository>
		<id>panama-ftp</id>
		<name>Panama Maven Folder</name>
		<url>${env.MAVEN_REPO_URL}/maven/releases</url>
	</repository>
	<snapshotRepository>
		<id>panama-ftp</id>
		<name>Panama Maven Folder SNAPSHOTS</name>
		<url>${env.MAVEN_REPO_URL}/maven/snapshots</url>
	</snapshotRepository>
	</distributionManagement>

</project>
