<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>org.idempiere</groupId>
		<artifactId>org.idempiere.parent</artifactId>
		<version>${revision}</version>
		<relativePath>../org.idempiere.parent/pom.xml</relativePath>
	</parent>
	<artifactId>org.idempiere.p2</artifactId>
	<packaging>eclipse-repository</packaging>
	<properties>
		<materializeProduct>package</materializeProduct>
		<assembleRepository>package</assembleRepository>
	</properties>
	<build>
		<plugins>
			<plugin>
				<artifactId>maven-clean-plugin</artifactId>
				<executions>
					<execution>
						<id>auto-clean</id>
						<phase>validate</phase>
						<goals>
							<goal>clean</goal>
						</goals>

						<configuration>
							<skip>${skipClean}</skip>
							<excludeDefaultDirectories>false</excludeDefaultDirectories>
							<filesets>
								<fileset>
									<directory>${project.basedir}/lib</directory>
									<includes>
										<include>*.jar</include>
									</includes>
									<followSymlinks>false</followSymlinks>
		        				</fileset>
							</filesets>
						</configuration>
					</execution>
					<execution>
						<id>always-clean</id>
						<phase>validate</phase>
						<goals>
							<goal>clean</goal>
						</goals>

						<configuration>
							<skip>false</skip>
							<excludeDefaultDirectories>true</excludeDefaultDirectories>
							<filesets>
								<fileset>
									<directory>${project.basedir}/target</directory>
									<includes>
								      <include>local-artifacts.properties</include>
								      <include>repository</include>
								      <include>repository/**</include>
								    </includes>
									<followSymlinks>false</followSymlinks>
		        				</fileset>
							</filesets>
						</configuration>
					</execution>
				</executions>
			</plugin>
			<plugin>
				<groupId>org.eclipse.tycho</groupId>
				<artifactId>tycho-p2-publisher-plugin</artifactId>
				<executions>
					<execution>
						<id>default-publish-osgi-ee</id>
						<goals>
							<goal>publish-osgi-ee</goal>
						</goals>
						<phase>${materializeProduct}</phase>
					</execution>
					<execution>
						<id>default-publish-categories</id>
						<goals>
							<goal>publish-categories</goal>
						</goals>
						<phase>${materializeProduct}</phase>
					</execution>
					<execution>
						<id>default-publish-products</id>
						<goals>
							<goal>publish-products</goal>
						</goals>
						<phase>package</phase>
					</execution>
					<execution>
						<id>default-attach-artifacts</id>
						<goals>
							<goal>attach-artifacts</goal>
						</goals>
						<phase>package</phase>
					</execution>
				</executions>
			</plugin>
			<plugin>
				<groupId>org.eclipse.tycho</groupId>
				<artifactId>tycho-p2-repository-plugin</artifactId>
				<executions>
					<execution>
						<id>default-assemble-repository</id>
						<goals>
							<goal>assemble-repository</goal>
						</goals>
						<phase>${assembleRepository}</phase>
					</execution>
					<execution>
						<id>default-archive-repository</id>
						<goals>
							<goal>archive-repository</goal>
						</goals>
						<phase>${assembleRepository}</phase>
					</execution>
				</executions>
				<configuration>
					<!-- from import package maven can lookup bundle from all repositorys 
						declare on target platform, also maven local so default generated site-p2 
						don't include that bundle. this configuration change default behavior -->
					<includeAllDependencies>true</includeAllDependencies>
					<!-- https://bugs.eclipse.org/bugs/show_bug.cgi?id=512396 -->
					<xzCompress>false</xzCompress>
				</configuration>
			</plugin>
			<plugin>
				<groupId>org.eclipse.tycho</groupId>
				<artifactId>tycho-p2-director-plugin</artifactId>
				<executions>
					<execution>
						<!-- install the product using the p2 director -->
						<id>default-materialize-products</id>
						<goals>
							<goal>materialize-products</goal>
						</goals>
						<phase>${materializeProduct}</phase>
					</execution>
				</executions>
				<configuration>
					<source>repository</source>
					<products>
						<product>
							<!-- The uid in the .product file, NOT the name of the .product file -->
							<id>${idempiere.product.id}</id>
							<archiveFileName>idempiere-server-${unqualifiedVersion}-${buildQualifier}</archiveFileName>
						</product>
					</products>
				</configuration>
			</plugin>
			<plugin>
				<groupId>org.eclipse.tycho</groupId>
				<artifactId>tycho-eclipse-plugin</artifactId>
				<executions>
					<execution>
						<id>default-eclipse-run-linux</id>
						<goals>
							<goal>eclipse-run</goal>
						</goals>
						<phase>${materializeProduct}</phase>
						<configuration>
							<applicationArgs>
								<arg>-application</arg>
								<arg>org.eclipse.equinox.p2.director</arg>
								<arg>-repository</arg>
								<arg>file:${project.build.directory}/repository</arg>
								<arg>-destination</arg>
								<arg>${project.build.directory}/products/${idempiere.product.id}/linux/gtk/x86_64</arg>
								<arg>-installIU</arg>
								<arg>${extra.iu.install}</arg>
								<arg>-profileProperties</arg> 
								<arg>org.eclipse.update.install.features=true</arg>
								<arg>-p2.os</arg>
								<arg>linux</arg>
								<arg>-p2.ws</arg>
								<arg>gtk</arg>
								<arg>-p2.arch</arg>
								<arg>x86_64</arg>
								<arg>-consoleLog</arg>
								<arg>-roaming</arg>
							</applicationArgs>
						</configuration>
					</execution>
					<execution>
						<id>default-eclipse-run-win32</id>
						<goals>
							<goal>eclipse-run</goal>
						</goals>
						<phase>${materializeProduct}</phase>
						<configuration>
							<applicationArgs>
								<arg>-application</arg>
								<arg>org.eclipse.equinox.p2.director</arg>
								<arg>-repository</arg>
								<arg>file:${project.build.directory}/repository</arg>
								<arg>-destination</arg>
								<arg>${project.build.directory}/products/${idempiere.product.id}/win32/win32/x86_64</arg>
								<arg>-installIU</arg>
								<arg>${extra.iu.install}</arg>
								<arg>-profileProperties</arg> 
								<arg>org.eclipse.update.install.features=true</arg>
								<arg>-p2.os</arg>
								<arg>win32</arg>
								<arg>-p2.ws</arg>
								<arg>win32</arg>
								<arg>-p2.arch</arg>
								<arg>x86_64</arg>
								<arg>-consoleLog</arg>
								<arg>-roaming</arg>
							</applicationArgs>
						</configuration>
					</execution>
					<execution>
						<id>default-eclipse-run-macosx</id>
						<goals>
							<goal>eclipse-run</goal>
						</goals>
						<phase>${materializeProduct}</phase>
						<configuration>
							<applicationArgs>
								<arg>-application</arg>
								<arg>org.eclipse.equinox.p2.director</arg>
								<arg>-repository</arg>
								<arg>file:${project.build.directory}/repository</arg>
								<arg>-destination</arg>
								<arg>${project.build.directory}/products/${idempiere.product.id}/macosx/cocoa/x86_64</arg>
								<arg>-installIU</arg>
								<arg>${extra.iu.install}</arg>
								<arg>-profileProperties</arg> 
								<arg>org.eclipse.update.install.features=true</arg>
								<arg>-p2.os</arg>
								<arg>macosx</arg>
								<arg>-p2.ws</arg>
								<arg>cocoa</arg>
								<arg>-p2.arch</arg>
								<arg>x86_64</arg>
								<arg>-consoleLog</arg>
								<arg>-roaming</arg>
							</applicationArgs>
						</configuration>
					</execution>
				</executions>
			</plugin>
		</plugins>
	</build>	
</project>
