Author: jbeard
Date: Thu Mar 17 16:22:11 2011
New Revision: 1082577

URL: http://svn.apache.org/viewvc?rev=1082577&view=rev
Log:
Added Ant task to use the bash+xsltproc based front-end. This is useful, 
because this is the fastest frontend: about 40 times faster than the 
Rhino-based frontend in some cases, according to my tests. The next step will 
be to hook this into the existing unit testing infrastructure.

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

Modified: commons/sandbox/gsoc/2010/scxml-js/trunk/build-common.xml
URL: 
http://svn.apache.org/viewvc/commons/sandbox/gsoc/2010/scxml-js/trunk/build-common.xml?rev=1082577&r1=1082576&r2=1082577&view=diff
==============================================================================
--- commons/sandbox/gsoc/2010/scxml-js/trunk/build-common.xml (original)
+++ commons/sandbox/gsoc/2010/scxml-js/trunk/build-common.xml Thu Mar 17 
16:22:11 2011
@@ -30,6 +30,7 @@
        <property name="build" value="target"/>
        <property name="build-xsl" location="${build}/xsl"/>
        <property name="build-js" location="${build}/build-js"/>
+       <property name="build-gen-js" location="${build}/generate-javascript"/>
        <property name="build-class" location="${build}/classes"/>
        <property name="build-jar" location="${build}/jar"/>
        <property name="build-xsl-dep-list" location="${build}/xsl-dep-list"/>
@@ -43,12 +44,16 @@
        <property name="is_for_ie" value="is-for-ie"/>
        <property name="is_not_for_ie" value="is-not-for-ie"/>
 
-       <property name="language-frontends" value="js,py,sh"/>
+       <property name="bash" value="sh"/>
+       <property name="language-frontends" value="js,py,${bash}"/>
 
+       <property name="switch-backend" value="switch"/>
+       <property name="table-backend" value="table"/>
+       <property name="state-backend" value="state"/>
        <!--
-       <property name="backends" value="state"/>
+       <property name="backends" value="${state-backend}"/>
        -->
-       <property name="backends" value="switch,table,state"/>
+       <property name="backends" 
value="${switch-backend},${table-backend},${state-backend}"/>
        <property name="browsers" value="firefox,chrome"/>
        <!--
        <property name="browsers" value="firefox,${ie_browser_name},chrome"/>
@@ -82,6 +87,7 @@
        <property name="path_to_dojo" value="${path_to_dojo_base}/dojo.js"/>
 
        <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"/>
@@ -90,8 +96,9 @@
                <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"/>
                <pathelement 
location="test/targetless-transition/TestTargetlessTransition.xml"/>
+               -->
+               <pathelement location="test/parallel/TestParallel.xml"/>
        </path>
 
        <property name="drawing-tool-lib" value="demo/drawing-tool/lib"/>
@@ -663,7 +670,7 @@
 
        <target name="setup-properties" depends="setup-antcontrib">
 
-               <for param="test-path">
+               <for param="test-path" parallel="true" threadCount="4">
                        <path refid="scxml_tests_xml"/>
                        <sequential>
                                <!-- for generate-unit-tests-html task -->
@@ -734,7 +741,8 @@
                                                                        <path 
path="@{test-path}"/>
                                                                        
<chainedmapper>
                                                                          
<flattenmapper/>
-                                                                         
<globmapper from="*.xml" 
to="${build}${file.separator}generate-javascript${file.separator}@{for-ie}${file.separator}@{backend}${file.separator}*.js"
 handledirsep="true"/>
+
+                                                                         
<globmapper from="*.xml" 
to="${build-gen-js}${file.separator}@{for-ie}${file.separator}@{backend}${file.separator}*.js"
 handledirsep="true"/>
                                                                        
</chainedmapper>
                                                                </pathconvert>
 
@@ -758,7 +766,7 @@
                                                                                
<scriptmapper language="javascript">
                                                                                
        self.addMappedName(source.replace("\\","/","g"));
                                                                                
</scriptmapper>
-                                                                               
<globmapper from="${build}/generate-javascript/*.js" 
to="${build}/generate-unit-tests-html/*.html" handledirsep="true"/>
+                                                                               
<globmapper from="${build-gen-js}/*.js" 
to="${build}/generate-unit-tests-html/*.html" handledirsep="true"/>
                                                                        
</chainedmapper>
                                                                </pathconvert>
 
@@ -804,7 +812,7 @@
                                                                                
<scriptmapper language="javascript">
                                                                                
        self.addMappedName(source.replace("\\","/","g"));
                                                                                
</scriptmapper>
-                                                                               
<globmapper from="${build}/generate-javascript/*.js" 
to="${build}/generate-in-browser-unit-tests-html/*.html" handledirsep="true"/>
+                                                                               
<globmapper from="${build-gen-js}/*.js" 
to="${build}/generate-in-browser-unit-tests-html/*.html" handledirsep="true"/>
                                                                        
</chainedmapper>
                                                                </pathconvert>
 

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=1082577&r1=1082576&r2=1082577&view=diff
==============================================================================
--- commons/sandbox/gsoc/2010/scxml-js/trunk/build.xml (original)
+++ commons/sandbox/gsoc/2010/scxml-js/trunk/build.xml Thu Mar 17 16:22:11 2011
@@ -103,8 +103,77 @@
        </target>
        -->
 
+       <target name="make-sh-modules-executable" 
depends="build-language-frontend-modules">
+               <chmod dir="${build-language-frontend-modules}/${bash}/" 
includes="*.sh" perm="+x"/>
+       </target>
+
+       <target name="generate-javascript-with-bash" 
+               
depends="setup-properties,preprocess-stylesheets,build-language-frontend-modules,make-sh-modules-executable"
 >
+               <!-- should have same behaviour as generate-javascript task -->
+
+               <!-- need to map backend to compiled sh frontend -->
+               <mkdir dir="${build-gen-js}"/>
+
+               <path id="built-sh-frontend-modules">
+                       <fileset 
dir="${build-language-frontend-modules}/${bash}/" includes="*.sh"/>
+               </path>
+
+               <for list="${for-ie}" param="for-ie">
+                       <sequential>
+                               <for param="sh-module">
+                                       <path 
refid="built-sh-frontend-modules"/>
+
+                                       <sequential>
+
+                                               <path id="@{sh-module}-path" 
location="@{sh-module}"/>
+
+                                               <pathconvert 
property="@{sh-module}-corresponding-backend" refid="@{sh-module}-path">
+                                                       <mapper>
+                                                               <chainedmapper>
+                                                                       
<flattenmapper/>
+                                                                       
<scriptmapper language="javascript">
+                                                                               
var map = {
+                                                                               
        "StatePatternStatechartGenerator.sh" : 
project.getProperty("state-backend"),
+                                                                               
        "StateTableStatechartGenerator.sh" : 
project.getProperty("table-backend"),
+                                                                               
        "SwitchyardStatechartGenerator.sh" : 
project.getProperty("switch-backend")
+                                                                               
}
+                                                                               
self.addMappedName(map[source]);
+                                                                       
</scriptmapper>
+                                                               </chainedmapper>
+                                                       </mapper>
+                                               </pathconvert>
+
+                                               <for 
list="${@{sh-module}-corresponding-backend}" param="corresponding-backend">
+
+                                                       <sequential>
+
+                                                               <for 
param="test-path">
+                                                                       <path 
refid="scxml_tests_xml"/>
+
+                                                                       
<sequential>
+
+                                                                               
<echo>${@{for-ie}-@{corresponding-backend}-@{test-path}-target-test-path}, 
${@{for-ie}-@{corresponding-backend}-@{test-path}-target-test-path-dir}</echo> 
+
+                                                                               
<mkdir 
dir="${@{for-ie}-@{corresponding-backend}-@{test-path}-target-test-path-dir}"/>
+
+                                                                               
<exec executable="@{sh-module}" 
+                                                                               
        
output="${@{for-ie}-@{corresponding-backend}-@{test-path}-target-test-path}">
+                                                                               
        <arg value="@{test-path}"/>
+                                                                               
</exec>
+
+                                                                       
</sequential>
+                                                               </for>
+                                                       </sequential>
+                                               </for>
+                                       </sequential>
+                               </for>
+                       </sequential>
+               </for>
+       </target>
+
        <!-- run unit and performance tests -->
-       <target name="generate-javascript" 
depends="setup-properties,preprocess-stylesheets,build-language-frontend-modules,generate-javascript-mvn"/>
+       <target name="generate-javascript" 
+               
depends="setup-properties,preprocess-stylesheets,build-language-frontend-modules,generate-javascript-mvn"/>
 
        <target name="generate-unit-test-html" depends="setup-properties">
                <mkdir dir="${build}/generate-unit-tests-html"/>


Reply via email to