|
@@ -15,7 +15,7 @@ popd >/dev/null
|
|
|
|
|
|
function usage {
|
|
function usage {
|
|
cat <<ENDOFHELP
|
|
cat <<ENDOFHELP
|
|
-Usage: $0 [-N|D|E] [-K|C|J] [-o] [-O|-A] [-g] [-s suffix] [-m class] [-M file]
|
|
|
|
|
|
+Usage: $0 [-N|D|E] [-K|C|J] [-o] [-O|-A] [-d] [-s suffix] [-m class] [-M file]
|
|
[-i] [-I file] [file1 [file2 ...]] [Program]
|
|
[-i] [-I file] [file1 [file2 ...]] [Program]
|
|
|
|
|
|
Will compile Jtalk files - either separately or into a runnable complete
|
|
Will compile Jtalk files - either separately or into a runnable complete
|
|
@@ -61,19 +61,23 @@ Usage: $0 [-N|D|E] [-K|C|J] [-o] [-O|-A] [-g] [-s suffix] [-m class] [-M file]
|
|
|
|
|
|
-A Same as -O but use --compilation_level ADVANCED_OPTIMIZATIONS
|
|
-A Same as -O but use --compilation_level ADVANCED_OPTIMIZATIONS
|
|
|
|
|
|
- -g
|
|
|
|
- Compile Jtalk code in debug mode - include source and references etc.
|
|
|
|
|
|
+ -d
|
|
|
|
+ Additionally export code for deploy - stripped from source etc.
|
|
|
|
+ Uses suffix ".deploy.js" in addition to any explicit given suffic using -s.
|
|
|
|
|
|
-s suffix
|
|
-s suffix
|
|
Add <suffix> to compiled js files so that File.st is compiled into
|
|
Add <suffix> to compiled js files so that File.st is compiled into
|
|
- File.<suffix>.st.
|
|
|
|
|
|
+ File.<suffix>.js.
|
|
|
|
+
|
|
|
|
+ -S suffix
|
|
|
|
+ Use <suffix> for all libraries accessed using -l or -L and other options.
|
|
|
|
|
|
-l library1,library2
|
|
-l library1,library2
|
|
- Load listed libraries (no spaces) into Compiler before compiling.
|
|
|
|
|
|
+ Load listed libraries (no spaces or .js) into Compiler before compiling.
|
|
|
|
|
|
-L library1,library2
|
|
-L library1,library2
|
|
- Load listed libraries (no spaces) into Compiler before compiling and also
|
|
|
|
- into Program.js in listed order.
|
|
|
|
|
|
+ Load listed libraries (no spaces or .js) into Compiler before compiling
|
|
|
|
+ and also into Program.js in listed order.
|
|
|
|
|
|
-i file
|
|
-i file
|
|
Add library initializer <file>.
|
|
Add library initializer <file>.
|
|
@@ -116,11 +120,11 @@ if [ -z $1 ] ; then
|
|
fi
|
|
fi
|
|
|
|
|
|
# Define our predefined library combinations
|
|
# Define our predefined library combinations
|
|
-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"
|
|
|
|
|
|
+BOOT="boot"
|
|
|
|
+KERNEL="$BOOT Kernel"
|
|
|
|
+COMPILER="$KERNEL Parser Compiler"
|
|
|
|
+CANVAS="$COMPILER Canvas"
|
|
|
|
+IDE="$CANVAS JQuery IDE SUnit Examples"
|
|
|
|
|
|
# Predefined initializer
|
|
# Predefined initializer
|
|
INITIALIZER="$JTALK/js/init.js"
|
|
INITIALIZER="$JTALK/js/init.js"
|
|
@@ -137,11 +141,11 @@ CLOSUREOPTS=
|
|
# Ok, bad coding practice but hey, who would use such a suffix?
|
|
# Ok, bad coding practice but hey, who would use such a suffix?
|
|
SUFFIX=no-silly-suffix
|
|
SUFFIX=no-silly-suffix
|
|
SUFFIXUSED=
|
|
SUFFIXUSED=
|
|
-DEBUG=false
|
|
|
|
-NODECOMPILE=nodecompile.js
|
|
|
|
|
|
+DEPLOY=false
|
|
|
|
+NODECOMPILE=nodecompile
|
|
|
|
|
|
# Read options and shift them away
|
|
# Read options and shift them away
|
|
-while getopts "NDEKCJoOAgs:l:L:i:IM:m:h?" o; do
|
|
|
|
|
|
+while getopts "NDEKCJoOAdS:s:l:L:i:IM:m:h?" o; do
|
|
case "$o" in
|
|
case "$o" in
|
|
N) ENV=NODE
|
|
N) ENV=NODE
|
|
BASE=$KERNEL
|
|
BASE=$KERNEL
|
|
@@ -162,7 +166,9 @@ case "$o" in
|
|
A) CLOSURE=true
|
|
A) CLOSURE=true
|
|
CLOSUREOPTS="$CLOSUREOPTS --compilation_level ADVANCED_OPTIMIZATIONS"
|
|
CLOSUREOPTS="$CLOSUREOPTS --compilation_level ADVANCED_OPTIMIZATIONS"
|
|
CLOSUREFULL=true;;
|
|
CLOSUREFULL=true;;
|
|
- g) DEBUG=true;;
|
|
|
|
|
|
+ d) DEPLOY=true;;
|
|
|
|
+ S) LOADSUFFIX=$OPTARG
|
|
|
|
+ SUFFIXUSED=$SUFFIX;;
|
|
s) SUFFIX=$OPTARG
|
|
s) SUFFIX=$OPTARG
|
|
SUFFIXUSED=$SUFFIX;;
|
|
SUFFIXUSED=$SUFFIX;;
|
|
l) LOAD=$OPTARG;;
|
|
l) LOAD=$OPTARG;;
|
|
@@ -193,26 +199,27 @@ fi
|
|
|
|
|
|
# Function for looking up listed js files
|
|
# Function for looking up listed js files
|
|
function resolvejs {
|
|
function resolvejs {
|
|
- if [ -f "$1" ]; then
|
|
|
|
- RESOLVED="$1"
|
|
|
|
|
|
+ FNAME="$1$LOADSUFFIX.js"
|
|
|
|
+ if [ -f $FNAME ]; then
|
|
|
|
+ RESOLVED="$FNAME"
|
|
else
|
|
else
|
|
- if [ -f $JTALK/js/$1 ]; then
|
|
|
|
- RESOLVED="$JTALK/js/$1"
|
|
|
|
|
|
+ if [ -f $JTALK/js/$FNAME ]; then
|
|
|
|
+ RESOLVED="$JTALK/js/$FNAME"
|
|
else
|
|
else
|
|
- echo "Javascript file not found: $1"
|
|
|
|
|
|
+ echo "Javascript file not found: $FNAME"
|
|
exit 1
|
|
exit 1
|
|
fi
|
|
fi
|
|
fi
|
|
fi
|
|
}
|
|
}
|
|
|
|
|
|
-# Resolve listed libraries in $BASE separated by spaces
|
|
|
|
|
|
+# Resolve listed libraries in $BASE deparated by spaces
|
|
for FILE in $BASE
|
|
for FILE in $BASE
|
|
do
|
|
do
|
|
resolvejs $FILE
|
|
resolvejs $FILE
|
|
TOBASE="$TOBASE $RESOLVED"
|
|
TOBASE="$TOBASE $RESOLVED"
|
|
done
|
|
done
|
|
|
|
|
|
-# Resolve listed libraries in $LOAD separated by spaces
|
|
|
|
|
|
+# Resolve listed libraries in $LOAD separated by ,
|
|
LOAD=${LOAD//,/\ }
|
|
LOAD=${LOAD//,/\ }
|
|
for FILE in $LOAD
|
|
for FILE in $LOAD
|
|
do
|
|
do
|
|
@@ -220,7 +227,7 @@ do
|
|
TOLOAD="$TOLOAD $RESOLVED"
|
|
TOLOAD="$TOLOAD $RESOLVED"
|
|
done
|
|
done
|
|
|
|
|
|
-# Resolve listed libraries in $LOADANDADD separated by spaces
|
|
|
|
|
|
+# Resolve listed libraries in $LOADANDADD separated by ,
|
|
LOADANDADD=${LOADANDADD//,/\ }
|
|
LOADANDADD=${LOADANDADD//,/\ }
|
|
for FILE in $LOADANDADD
|
|
for FILE in $LOADANDADD
|
|
do
|
|
do
|
|
@@ -230,7 +237,7 @@ do
|
|
done
|
|
done
|
|
|
|
|
|
# Define our Compiler loading supplied libraries
|
|
# Define our Compiler loading supplied libraries
|
|
-OURCOMPILER="$COMPILER $TOLOAD init.js $JTALK/nodejs/$NODECOMPILE"
|
|
|
|
|
|
+OURCOMPILER="$COMPILER $TOLOAD init $JTALK/bin/$NODECOMPILE"
|
|
|
|
|
|
# Resolve OURCOMPILER
|
|
# Resolve OURCOMPILER
|
|
for FILE in $OURCOMPILER
|
|
for FILE in $OURCOMPILER
|
|
@@ -243,7 +250,7 @@ done
|
|
LIBS="$TOBASE $TOADD"
|
|
LIBS="$TOBASE $TOADD"
|
|
|
|
|
|
# Get a unique tempdir and make it get auto removed on exit
|
|
# Get a unique tempdir and make it get auto removed on exit
|
|
-TMPDIR=`mktemp -d`
|
|
|
|
|
|
+TMPDIR=`mktemp -d jtalkc.XXXXXX`
|
|
trap "rm -rf $TMPDIR" EXIT
|
|
trap "rm -rf $TMPDIR" EXIT
|
|
|
|
|
|
|
|
|
|
@@ -292,7 +299,7 @@ cat $TOOURCOMPILER > $TMPDIR/compiler.js
|
|
|
|
|
|
# Compile all collected .st files to .js
|
|
# Compile all collected .st files to .js
|
|
echo "Loading libraries $TOOURCOMPILER and compiling ..."
|
|
echo "Loading libraries $TOOURCOMPILER and compiling ..."
|
|
-node $TMPDIR/compiler.js $DEBUG $SUFFIX $COMPILE
|
|
|
|
|
|
+node $TMPDIR/compiler.js $DEPLOY $SUFFIX $COMPILE
|
|
|
|
|
|
# Verify all .js files corresponding to .st files were created, otherwise exit
|
|
# Verify all .js files corresponding to .st files were created, otherwise exit
|
|
IFS=" "
|
|
IFS=" "
|