<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>io.sarl.maven</groupId>
		<artifactId>io.sarl.maven.external</artifactId>
		<version>0.12.0</version>
	</parent>

	<artifactId>io.sarl.javafx</artifactId>
	<packaging>jar</packaging>
	<name>SDK JavaFX Library</name>

	<properties>
		<openjfx.fxml.linux.path>${project.basedir}/../../../build-tools/libs/jfxrt.jar</openjfx.fxml.linux.path>
		<openjfx.fxml.mac.path>${project.basedir}/../../../build-tools/libs/jfxrt.jar</openjfx.fxml.mac.path>
		<openjfx.fxml.win.path>${project.basedir}/../../../build-tools/libs/jfxrt.jar</openjfx.fxml.win.path>
	</properties>

	<dependencies>
		<dependency>
			<groupId>io.sarl.maven</groupId>
			<artifactId>io.sarl.maven.sdk</artifactId>
		</dependency>
	</dependencies>

	<build>
		<plugins>
			<plugin>
				<artifactId>maven-jar-plugin</artifactId>
				<configuration>
					<archive>
						<manifestEntries>
							<Automatic-Module-Name>${project.artifactId}</Automatic-Module-Name>
						</manifestEntries>
					</archive>
				</configuration>
			</plugin>
			<!-- The following plugin is included in order to add the source folder 
				into the Eclipse env. -->
			<plugin>
				<groupId>org.codehaus.mojo</groupId>
				<artifactId>build-helper-maven-plugin</artifactId>
				<executions>
					<execution>
						<id>add-source</id>
						<phase>initialize</phase>
						<goals>
							<goal>add-source</goal>
						</goals>
						<configuration>
							<sources>
								<source>src/main/generated-sources/sarl</source>
							</sources>
						</configuration>
					</execution>
				</executions>
			</plugin>
			<plugin>
				<artifactId>maven-compiler-plugin</artifactId>
				<configuration>
					<source>${sarl-dsl.min.jdk.version}</source>
					<target>${sarl-dsl.min.jdk.version}</target>
					<encoding>${project.build.sourceEncoding}</encoding>
				</configuration>
			</plugin>
			<plugin>
				<groupId>io.sarl.maven</groupId>
				<artifactId>sarl-maven-plugin</artifactId>
				<!-- Maven extension mechanism seems not working because the plugin is 
					defined in the same project. The different goals must be explicitly provided. -->
				<executions>
					<execution>
						<id>sarl-compiler-init</id>
						<phase>initialize</phase>
						<goals>
							<goal>initialize</goal>
						</goals>
					</execution>
					<execution>
						<id>sarl-compiler-compile</id>
						<phase>compile</phase>
						<goals>
							<goal>compile</goal>
						</goals>
					</execution>
					<execution>
						<id>sarl-compiler-clean</id>
						<phase>clean</phase>
						<goals>
							<goal>clean</goal>
						</goals>
					</execution>
				</executions>
				<configuration>
					<tycho>true</tycho>
					<source>${sarl-dsl.min.jdk.version}</source>
					<target>${sarl-dsl.min.jdk.version}</target>
					<encoding>${project.build.sourceEncoding}</encoding>
					<input>src/main/sarl</input>
					<output>src/main/generated-sources/sarl</output>
					<generateInlines>true</generateInlines>
					<generateStorageFiles>true</generateStorageFiles>
					<generateTraceFiles>true</generateTraceFiles>
				</configuration>
			</plugin>
		</plugins>
	</build>

	<!-- ======================================= -->
	<!-- ==== Release Management === -->
	<!-- ======================================= -->
	<profiles>
		<profile>
			<id>openjfx-with-env-var</id>
			<activation>
				<property>
					<name>env.OPENJFX_LIB_PATH</name>
				</property>
			</activation>
			<dependencies>
				<dependency>
					<groupId>org.openjfx</groupId>
					<artifactId>javafx-fxml</artifactId>
					<version>${java.version}</version>
					<scope>system</scope>
					<systemPath>${env.OPENJFX_LIB_PATH}</systemPath>
				</dependency>
			</dependencies>
		</profile>
		<profile>
			<id>openjfx-on-jdk11-box</id>
			<activation>
				<property>
					<name>!env.OPENJFX_LIB_PATH</name>
				</property>
				<jdk>[11,)</jdk>
			</activation>
			<dependencies>
				<dependency>
					<groupId>org.openjfx</groupId>
					<artifactId>javafx-fxml</artifactId>
					<version>${openjfx.version}</version>
				</dependency>
			</dependencies>
		</profile>
		<profile>
			<id>openjfx-on-linux-jdk1.8-box</id>
			<activation>
				<property>
					<name>!env.OPENJFX_LIB_PATH</name>
				</property>
				<jdk>[1.8,11)</jdk>
				<os>
					<family>unix</family>
					<name>linux</name>
				</os>
			</activation>
			<dependencies>
				<dependency>
					<groupId>org.openjfx</groupId>
					<artifactId>javafx-fxml</artifactId>
					<version>${java.version}</version>
					<scope>system</scope>
					<systemPath>${openjfx.fxml.linux.path}</systemPath>
				</dependency>
			</dependencies>
		</profile>
		<profile>
			<id>openjfx-on-mac-jdk8-box</id>
			<activation>
				<property>
					<name>!env.OPENJFX_LIB_PATH</name>
				</property>
				<jdk>[1.8,11)</jdk>
				<os>
					<family>mac</family>
				</os>
			</activation>
			<dependencies>
				<dependency>
					<groupId>org.openjfx</groupId>
					<artifactId>javafx-fxml</artifactId>
					<version>${java.version}</version>
					<scope>system</scope>
					<systemPath>${openjfx.fxml.mac.path}</systemPath>
				</dependency>
			</dependencies>
		</profile>
		<profile>
			<id>openjfx-on-windows-jdk8-box</id>
			<activation>
				<property>
					<name>!env.OPENJFX_LIB_PATH</name>
				</property>
				<jdk>[1.8,11)</jdk>
				<os>
					<family>windows</family>
				</os>
			</activation>
			<dependencies>
				<dependency>
					<groupId>org.openjfx</groupId>
					<artifactId>javafx-fxml</artifactId>
					<version>${java.version}</version>
					<scope>system</scope>
					<systemPath>${openjfx.fxml.win.path}</systemPath>
				</dependency>
			</dependencies>
		</profile>
		<profile>
			<id>maven-release-of-maven-javafx-plugin</id>
			<activation>
				<property>
					<name>performRelease</name>
					<value>true</value>
				</property>
			</activation>
		</profile>
	</profiles>

</project>
