Browse Source

Added -J as Jtalk IDE target to jtalkc and made jtalkc smarter when resolving files.

Göran Krampe 13 years ago
parent
commit
e46a902fa8
1 changed files with 33 additions and 14 deletions
  1. 33 14
      bin/jtalkc

+ 33 - 14
bin/jtalkc

@@ -7,7 +7,7 @@ JTALK=$(readlink -f `dirname ${0}`/..)
 
 function usage {
 	cat <<ENDOFHELP
-Usage: $0 [-N|D|E] [-K|C] [-o] [-O] [-m class] [-M file]
+Usage: $0 [-N|D|E] [-K|C|J] [-o] [-O] [-m class] [-M file]
           [-i] [-I file] file1 [file2 ...] [Program]
 
    Will compile Jtalk files - either separately or into a runnable complete
@@ -34,10 +34,13 @@ Usage: $0 [-N|D|E] [-K|C] [-o] [-O] [-m class] [-M file]
      is added last.
 
   -K
-     Add libraries to get minimal JTalk Kernel running.
+     Add libraries to get minimal Jtalk Kernel running.
 
   -C
-     Add libraries to get minimal JTalk Compiler running.
+     Add libraries to get minimal Jtalk Compiler running.
+
+  -J
+     Add libraries to get minimal Jtalk IDE running.
 
   -o
      Optimize each js file using the Google closure compiler.
@@ -95,10 +98,11 @@ if [ -z $1 ] ; then
 fi
 
 # Define our predefined library combinations
-BOOT="$JTALK/js/boot.js"
-KERNEL="$BOOT $JTALK/js/Kernel.js"
-COMPILER="$KERNEL $JTALK/js/Parser.js $JTALK/js/Compiler.js"
-KITCHENSINK="$COMPILER $JTALK/js/Canvas.js"
+BOOT="boot.js"
+KERNEL="$BOOT Kernel.js"
+COMPILER="$KERNEL Parser.js Compiler.js"
+CANVAS="$COMPILER Canvas.js"
+IDE="$CANVAS JQuery.js IDE.js SUnit.js Examples.js"
 
 # Predefined initializer
 INITIALIZER="$JTALK/js/init.js"
@@ -113,7 +117,7 @@ LOAD=
 LOADANDADD=
 
 # Read options and shift them away
-while getopts "NDEKCoOl:L:i:IM:m:h?" o; do
+while getopts "NDEKCJoOl:L:i:IM:m:h?" o; do
 case "$o" in
    N) ENV=NODE
       BASE=$KERNEL
@@ -121,11 +125,12 @@ case "$o" in
    D) ENV=D8
       BASE=$KERNEL
       INIT=$INITIALIZER;;
-   D) ENV=ENYO
+   E) ENV=ENYO
       BASE=$KERNEL
       INIT=$INITIALIZER;;
    K) BASE=$KERNEL;;
    C) BASE=$COMPILER;;
+   J) BASE=$IDE;;
    o) CLOSURE=true
       CLOSUREPARTS=true;;
    O) CLOSURE=true
@@ -170,6 +175,13 @@ function resolvejs {
   fi
 }
 
+# Resolve listed libraries in $BASE separated by spaces
+for FILE in $BASE
+do
+   resolvejs $FILE
+   TOBASE="$TOBASE $RESOLVED"
+done
+
 # Resolve listed libraries in $LOAD separated by spaces
 LOAD=${LOAD//,/\ }
 for FILE in $LOAD
@@ -188,10 +200,17 @@ do
 done
 
 # Define our Compiler loading supplied libraries
-OURCOMPILER="$KITCHENSINK $TOLOAD $JTALK/js/init.js $JTALK/nodejs/nodecompile.js"
+OURCOMPILER="$COMPILER $TOLOAD init.js $JTALK/nodejs/nodecompile.js"
+
+# Resolve OURCOMPILER
+for FILE in $OURCOMPILER
+do
+   resolvejs $FILE
+   TOOURCOMPILER="$TOOURCOMPILER $RESOLVED"
+done
 
 # Add supplied libraries
-LIBS="$BASE $TOADD"
+LIBS="$TOBASE $TOADD"
 
 # Get a unique tempdir and make it get auto removed on exit
 TMPDIR=`mktemp -d`
@@ -239,10 +258,10 @@ done
 # --------------------------------------------------
 
 # Create compiler dynamically
-cat $OURCOMPILER > $TMPDIR/compiler.js
-
+cat $TOOURCOMPILER > $TMPDIR/compiler.js
+ 
 # Compile all collected .st files to .js
-echo "Loading libraries $KITCHENSINK $TOLOAD and compiling ..."
+echo "Loading libraries $TOOURCOMPILER and compiling ..."
 node $TMPDIR/compiler.js $COMPILE
 
 # Verify all .js files corresponding to .st files were created, otherwise exit