<!--
	ANT
 
 	Copyright 2012-2022 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="activity">
	<!-- 
		defines isJava8, isJava11 properties
	-->
	<condition property="isJava11" value="true" else="false">
		<matches pattern="11\..*" string="${java.version}"/>
	</condition>
	<condition property="isJava8" value="true" else="false">
		<matches pattern="1\.8\..*" string="${java.version}"/>
	</condition>

	<!-- Disable Nashorn deprecation warning that pollutes the activity logs -->
	<import file="${ant.file.activity}/../microejAntlib.xml" />
	<setSystemProperty name="nashorn.args" value="--no-deprecation-warning" if="${isJava11}"/>
	
	
	<!-- Keep "API" synchronized with other "implementations" of connector -->	
	<macrodef name="start.activity">
		<attribute name="activity.id"/>
		<attribute name="message" default="@{activity.id}"/>
			
		<sequential>
			<echo message="=============== [ @{message} ] ===============" />
		</sequential>
	</macrodef>

	<!-- Keep "API" synchronized with other "implementations" of connector -->
	<macrodef name="start.subactivity">
		<attribute name="activity.id"/>
		<attribute name="message" default="@{activity.id}"/>
		<attribute name="parent.activity.id"/>

		<sequential>
			<start.activity activity.id="@{parent.activity.id}/@{activity.id}" message="@{message}"/>
		</sequential>
	</macrodef>
	
	<!-- Keep "API" synchronized with other "implementations" of connector -->
	<macrodef name="complete.activity">
		<attribute name="activity.id"/>
			
		<sequential>
			<start.activity activity.id="@{activity.id}" message="Completed Successfully"/>
		</sequential>
	</macrodef>
	
</project>
