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/19 16:48:20 UTC
svn commit: r987170 - in
/commons/sandbox/gsoc/2010/scxml-js/trunk/test/rhino-jsc/conditional-require-hello-world:
./ Makefile foo/ foo/bar/ foo/bar/bat/ foo/bar/bat/test1.js
foo/bar/bat/test2.js main.js
Author: jbeard
Date: Thu Aug 19 14:48:20 2010
New Revision: 987170
URL: http://svn.apache.org/viewvc?rev=987170&view=rev
Log:
Created new RequireJS compilation experiment.
Added:
commons/sandbox/gsoc/2010/scxml-js/trunk/test/rhino-jsc/conditional-require-hello-world/
commons/sandbox/gsoc/2010/scxml-js/trunk/test/rhino-jsc/conditional-require-hello-world/Makefile (with props)
commons/sandbox/gsoc/2010/scxml-js/trunk/test/rhino-jsc/conditional-require-hello-world/foo/
commons/sandbox/gsoc/2010/scxml-js/trunk/test/rhino-jsc/conditional-require-hello-world/foo/bar/
commons/sandbox/gsoc/2010/scxml-js/trunk/test/rhino-jsc/conditional-require-hello-world/foo/bar/bat/
commons/sandbox/gsoc/2010/scxml-js/trunk/test/rhino-jsc/conditional-require-hello-world/foo/bar/bat/test1.js (with props)
commons/sandbox/gsoc/2010/scxml-js/trunk/test/rhino-jsc/conditional-require-hello-world/foo/bar/bat/test2.js (with props)
commons/sandbox/gsoc/2010/scxml-js/trunk/test/rhino-jsc/conditional-require-hello-world/main.js (with props)
Added: commons/sandbox/gsoc/2010/scxml-js/trunk/test/rhino-jsc/conditional-require-hello-world/Makefile
URL: http://svn.apache.org/viewvc/commons/sandbox/gsoc/2010/scxml-js/trunk/test/rhino-jsc/conditional-require-hello-world/Makefile?rev=987170&view=auto
==============================================================================
--- commons/sandbox/gsoc/2010/scxml-js/trunk/test/rhino-jsc/conditional-require-hello-world/Makefile (added)
+++ commons/sandbox/gsoc/2010/scxml-js/trunk/test/rhino-jsc/conditional-require-hello-world/Makefile Thu Aug 19 14:48:20 2010
@@ -0,0 +1,14 @@
+all: compile-with-closure compile-with-jsc run-compiled
+
+compile-with-closure:
+ ../../../lib/js/requirejs/build/build.sh name=main out=main-built.js baseUrl=. includeRequire=true
+
+compile-with-jsc:
+ java -cp ../../../lib/java/js.jar org.mozilla.javascript.tools.jsc.Main main-built.js
+
+run-compiled:
+ java -cp ../../../lib/java/js.jar:. main_built test1
+ #should print "in test1"
+
+clean:
+ rm main-built.js main_built.class
Propchange: commons/sandbox/gsoc/2010/scxml-js/trunk/test/rhino-jsc/conditional-require-hello-world/Makefile
------------------------------------------------------------------------------
svn:eol-style = native
Added: commons/sandbox/gsoc/2010/scxml-js/trunk/test/rhino-jsc/conditional-require-hello-world/foo/bar/bat/test1.js
URL: http://svn.apache.org/viewvc/commons/sandbox/gsoc/2010/scxml-js/trunk/test/rhino-jsc/conditional-require-hello-world/foo/bar/bat/test1.js?rev=987170&view=auto
==============================================================================
--- commons/sandbox/gsoc/2010/scxml-js/trunk/test/rhino-jsc/conditional-require-hello-world/foo/bar/bat/test1.js (added)
+++ commons/sandbox/gsoc/2010/scxml-js/trunk/test/rhino-jsc/conditional-require-hello-world/foo/bar/bat/test1.js Thu Aug 19 14:48:20 2010
@@ -0,0 +1,4 @@
+require.def("foo/bar/bat/test1",
+{
+ go: function(cliArgs){print("in test1")}
+});
Propchange: commons/sandbox/gsoc/2010/scxml-js/trunk/test/rhino-jsc/conditional-require-hello-world/foo/bar/bat/test1.js
------------------------------------------------------------------------------
svn:eol-style = native
Added: commons/sandbox/gsoc/2010/scxml-js/trunk/test/rhino-jsc/conditional-require-hello-world/foo/bar/bat/test2.js
URL: http://svn.apache.org/viewvc/commons/sandbox/gsoc/2010/scxml-js/trunk/test/rhino-jsc/conditional-require-hello-world/foo/bar/bat/test2.js?rev=987170&view=auto
==============================================================================
--- commons/sandbox/gsoc/2010/scxml-js/trunk/test/rhino-jsc/conditional-require-hello-world/foo/bar/bat/test2.js (added)
+++ commons/sandbox/gsoc/2010/scxml-js/trunk/test/rhino-jsc/conditional-require-hello-world/foo/bar/bat/test2.js Thu Aug 19 14:48:20 2010
@@ -0,0 +1,4 @@
+require.def("foo/bar/bat/test2",
+{
+ go: function(cliArgs){print("in test2")}
+});
Propchange: commons/sandbox/gsoc/2010/scxml-js/trunk/test/rhino-jsc/conditional-require-hello-world/foo/bar/bat/test2.js
------------------------------------------------------------------------------
svn:eol-style = native
Added: commons/sandbox/gsoc/2010/scxml-js/trunk/test/rhino-jsc/conditional-require-hello-world/main.js
URL: http://svn.apache.org/viewvc/commons/sandbox/gsoc/2010/scxml-js/trunk/test/rhino-jsc/conditional-require-hello-world/main.js?rev=987170&view=auto
==============================================================================
--- commons/sandbox/gsoc/2010/scxml-js/trunk/test/rhino-jsc/conditional-require-hello-world/main.js (added)
+++ commons/sandbox/gsoc/2010/scxml-js/trunk/test/rhino-jsc/conditional-require-hello-world/main.js Thu Aug 19 14:48:20 2010
@@ -0,0 +1,20 @@
+(function(cliArgs){
+
+ //works, but is really ugly. duplication of code.
+ //breaking the function out breaks the closure compiler
+ function go(testModule){
+ testModule.go(cliArgs);
+ }
+
+ if(cliArgs[0] == "test1"){
+ require(["foo/bar/bat/test1"],
+ function(testModule){
+ go(testModule);
+ });
+ }else{
+ require(["foo/bar/bat/test2"],
+ function(testModule){
+ go(testModule);
+ });
+ }
+}).call(this,arguments);
Propchange: commons/sandbox/gsoc/2010/scxml-js/trunk/test/rhino-jsc/conditional-require-hello-world/main.js
------------------------------------------------------------------------------
svn:eol-style = native