<?xml version="1.0" encoding="UTF-8"?>
<!--
  	ANT
 
  	Copyright 2017-2024 MicroEJ Corp. All rights reserved.
	This library is provided in source code for use, modification and test, subject to license terms.
	Any modification of the source code will break MicroEJ Corp. warranties on the whole library.
-->
<project name="standalone" default="standalone:run">
	<dirname file="${ant.file.standalone}" property="vee.dir"/>
	<property name="vd.dir" value="${vee.dir}/.."/>
	<!-- Set legacy properties to keep compatibility with tools still using them -->
	<property name="player.dir" value="${vd.dir}"/>
	<property name="firmware.javalibs.dir" value="${vee.dir}/main-application"/>

	<target name="standalone:init">
		<!-- Compute the microej.os.dirname -->
    	<condition property="microej.os.dirname" value="Linux">
			<os family="unix" arch="i386" />
		</condition>
		<condition property="microej.os.dirname" value="Linux64">
			<os family="unix" arch="amd64" />
		</condition>
		<condition property="microej.os.dirname" value="Windows">
			<os family="windows" arch="x86" />
		</condition>
		<condition property="microej.os.dirname" value="Windows64">
			<os family="windows" arch="amd64" />
		</condition>
		<condition property="microej.os.dirname" value="Mac">
			<os family="mac" arch="x86_64"/>
		</condition>
		<condition property="microej.os.dirname" value="MacA64">
			<os family="mac" arch="aarch64"/>
		</condition>

		<property name="output.dir" location="${vd.dir}/output"/>
		<delete dir="${output.dir}" />
		<mkdir dir="${output.dir}" />
		<tempfile prefix="microejlaunch" property="microej.io.tmpdir" destdir="${vd.dir}/tmp"/>
		<mkdir dir="${microej.io.tmpdir}"/>
    </target>

	<target name="standalone:properties" depends="standalone:init">
		<property name="ant.home.dir" location="${vee.dir}/tools/ant" />
		<property name="platform.dir" location="${vee.dir}" />
		<property name="player.resources.dir" location="${vd.dir}/resources" />
		<property name="application.classpath" value="${vd.dir}/resources/nls" />
	</target>

	<target name="standalone:run" depends="standalone:properties">
		<ant antfile="s3Default.microejLaunch" dir="${vee.dir}/scripts">
			<property name="platform.dir" location="${vee.dir}" />
			<property name="jpf.dir" location="${vee.dir}" />
			<property name="microjvm.dir" location="${vee.dir}/MICROJVM" />
			<property name="s3.dir" location="${vee.dir}/S3" />
			<property name="vm.dir" location="${vee.dir}/S3" />
			<property name="vm.name" value="S3" />
			<property name="s3.slow" value="0" /> <!-- This property is mandatory for S3 -->
			<property name="console.logs.period" value="2"/> <!-- This property is mandatory for S3 -->
			<property name="s3.hil.timeout" value="10"/> <!-- This property is mandatory for S3 -->
			<property name="java.library.path" location="${vee.dir}/resources/os/${microej.os.dirname}" />
		</ant>
		
		<delete dir="${microej.io.tmpdir}"/>		
	</target>
</project>