You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by jb...@apache.org on 2010/08/23 21:44:18 UTC

svn commit: r988270 - /commons/sandbox/gsoc/2010/scxml-js/trunk/build.xml

Author: jbeard
Date: Mon Aug 23 19:44:18 2010
New Revision: 988270

URL: http://svn.apache.org/viewvc?rev=988270&view=rev
Log:
Intermediate commit. Shows that it is possible to compile all scxml unit tests. Performance hit seems minimal. Next step will be running tests.

Modified:
    commons/sandbox/gsoc/2010/scxml-js/trunk/build.xml

Modified: commons/sandbox/gsoc/2010/scxml-js/trunk/build.xml
URL: http://svn.apache.org/viewvc/commons/sandbox/gsoc/2010/scxml-js/trunk/build.xml?rev=988270&r1=988269&r2=988270&view=diff
==============================================================================
--- commons/sandbox/gsoc/2010/scxml-js/trunk/build.xml (original)
+++ commons/sandbox/gsoc/2010/scxml-js/trunk/build.xml Mon Aug 23 19:44:18 2010
@@ -1,5 +1,36 @@
 <?xml version="1.0" encoding="ISO-8859-1"?>
-<project name="scxml-js" basedir="." default="all">
+<project name="scxml-js" basedir="." default="generate-javascript">
+	<taskdef resource="net/sf/antcontrib/antcontrib.properties">
+		<classpath>
+			<pathelement location="${basedir}/lib/build-java/ant-contrib-0.6.jar" />
+		</classpath>
+	</taskdef>
+
+	<property name="backends" value="switch,table,state"/>
+	<property name="browsers" value="firefox,ie,chrome"/>
+	<property name="for-ie" value="is-for-ie,is-not-for-ie"/>
+
+	<path id="scxml-js-compiler-classpath">
+		<pathelement location="lib/java/js.jar"/>
+		<pathelement location="lib/java/commons-cli.jar"/>
+		<pathelement location="lib/java/serializer.jar"/>
+		<pathelement location="lib/java/xalan.jar"/>
+		<pathelement location="lib/java/xercesImpl.jar"/>
+		<pathelement location="lib/java/xml-apis.jar"/>
+		<pathelement location="build/scxml-js.jar"/>
+	</path>
+
+	<path id="scxml-tests-xml">
+		<pathelement location="test/kitchen_sink/KitchenSink.xml"/>
+		<pathelement location="test/kitchen_sink/KitchenSink_dataModule.xml"/>
+		<pathelement location="test/kitchen_sink/KitchenSink_performance.xml"/>
+		<pathelement location="test/kitchen_sink/KitchenSink_executableContent.xml"/>
+		<pathelement location="test/conditional_transition/TestConditionalTransition.xml"/>
+		<pathelement location="test/in_predicate/TestInPredicate.xml"/>
+		<pathelement location="test/event_system_properties/TestEventSystemProperties.xml"/>
+		<pathelement location="test/prefix_events/TestPrefixEvents.xml"/>
+		<pathelement location="test/parallel/TestParallel.xml"/>
+	</path>
 
 	<target name="clean">
 	</target>
@@ -8,6 +39,117 @@
 		<mkdir dir="build"/>
 	</target>
 
+	<macrodef name="compile-with-scxml-js-ie">
+		<attribute name="backend"/>
+		<attribute name="test-path"/>
+		<attribute name="out-path"/>
+
+		<sequential>
+			<echo>Compiling @{test-path} to @{out-path} with backend @{backend} and flags for IE...</echo>
+
+			<java classname="org.mozilla.javascript.tools.shell.Main" output="@{out-path}">
+				<classpath>
+					<path refid="scxml-js-compiler-classpath"/>
+				</classpath>
+
+				<arg value="${basedir}/runner.js"/>
+				<arg value="${basedir}"/>
+				<arg value="src/javascript/scxml/cgf/main"/>
+				
+				<arg value="--backend=@{backend}"/>
+				<arg value="--beautify"/>
+				<arg value="--ie"/>
+				<arg value="@{test-path}"/>
+			</java>
+		</sequential>
+	</macrodef>
+
+	<macrodef name="compile-with-scxml-js-no-ie">
+		<attribute name="backend"/>
+		<attribute name="test-path"/>
+		<attribute name="out-path"/>
+
+		<sequential>
+			<echo>Compiling @{test-path} to @{out-path} with backend @{backend}...</echo>
+
+			<java classname="org.mozilla.javascript.tools.shell.Main" output="@{out-path}">
+				<classpath>
+					<path refid="scxml-js-compiler-classpath"/>
+				</classpath>
+
+				<arg value="${basedir}/runner.js"/>
+				<arg value="${basedir}"/>
+				<arg value="src/javascript/scxml/cgf/main"/>
+				
+				<arg value="--backend=@{backend}"/>
+				<arg value="--beautify"/>
+				<arg value="@{test-path}"/>
+			</java>
+		</sequential>
+	</macrodef>
+
+	<!-- run unit and performance tests -->
+	<target name="generate-javascript">
+		<!-- TODO: compile ie and non-ie versions -->
+	
+		<for list="${for-ie}" param="for-ie">
+			<sequential>
+				<for list="${backends}" param="backend">
+					<sequential>
+						<for param="test-path">
+							<path refid="scxml-tests-xml"/>
+							<sequential>
+								<!--
+								<echo>@{for-ie},@{backend},@{test-path}</echo>
+								-->
+
+								<!-- do some manipulation -->
+								<pathconvert property="@{for-ie}-@{backend}-@{test-path}-target-test-path">
+									<path path="@{test-path}"/>
+									<chainedmapper>
+									  <flattenmapper/>
+									  <globmapper from="*.xml" to="build/@{for-ie}/@{backend}/*.js"/>
+									</chainedmapper>
+								</pathconvert>
+
+								<dirname property="@{for-ie}-@{backend}-@{test-path}-target-test-path-dir" file="${@{for-ie}-@{backend}-@{test-path}-target-test-path}"/>
+
+								<echo>${@{for-ie}-@{backend}-@{test-path}-target-test-path}, ${@{for-ie}-@{backend}-@{test-path}-target-test-path-dir}</echo> 
+
+								<!-- execute some tasks -->
+
+								<mkdir dir="${@{for-ie}-@{backend}-@{test-path}-target-test-path-dir}"/>
+								
+								<if>
+									<equals arg1="@{for-ie}" arg2="is-for-ie"/>
+									<then>
+										<compile-with-scxml-js-ie
+											test-path="@{test-path}"
+											backend="@{backend}"
+											out-path="${@{for-ie}-@{backend}-@{test-path}-target-test-path}"/>
+									</then>
+									<else>
+										<compile-with-scxml-js-no-ie
+											test-path="@{test-path}"
+											backend="@{backend}"
+											out-path="${@{for-ie}-@{backend}-@{test-path}-target-test-path}"/>
+									</else>
+								</if>
+							</sequential>
+						</for>
+					</sequential>
+				</for>
+			</sequential>
+		</for>
+	</target>
+
+	<target name="generate-unit-tests-html">
+	</target>
+
+	<target name="run-unit-tests-with-selenium">
+	</target>
+
+	<!-- build standalone executable -->
 	<target name="compile-single-js">
 		<java classname="org.mozilla.javascript.tools.shell.Main">
 			<classpath>