<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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
	<modelVersion>4.0.0</modelVersion>
	<groupId>ExploDTwin.product</groupId>
	<artifactId>ExploDTwin.product</artifactId>
	<version>0.0.1-SNAPSHOT</version>
	<packaging>eclipse-repository</packaging>

	<parent>
		<groupId>eu.fbk.eclipse.explodtwin</groupId>
		<artifactId>eu.fbk.eclipse.explodtwin.products</artifactId>
		<version>1.0.0-SNAPSHOT</version>
	</parent>

	<properties>
		<productId>SAWS2</productId>
	</properties>

	<build>
		<pluginManagement>
			<plugins>
				<plugin>
					<groupId>org.eclipse.m2e</groupId>
					<artifactId>lifecycle-mapping</artifactId>
					<version>1.0.0</version>
					<configuration>
						<lifecycleMappingMetadata>
							<pluginExecutions>
								<pluginExecution>
									<pluginExecutionFilter>
										<groupId>org.apache.maven.plugins</groupId>
										<artifactId>maven-clean-plugin</artifactId>
										<versionRange>[2.5,)</versionRange>
										<goals>
											<goal>clean</goal>
										</goals>
									</pluginExecutionFilter>
									<action>
										<ignore></ignore>
									</action>
								</pluginExecution>
							</pluginExecutions>
						</lifecycleMappingMetadata>
					</configuration>
				</plugin>
			</plugins>
		</pluginManagement>

		<plugins>
			<plugin>
				<groupId>org.eclipse.tycho</groupId>
				<artifactId>tycho-p2-repository-plugin</artifactId>
				<version>${tycho-version}</version>
				<configuration>
					<includeAllDependencies>true</includeAllDependencies>
				</configuration>
			</plugin>
			<plugin>
				<groupId>org.eclipse.tycho</groupId>
				<artifactId>tycho-p2-director-plugin</artifactId>
				<executions>
					<execution>
						<id>materialize-products</id>
						<goals>
							<goal>materialize-products</goal>
						</goals>
					</execution>
					<execution>
						<id>archive-products</id>
						<goals>
							<goal>archive-products</goal>
						</goals>
					</execution>
				</executions>
				<configuration>
					<products>
						<product>
							<id>${productId}</id>
							<archiveFileName>${productId}</archiveFileName>
						</product>
					</products>
				</configuration>
			</plugin>
			<plugin>
				<groupId>io.github.download-maven-plugin</groupId>
				<artifactId>download-maven-plugin</artifactId>
				<version>2.0.0</version>
				<executions>
					<execution>
						<id>download-windows-jdk</id>
						<phase>prepare-package</phase>
						<goals>
							<goal>wget</goal>
						</goals>
						<configuration>
							<url>https://github.com/adoptium/temurin17-binaries/releases/download/jdk-17.0.16+8/OpenJDK17U-jdk_x64_windows_hotspot_17.0.16_8.zip</url>
							<unpack>false</unpack>
							<outputDirectory>${project.build.directory}/temp</outputDirectory>
							<outputFileName>jdk-win64.zip</outputFileName>
						</configuration>
					</execution>
					<execution>
						<id>download-linux-jdk</id>
						<phase>prepare-package</phase>
						<goals>
							<goal>wget</goal>
						</goals>
						<configuration>
							<url>https://github.com/adoptium/temurin17-binaries/releases/download/jdk-17.0.16+8/OpenJDK17U-jdk_x64_linux_hotspot_17.0.16_8.tar.gz</url>
							<unpack>false</unpack>
							<outputDirectory>${project.build.directory}/temp</outputDirectory>
							<outputFileName>jdk-linux64.tar.gz</outputFileName>
						</configuration>
					</execution>
				</executions>
			</plugin>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-antrun-plugin</artifactId>
				<version>3.1.0</version>
				<executions>
					<execution>
						<id>unpack-windows-jdk</id>
						<phase>prepare-package</phase>
						<goals>
							<goal>run</goal>
						</goals>
						<configuration>
							<target>
								<unzip
									src="${project.build.directory}/temp/jdk-win64.zip"
									dest="${project.build.directory}/products/${productId}/win32/win32/x86_64/jdk">
									<mapper type="regexp" from="^[^/]+/(.*)$" to="\1" />
								</unzip>
							</target>
						</configuration>
					</execution>
					<execution>
						<id>unpack-linux-jdk</id>
						<phase>prepare-package</phase>
						<goals>
							<goal>run</goal>
						</goals>
						<configuration>
							<target>
								<untar
									src="${project.build.directory}/temp/jdk-linux64.tar.gz"
									dest="${project.build.directory}/products/${productId}/linux/gtk/x86_64/jdk"
									compression="gzip">
									<mapper type="regexp" from="^[^/]+/(.*)$" to="\1"/>
								</untar>
								<chmod perm="755" type="file">
									<fileset dir="${project.build.directory}/products/${productId}/linux/gtk/x86_64/jdk/">
                                        <include name="bin/*"/>
                                        <include name="lib/jspawnhelper"/>
                                        <include name="lib/jexec"/>
									</fileset>
								</chmod>
							</target>
						</configuration>
					</execution>
				</executions>
			</plugin>
		</plugins>
	</build>

</project>
