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/25 21:59:58 UTC

svn commit: r989330 - in /commons/sandbox/gsoc/2010/scxml-js/trunk: ./ src/javascript/scxml/cgf/backends/js/

Author: jbeard
Date: Wed Aug 25 19:59:57 2010
New Revision: 989330

URL: http://svn.apache.org/viewvc?rev=989330&view=rev
Log:
These updates allow building the projects from Maven by delegating to Ant in the compile phase. Created new bash script to run the compiled jar. Updated modules paths as well.

Added:
    commons/sandbox/gsoc/2010/scxml-js/trunk/run_compiled.sh   (with props)
Modified:
    commons/sandbox/gsoc/2010/scxml-js/trunk/build.xml
    commons/sandbox/gsoc/2010/scxml-js/trunk/pom.xml
    commons/sandbox/gsoc/2010/scxml-js/trunk/src/javascript/scxml/cgf/backends/js/StatePatternStatechartGenerator.js
    commons/sandbox/gsoc/2010/scxml-js/trunk/src/javascript/scxml/cgf/backends/js/StateTableStatechartGenerator.js
    commons/sandbox/gsoc/2010/scxml-js/trunk/src/javascript/scxml/cgf/backends/js/SwitchyardStatechartGenerator.js

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=989330&r1=989329&r2=989330&view=diff
==============================================================================
--- commons/sandbox/gsoc/2010/scxml-js/trunk/build.xml (original)
+++ commons/sandbox/gsoc/2010/scxml-js/trunk/build.xml Wed Aug 25 19:59:57 2010
@@ -31,9 +31,9 @@
 	<property name="lib-test-java" location="${lib}/test-java"/>
 	<property name="lib-test-js" location="${lib}/test-js"/>
 
-	<property name="build" location="build"/>
+	<property name="build" value="target"/>
 	<property name="build-js" location="${build}/build-js"/>
-	<property name="build-class" location="${build}/class"/>
+	<property name="build-class" location="${build}/classes"/>
 	<property name="build-jar" location="${build}/jar"/>
 
 
@@ -86,7 +86,7 @@
 		<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"/>
+		<pathelement location="build/scxml-js.jar"/><!--FIXME-->
 	</path>
 
 	<fileset id="stylesheets-to-preprocess" dir="${src}/xslt/backends/js">
@@ -112,11 +112,11 @@
 	</path>
 
 	<target name="clean">
-		<delete dir="build"/>
+		<delete dir="${build}"/>
 	</target>
 	
 	<target name="init">
-		<mkdir dir="build"/>
+		<mkdir dir="${build}"/>
 	</target>
 
 	<macrodef name="rhinoscript">
@@ -451,7 +451,7 @@
 		<xslt 
 			classpathref="xslt-processor-classpath" 
 			style="${src}/xslt/util/preprocess_import.xsl" 
-			destdir="build"
+			destdir="${build}"
 			scanincludeddirectories="false"
 			useImplicitFileset="false">
 
@@ -539,14 +539,12 @@
 									<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}${file.separator}generate-javascript${file.separator}@{for-ie}${file.separator}@{backend}${file.separator}*.js" handledirsep="true"/>
 									</chainedmapper>
 								</pathconvert>
 
-								<!--
 								<echo>@{for-ie}-@{backend}-@{test-path}-target-test-path</echo>
 								<echo>${@{for-ie}-@{backend}-@{test-path}-target-test-path}</echo>
-								-->
 
 								<dirname property="@{for-ie}-@{backend}-@{test-path}-target-test-path-dir" file="${@{for-ie}-@{backend}-@{test-path}-target-test-path}"/>
 
@@ -565,14 +563,12 @@
 										<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}/generate-javascript/*.js" to="${build}/generate-unit-tests-html/*.html" handledirsep="true"/>
 									</chainedmapper>
 								</pathconvert>
 
-								<!--
 								<echo>@{for-ie}-@{backend}-@{test-path}-unit-test-html-location</echo>
 								<echo>${@{for-ie}-@{backend}-@{test-path}-unit-test-html-location}</echo>
-								-->
 
 								<!-- compute relative path to js from html unit test folder -->
 								<pathconvert property="@{for-ie}-@{backend}-@{test-path}-target-test-relative-path">
@@ -587,7 +583,7 @@
 										<scriptmapper language="javascript">
 											self.addMappedName(source.replace("\\","/","g"));
 										</scriptmapper>
-										<globmapper from="build/*" to="../../../*" handledirsep="true"/>
+										<globmapper from="${build}/*" to="../../../*" handledirsep="true"/>
 									</chainedmapper>
 								</pathconvert>
 								
@@ -613,7 +609,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}/generate-javascript/*.js" to="${build}/generate-in-browser-unit-tests-html/*.html" handledirsep="true"/>
 									</chainedmapper>
 								</pathconvert>
 
@@ -635,7 +631,7 @@
 
 	<!-- run unit and performance tests -->
 	<target name="generate-javascript" depends="preprocess-stylesheets,setup-properties">
-		<mkdir dir="build/generate-javascript"/>
+		<mkdir dir="${build}/generate-javascript"/>
 	
 		<for list="${for-ie}" param="for-ie">
 			<sequential>
@@ -673,7 +669,7 @@
 	</target>
 
 	<target name="generate-unit-test-html" depends="setup-properties">
-		<mkdir dir="build/generate-unit-tests-html"/>
+		<mkdir dir="${build}/generate-unit-tests-html"/>
 
 		<for list="${for-ie}" param="for-ie">
 			<sequential>
@@ -702,7 +698,7 @@
 
 
 	<target name="generate-in-browser-unit-test-html" depends="setup-properties">
-		<mkdir dir="build/generate-in-browser-unit-tests-html"/>
+		<mkdir dir="${build}/generate-in-browser-unit-tests-html"/>
 
 		<for list="${for-ie}" param="for-ie">
 			<sequential>
@@ -846,7 +842,7 @@
 
 	<property name="test" location="test"/>
 
-	<target name="compile-single-js">
+	<target name="compile-single-js" depends="preprocess-stylesheets">
 		<mkdir dir="${build-js}"/>
 
 		<java classname="org.mozilla.javascript.tools.shell.Main">
@@ -894,7 +890,7 @@
 
 	<!-- these targets are here to do a simple test of the compiled jar and class-->
 	<target name="run-single-class" depends="compile-single-class">
-		<java classname="${build-class-main-name}" output="build/out.js">
+		<java classname="${build-class-main-name}" output="${build}/out.js">
 			<classpath>
 				<path refid="scxml-js-compiler-classpath"/>
 				<pathelement location="${build-class}"/>
@@ -907,7 +903,7 @@
 	</target>
 
 	<target name="run-single-jar" depends="jar-single-class">
-		<java classname="${build-class-main-name}" output="build/out.js">
+		<java classname="${build-class-main-name}" output="${build}/out.js">
 			<classpath>
 				<path refid="scxml-js-compiler-classpath"/>
 				<pathelement location="${build-jar-main}"/>

Modified: commons/sandbox/gsoc/2010/scxml-js/trunk/pom.xml
URL: http://svn.apache.org/viewvc/commons/sandbox/gsoc/2010/scxml-js/trunk/pom.xml?rev=989330&r1=989329&r2=989330&view=diff
==============================================================================
--- commons/sandbox/gsoc/2010/scxml-js/trunk/pom.xml (original)
+++ commons/sandbox/gsoc/2010/scxml-js/trunk/pom.xml Wed Aug 25 19:59:57 2010
@@ -29,7 +29,7 @@
   <name>Commons SCXML JavaScript (Sandbox)</name>
   <groupId>commons-scxml</groupId>
   <artifactId>commons-scxml-js</artifactId>
-  <version>1.0-SNAPSHOT</version>
+  <version>0.1a-SNAPSHOT</version>
 
   <inceptionYear>2010</inceptionYear>
   <description>
@@ -91,6 +91,35 @@
        <artifactId>maven-site-plugin</artifactId>
        <version>2.1.1</version>
      </plugin>
+      <plugin>
+        <artifactId>maven-antrun-plugin</artifactId>
+        <version>1.4</version>
+        <executions>
+          <execution>
+            <phase>compile</phase>
+            <configuration>
+              <tasks>
+		<ant target="compile-single-class"/>
+              </tasks>
+            </configuration>
+            <goals>
+              <goal>run</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-jar-plugin</artifactId>
+        <configuration>
+          <archive>
+            <manifest>
+              <addClasspath>true</addClasspath>
+              <mainClass>SCXMLCompiler</mainClass>
+            </manifest>
+          </archive>
+        </configuration>
+      </plugin>
    </plugins>
  </build>
 

Added: commons/sandbox/gsoc/2010/scxml-js/trunk/run_compiled.sh
URL: http://svn.apache.org/viewvc/commons/sandbox/gsoc/2010/scxml-js/trunk/run_compiled.sh?rev=989330&view=auto
==============================================================================
--- commons/sandbox/gsoc/2010/scxml-js/trunk/run_compiled.sh (added)
+++ commons/sandbox/gsoc/2010/scxml-js/trunk/run_compiled.sh Wed Aug 25 19:59:57 2010
@@ -0,0 +1,10 @@
+#!/bin/sh
+#the purpose of this file is to bootstrap the compiler when running under rhino
+#we pass in the path to the file, because the rhino scirpt has no way to know where it is executing (nothing like __FILE__ in python)
+#TODO: link up to the page on stackoverflow that describes this 
+#for details, see http://stackoverflow.com/questions/2302948/load-files-on-a-relative-path-to-the-current-file-in-rhino
+
+dn=`dirname $0`
+abspath=`cd $dn; pwd`
+java -cp $abspath/lib/java/js.jar:$abspath/lib/java/commons-cli.jar:$abspath/lib/java/serializer.jar:$abspath/lib/java/xalan.jar:$abspath/lib/java/xercesImpl.jar:$abspath/lib/java/xml-apis.jar:target/commons-scxml-js-0.1a-SNAPSHOT.jar SCXMLCompiler $*
+

Propchange: commons/sandbox/gsoc/2010/scxml-js/trunk/run_compiled.sh
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/sandbox/gsoc/2010/scxml-js/trunk/run_compiled.sh
------------------------------------------------------------------------------
    svn:executable = *

Modified: commons/sandbox/gsoc/2010/scxml-js/trunk/src/javascript/scxml/cgf/backends/js/StatePatternStatechartGenerator.js
URL: http://svn.apache.org/viewvc/commons/sandbox/gsoc/2010/scxml-js/trunk/src/javascript/scxml/cgf/backends/js/StatePatternStatechartGenerator.js?rev=989330&r1=989329&r2=989330&view=diff
==============================================================================
--- commons/sandbox/gsoc/2010/scxml-js/trunk/src/javascript/scxml/cgf/backends/js/StatePatternStatechartGenerator.js (original)
+++ commons/sandbox/gsoc/2010/scxml-js/trunk/src/javascript/scxml/cgf/backends/js/StatePatternStatechartGenerator.js Wed Aug 25 19:59:57 2010
@@ -10,7 +10,7 @@ require.def(
 		"text!src/xslt/ir-compiler/addEventRegularExpressions.xsl",
 		"text!src/xslt/ir-compiler/expandStarEvent.xsl",
 		"text!src/xslt/layout/addTransitionTargetIds.xsl", 
-		"text!build/StatePatternStatechartGenerator_combined.xsl" //preprocessed stylesheet
+		"text!target/StatePatternStatechartGenerator_combined.xsl" //preprocessed stylesheet
 	],
 
 	function(

Modified: commons/sandbox/gsoc/2010/scxml-js/trunk/src/javascript/scxml/cgf/backends/js/StateTableStatechartGenerator.js
URL: http://svn.apache.org/viewvc/commons/sandbox/gsoc/2010/scxml-js/trunk/src/javascript/scxml/cgf/backends/js/StateTableStatechartGenerator.js?rev=989330&r1=989329&r2=989330&view=diff
==============================================================================
--- commons/sandbox/gsoc/2010/scxml-js/trunk/src/javascript/scxml/cgf/backends/js/StateTableStatechartGenerator.js (original)
+++ commons/sandbox/gsoc/2010/scxml-js/trunk/src/javascript/scxml/cgf/backends/js/StateTableStatechartGenerator.js Wed Aug 25 19:59:57 2010
@@ -3,7 +3,7 @@ require.def(
 	"src/javascript/scxml/cgf/backends/js/StateTableStatechartGenerator",
 
 	[ "src/javascript/scxml/cgf/backends/js/AbstractEnumeratedStatechartGenerator", 
-		"text!build/StateTableStatechartGenerator_combined.xsl" //preprocessed stylesheet
+		"text!target/StateTableStatechartGenerator_combined.xsl" //preprocessed stylesheet
 	],
 
 	function(AbstractEnumeratedStatechartGenerator,StateTableStatechartGenerator){

Modified: commons/sandbox/gsoc/2010/scxml-js/trunk/src/javascript/scxml/cgf/backends/js/SwitchyardStatechartGenerator.js
URL: http://svn.apache.org/viewvc/commons/sandbox/gsoc/2010/scxml-js/trunk/src/javascript/scxml/cgf/backends/js/SwitchyardStatechartGenerator.js?rev=989330&r1=989329&r2=989330&view=diff
==============================================================================
--- commons/sandbox/gsoc/2010/scxml-js/trunk/src/javascript/scxml/cgf/backends/js/SwitchyardStatechartGenerator.js (original)
+++ commons/sandbox/gsoc/2010/scxml-js/trunk/src/javascript/scxml/cgf/backends/js/SwitchyardStatechartGenerator.js Wed Aug 25 19:59:57 2010
@@ -3,7 +3,7 @@ require.def(
 	"src/javascript/scxml/cgf/backends/js/SwitchyardStatechartGenerator",
 
 	[ "src/javascript/scxml/cgf/backends/js/AbstractEnumeratedStatechartGenerator", 
-		"text!build/SwitchyardStatechartGenerator_combined.xsl" //preprocessed stylesheet
+		"text!target/SwitchyardStatechartGenerator_combined.xsl" //preprocessed stylesheet
 	],
 
 	function(AbstractEnumeratedStatechartGenerator,SwitchyardStatechartGenerator){