<project>
	 <pathconvert property="equinox.launcher.jar">
	   <first count="1">
	     <sort>
	       <fileset dir="${eclipse.home}/plugins" includes="**/org.eclipse.equinox.launcher_*.jar"/>
	       <reverse xmlns="antlib:org.apache.tools.ant.types.resources.comparators">
	         <date/>
	       </reverse>
	     </sort>
	   </first>
	 </pathconvert>

	<target name="create.product">
		<property name="installableIUs" value="${iu},${features}" />
		<property name="destination" location="${sp:destination}"/>
		<delete dir="${destination}"/>
		<makeurl property="repository" file="${sp:repository}"/>
		<mkdir dir="${destination}"/>
		<echoproperties/>
		<echo message="${equinox.launcher.jar}"/>
		<echo message="${repository}"/>
		<echo message="${destination}"/>
		<java outputproperty="javaoutput" resultproperty="javaresult" jar="${equinox.launcher.jar}" fork="true" failonerror="false" >
			<arg value="-application"/>
			<arg value="org.eclipse.equinox.p2.director"/>
			<arg value="-repository"/>
			<arg value="${repository}"/>
			<arg value="-destination"/>
			<arg value="${destination}/adempiere-client"/>
			<arg value="-profile"/>
			<arg value="${profile}"/>
			<arg value="-profileProperties" />
			<arg value="org.eclipse.update.install.features=true" />
			<arg value="-installIU"/>
			<arg value="${installableIUs}"/>
			<arg value="-p2.os" />
			<arg value="${target.os}" />
			<arg value="-p2.ws" />
			<arg value="${target.ws}" />
			<arg value="-p2.arch" />
			<arg value="${target.arch}" />
			<arg value="-consoleLog"/>
			<arg value="-roaming"/>
			<!-- jvmarg value="-agentlib:jdwp=transport=dt_socket,address=8000,server=y,suspend=y"/ -->
		</java>
		<!-- IDEMPIERE-1618: This block gives an error message on console. Else errors here are hard 
		     to identify for unexperienced users because the java runs in a fork and gives no output to
		     stdout. Messages are still in the latest logfile in ECLIPSE_HOME/configuration 
		     (or buckminster) - thanks to CarlosRuiz for this hint.
		     -->
		<echo message="${javaresult}" />
		<fail message="result: ${javaresult}\n${javaoutput}">
			<condition>
				<not><equals arg1="${javaresult}" arg2="0"/></not>
			</condition>
		</fail>
	</target>
</project>