<project xmlns="https://maven.apache.org/POM/4.0.0" xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="https://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
	<modelVersion>4.0.0</modelVersion>
	<parent>
		<groupId>org.jzy3d</groupId>
		<artifactId>panama-gl</artifactId>
		<version>1.3.0</version>
	</parent>
	<artifactId>panama-gl-wrappers-macos</artifactId>
	<name>Panama GL Wrappers - MacOS</name>
	<dependencies>
		<dependency>
			<groupId>org.jzy3d</groupId>
			<artifactId>panama-gl-api</artifactId>
			<version>${project.version}</version>
		</dependency>
		<dependency>
			<groupId>org.jzy3d</groupId>
			<artifactId>panama-gl-api</artifactId>
			<version>${project.version}</version>
			<type>test-jar</type>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>org.jzy3d</groupId>
			<artifactId>panama-gl-bindings-macos</artifactId>
			<version>${panamagl.bindings.version}</version>
		</dependency>

	</dependencies>

	<build>
		<plugins>
			<!--
				Some tests require -XstartOnFirstThread (GLUT context, GL profile
				querying with GLUT) while others must NOT use it (they would freeze).
				The -XstartOnFirstThread execution lives in the macOS-only profile below.
			-->
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-surefire-plugin</artifactId>
				<version>3.0.0-M5</version>

				<!-- Default execution: all tests EXCEPT those needing -XstartOnFirstThread -->
				<configuration>
					<excludes>
						<exclude>**/TestGLProfile_macOS_arm.java</exclude>
						<exclude>**/TestGLUTContext_macOS.java</exclude>
						<exclude>**/TestAppKitMainThread.java</exclude>
					</excludes>
				</configuration>
			</plugin>
		</plugins>
	</build>

	<profiles>
		<!--
			-XstartOnFirstThread is a macOS-only JVM flag. Running this execution
			on Linux or Windows crashes the forked VM immediately (exit code 1).
			Restrict it to macOS builds only.
		-->
		<profile>
			<id>macos-tests-requiring-main-thread</id>
			<activation>
				<os>
					<family>mac</family>
				</os>
			</activation>
			<build>
				<plugins>
					<plugin>
						<groupId>org.apache.maven.plugins</groupId>
						<artifactId>maven-surefire-plugin</artifactId>
						<version>3.0.0-M5</version>
						<executions>
							<execution>
								<id>tests-requiring-main-thread</id>
								<goals>
									<goal>test</goal>
								</goals>
								<configuration>
									<excludes combine.self="override" />
									<includes>
										<include>**/TestGLProfile_macOS_arm.java</include>
										<include>**/TestGLUTContext_macOS.java</include>
										<include>**/TestAppKitMainThread.java</include>
									</includes>
									<argLine>
										-XstartOnFirstThread --enable-native-access=ALL-UNNAMED
										-Djava.library.path=.:/System/Library/Frameworks/OpenGL.framework/Versions/Current/Libraries/
									</argLine>
								</configuration>
							</execution>
						</executions>
					</plugin>
				</plugins>
			</build>
		</profile>
	</profiles>

</project>
