Source

ant-events / build.xml

Full commit
<project name="ant-events" default="build" basedir="." >
	<target name="build" >
		<mkdir dir="classes" />
		<javac
			srcdir="src"
			destdir="classes"
			target="1.4"
			source="1.4"
			debug="on"
			includeantruntime="true"
		/>
		<copy todir="classes" >
			<fileset dir="src" includes="**/*.xml" />
		</copy>
		<mkdir dir="bin" />
		<jar
			destfile="bin/ant-events.jar"
			basedir="classes"
		/>
	</target>
	
	<target name="clean" >
		<delete dir="classes" quiet="true" />
		<delete dir="bin" quiet="true" />
	</target>
	
	<target name="test" depends="build" >
		<typedef classpath="${basedir}/bin/ant-events.jar" resource="antlib.xml" />
		
		<event name="foo" description="First event with default priority" />
		<event name="foo" description="Second event with default priority" />
		
		<event name="foo" priority="2" description="First prioritized event" />
		<event name="foo" description="Third event with default priority" />
		<event name="foo" priority="1" description="Second prioritized event" />
		<event name="foo" priority="3" description="Third prioritized event" />
		
		<event name="foo" description="Fourth event with default priority" />
		
		<echo message="Executing, natural order" />
		<fire-event name="foo" header="$${event.name} ($${event.priority}): $${event.description}" />
		<echo message="Executing, ascending order" />
		<fire-event name="foo" order="ascending" header="$${event.name} ($${event.priority}): $${event.description}" />
		<echo message="Executing, descending order" />
		<fire-event name="foo" order="descending" header="$${event.name} ($${event.priority}): $${event.description}" />
		
		<echo message="Adding another event" />
		
		<event name="foo" priority="4" description="Fourth prioritized event" />
		
		<echo message="Executing, natural order" />
		<fire-event name="foo" header="$${event.name} ($${event.priority}): $${event.description}" />
		<echo message="Executing, ascending order" />
		<fire-event name="foo" order="ascending" header="$${event.name} ($${event.priority}): $${event.description}" />
		<echo message="Executing, descending order" />
		<fire-event name="foo" order="descending" header="$${event.name} ($${event.priority}): $${event.description}" />
		
		<!-- Test context closure -->
		<local name="loc.value1" />
		<property name="loc.value1" value="Not so local value" />
		
		<sequential>
			<local name="loc.value1" />
			<property name="loc.value1" value="Local value 1" />
			<event name="bar" >
				<echo message="$${global.text} = ${global.text}" />
				<echo message="$${loc.value1} = ${loc.value1}" />
			</event>
		</sequential>
		
		<fire-event name="bar" />
		
		<!-- Test context closure, complex one -->
		
		
	</target>
	
	<property name="global.text" value="Global text" />
</project>