|
@@ -15,15 +15,15 @@ popd >/dev/null
|
|
|
|
|
|
function usage {
|
|
function usage {
|
|
cat <<ENDOFHELP
|
|
cat <<ENDOFHELP
|
|
-Usage: $0 [-N|D|E] [-K|C|J] [-o] [-O|-A] [-d] [-s suffix] [-m class] [-M file]
|
|
|
|
- [-i] [-I file] [file1 [file2 ...]] [Program]
|
|
|
|
|
|
+Usage: $0 [-L level] [-l lib1,lib2...] [-i file] [-m class] [-M file]
|
|
|
|
+ [-o] [-O|-A] [-d] [-s suffix] [-S suffix] [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
|
|
- program. If no files are listed only a linking stage is performed.
|
|
|
|
|
|
+ program. If no .st files are listed only a linking stage is performed.
|
|
Files listed will be handled using these rules:
|
|
Files listed will be handled using these rules:
|
|
|
|
|
|
*.js
|
|
*.js
|
|
- Files are concatenated in listed order.
|
|
|
|
|
|
+ Files are linked (concatenated) in listed order.
|
|
If not found we look in $JTALK/js
|
|
If not found we look in $JTALK/js
|
|
|
|
|
|
*.st
|
|
*.st
|
|
@@ -37,29 +37,38 @@ Usage: $0 [-N|D|E] [-K|C|J] [-o] [-O|-A] [-d] [-s suffix] [-m class] [-M file]
|
|
a .js file. Otherwise a <Program>.js file is linked together based on
|
|
a .js file. Otherwise a <Program>.js file is linked together based on
|
|
the options:
|
|
the options:
|
|
|
|
|
|
- -N or -D or -E
|
|
|
|
- Compilation target. Currently Node.js, D8 (V8 shell) or Enyo (webOS 3.0).
|
|
|
|
- All currentl imply "-K -I" so boot.js and Kernel.js are added first and init.js
|
|
|
|
- is added last.
|
|
|
|
|
|
+ -L level
|
|
|
|
+ Add libraries to a predefined level (default is KERNEL) of environment
|
|
|
|
+ where level is:
|
|
|
|
|
|
- -K
|
|
|
|
- Add libraries to get minimal Jtalk Kernel running.
|
|
|
|
|
|
+ KERNEL - a reasonable level for server side programs or libraries.
|
|
|
|
+ PARSER - if you need to parse stuff, includes PetitParser etc.
|
|
|
|
+ COMPILER - if you need to compile Jtalk code.
|
|
|
|
+ CANVAS - if you need HTML DOM manipulation, typical for client side.
|
|
|
|
+ JQUERY - if you want JQuery stuff on top of Canvas.
|
|
|
|
+ IDE - if you are extending the IDE with new tools etc.
|
|
|
|
|
|
- -C
|
|
|
|
- Add libraries to get minimal Jtalk Compiler running.
|
|
|
|
|
|
+ -l library1,library2
|
|
|
|
+ Additionally add listed libraries (no spaces or .js) in listed order.
|
|
|
|
+
|
|
|
|
+ -i file
|
|
|
|
+ Add library initializer <file> instead of default $JTALK/js/init.js
|
|
|
|
|
|
- -J
|
|
|
|
- Add libraries to get minimal Jtalk IDE running.
|
|
|
|
|
|
+ -m class
|
|
|
|
+ Add at end a call to #main in class <class>.
|
|
|
|
|
|
|
|
+ -M file
|
|
|
|
+ Add at end javascript file <file> acting as main.
|
|
|
|
+
|
|
-o
|
|
-o
|
|
Optimize each js file using the Google closure compiler.
|
|
Optimize each js file using the Google closure compiler.
|
|
- Using Closure at ~/compiler.jar
|
|
|
|
|
|
+ Using Closure compiler found at ~/compiler.jar
|
|
|
|
|
|
-O
|
|
-O
|
|
Optimize final <Program>.js using the Google closure compiler.
|
|
Optimize final <Program>.js using the Google closure compiler.
|
|
- Using Closure at ~/compiler.jar
|
|
|
|
|
|
+ Using Closure compiler found at ~/compiler.jar
|
|
|
|
|
|
- -A Same as -O but use --compilation_level ADVANCED_OPTIMIZATIONS
|
|
|
|
|
|
+ -A Same as -O but use --compilation_level ADVANCED_OPTIMIZATIONS
|
|
|
|
|
|
-d
|
|
-d
|
|
Additionally export code for deploy - stripped from source etc.
|
|
Additionally export code for deploy - stripped from source etc.
|
|
@@ -70,26 +79,8 @@ Usage: $0 [-N|D|E] [-K|C|J] [-o] [-O|-A] [-d] [-s suffix] [-m class] [-M file]
|
|
File.<suffix>.js.
|
|
File.<suffix>.js.
|
|
|
|
|
|
-S suffix
|
|
-S suffix
|
|
- Use <suffix> for all libraries accessed using -l or -L and other options.
|
|
|
|
-
|
|
|
|
- -l library1,library2
|
|
|
|
- Load listed libraries (no spaces or .js) into Compiler before compiling.
|
|
|
|
-
|
|
|
|
- -L library1,library2
|
|
|
|
- Load listed libraries (no spaces or .js) into Compiler before compiling
|
|
|
|
- and also into Program.js in listed order.
|
|
|
|
-
|
|
|
|
- -i file
|
|
|
|
- Add library initializer <file>.
|
|
|
|
-
|
|
|
|
- -I
|
|
|
|
- Add library standard initializer $JTALK/js/init.js
|
|
|
|
-
|
|
|
|
- -m class
|
|
|
|
- Add call to #main in class <class>.
|
|
|
|
-
|
|
|
|
- -M file
|
|
|
|
- Add javascript file <file> at the end acting as main.
|
|
|
|
|
|
+ Use <suffix> for all libraries accessed using -L or -l. This makes it possible
|
|
|
|
+ to have multiple flavors of Jtalk and libraries in the same place.
|
|
|
|
|
|
|
|
|
|
Example invocations:
|
|
Example invocations:
|
|
@@ -99,8 +90,7 @@ Usage: $0 [-N|D|E] [-K|C|J] [-o] [-O|-A] [-d] [-s suffix] [-m class] [-M file]
|
|
jtalkc Kernel.st
|
|
jtalkc Kernel.st
|
|
|
|
|
|
Compile Hello.st to Hello.js and create complete program called
|
|
Compile Hello.st to Hello.js and create complete program called
|
|
- Program.js for Node.js and adding a call to class method #main
|
|
|
|
- in class Hello:
|
|
|
|
|
|
+ Program.js and adding a call to class method #main in class Hello:
|
|
|
|
|
|
jtalkc -N -m Hello Hello.st Program
|
|
jtalkc -N -m Hello Hello.st Program
|
|
|
|
|
|
@@ -108,7 +98,7 @@ Usage: $0 [-N|D|E] [-K|C|J] [-o] [-O|-A] [-d] [-s suffix] [-m class] [-M file]
|
|
and link with specific myboot.js, myKernel.js, myinit.js
|
|
and link with specific myboot.js, myKernel.js, myinit.js
|
|
and main.js and create complete program called Program.js:
|
|
and main.js and create complete program called Program.js:
|
|
|
|
|
|
- jtalkc -M main.js -I myinit.js myboot.js myKernel.js Cat1.st Cat2.st Program
|
|
|
|
|
|
+ jtalkc -M main.js myinit.js myboot.js myKernel.js Cat1.st Cat2.st Program
|
|
|
|
|
|
ENDOFHELP
|
|
ENDOFHELP
|
|
exit 1;
|
|
exit 1;
|
|
@@ -122,9 +112,11 @@ fi
|
|
# Define our predefined library combinations
|
|
# Define our predefined library combinations
|
|
BOOT="boot"
|
|
BOOT="boot"
|
|
KERNEL="$BOOT Kernel"
|
|
KERNEL="$BOOT Kernel"
|
|
-COMPILER="$KERNEL Parser Compiler"
|
|
|
|
|
|
+PARSER="$KERNEL Parser"
|
|
|
|
+COMPILER="$PARSER Compiler"
|
|
CANVAS="$COMPILER Canvas"
|
|
CANVAS="$COMPILER Canvas"
|
|
-IDE="$CANVAS JQuery IDE SUnit Examples"
|
|
|
|
|
|
+JQUERY="$COMPILER JQuery"
|
|
|
|
+IDE="$JQUERY IDE SUnit Examples"
|
|
|
|
|
|
# Predefined initializer
|
|
# Predefined initializer
|
|
INITIALIZER="$JTALK/js/init.js"
|
|
INITIALIZER="$JTALK/js/init.js"
|
|
@@ -136,7 +128,6 @@ MAIN=
|
|
MAINFILE=
|
|
MAINFILE=
|
|
BASE=$KERNEL
|
|
BASE=$KERNEL
|
|
LOAD=
|
|
LOAD=
|
|
-LOADANDADD=
|
|
|
|
CLOSUREOPTS=
|
|
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
|
|
@@ -145,20 +136,13 @@ DEPLOY=false
|
|
NODECOMPILE=nodecompile
|
|
NODECOMPILE=nodecompile
|
|
|
|
|
|
# Read options and shift them away
|
|
# Read options and shift them away
|
|
-while getopts "NDEKCJoOAdS:s:l:L:i:IM:m:h?" o; do
|
|
|
|
|
|
+while getopts "L:l:i:m:M:oOAds:S:h?" o; do
|
|
case "$o" in
|
|
case "$o" in
|
|
- N) ENV=NODE
|
|
|
|
- BASE=$KERNEL
|
|
|
|
- INIT=$INITIALIZER;;
|
|
|
|
- D) ENV=D8
|
|
|
|
- BASE=$KERNEL
|
|
|
|
- INIT=$INITIALIZER;;
|
|
|
|
- E) ENV=ENYO
|
|
|
|
- BASE=$KERNEL
|
|
|
|
- INIT=$INITIALIZER;;
|
|
|
|
- K) BASE=$KERNEL;;
|
|
|
|
- C) BASE=$COMPILER;;
|
|
|
|
- J) BASE=$IDE;;
|
|
|
|
|
|
+ L) BASE=${!OPTARG};; # If OPTARG is "KERNEL" this sets BASE to $KERNEL.
|
|
|
|
+ l) LOAD=$OPTARG;;
|
|
|
|
+ i) INIT=$OPTARG;;
|
|
|
|
+ m) MAIN=$OPTARG;;
|
|
|
|
+ M) MAINFILE=$OPTARG;;
|
|
o) CLOSURE=true
|
|
o) CLOSURE=true
|
|
CLOSUREPARTS=true;;
|
|
CLOSUREPARTS=true;;
|
|
O) CLOSURE=true
|
|
O) CLOSURE=true
|
|
@@ -167,16 +151,10 @@ case "$o" in
|
|
CLOSUREOPTS="$CLOSUREOPTS --compilation_level ADVANCED_OPTIMIZATIONS"
|
|
CLOSUREOPTS="$CLOSUREOPTS --compilation_level ADVANCED_OPTIMIZATIONS"
|
|
CLOSUREFULL=true;;
|
|
CLOSUREFULL=true;;
|
|
d) DEPLOY=true;;
|
|
d) DEPLOY=true;;
|
|
- S) LOADSUFFIX=$OPTARG
|
|
|
|
- SUFFIXUSED=$SUFFIX;;
|
|
|
|
s) SUFFIX=$OPTARG
|
|
s) SUFFIX=$OPTARG
|
|
SUFFIXUSED=$SUFFIX;;
|
|
SUFFIXUSED=$SUFFIX;;
|
|
- l) LOAD=$OPTARG;;
|
|
|
|
- L) LOADANDADD=$OPTARG;;
|
|
|
|
- I) INIT=$INITIALIZER;;
|
|
|
|
- i) INIT=$OPTARG;;
|
|
|
|
- M) MAINFILE=$OPTARG;;
|
|
|
|
- m) MAIN=$OPTARG;;
|
|
|
|
|
|
+ S) LOADSUFFIX=$OPTARG
|
|
|
|
+ SUFFIXUSED=$SUFFIX;;
|
|
h) usage;;
|
|
h) usage;;
|
|
[?]) usage;;
|
|
[?]) usage;;
|
|
esac
|
|
esac
|
|
@@ -222,14 +200,6 @@ done
|
|
# Resolve listed libraries in $LOAD separated by ,
|
|
# Resolve listed libraries in $LOAD separated by ,
|
|
LOAD=${LOAD//,/\ }
|
|
LOAD=${LOAD//,/\ }
|
|
for FILE in $LOAD
|
|
for FILE in $LOAD
|
|
-do
|
|
|
|
- resolvejs $FILE
|
|
|
|
- TOLOAD="$TOLOAD $RESOLVED"
|
|
|
|
-done
|
|
|
|
-
|
|
|
|
-# Resolve listed libraries in $LOADANDADD separated by ,
|
|
|
|
-LOADANDADD=${LOADANDADD//,/\ }
|
|
|
|
-for FILE in $LOADANDADD
|
|
|
|
do
|
|
do
|
|
resolvejs $FILE
|
|
resolvejs $FILE
|
|
TOLOAD="$TOLOAD $RESOLVED"
|
|
TOLOAD="$TOLOAD $RESOLVED"
|
|
@@ -240,16 +210,16 @@ done
|
|
for FILE in $COMPILER
|
|
for FILE in $COMPILER
|
|
do
|
|
do
|
|
resolvejs $FILE
|
|
resolvejs $FILE
|
|
- TOOURCOMPILER="$TOOURCOMPILER $RESOLVED"
|
|
|
|
|
|
+ TOCOMPILER="$TOCOMPILER $RESOLVED"
|
|
done
|
|
done
|
|
# Add supplied libraries to load (they are already resolved)
|
|
# Add supplied libraries to load (they are already resolved)
|
|
-TOOURCOMPILER="$TOOURCOMPILER$TOLOAD"
|
|
|
|
|
|
+TOCOMPILER="$TOCOMPILER$TOLOAD"
|
|
THEREST="init $JTALK/bin/$NODECOMPILE"
|
|
THEREST="init $JTALK/bin/$NODECOMPILE"
|
|
# Resolve init and nodecompile
|
|
# Resolve init and nodecompile
|
|
for FILE in $THEREST
|
|
for FILE in $THEREST
|
|
do
|
|
do
|
|
resolvejs $FILE
|
|
resolvejs $FILE
|
|
- TOOURCOMPILER="$TOOURCOMPILER $RESOLVED"
|
|
|
|
|
|
+ TOCOMPILER="$TOCOMPILER $RESOLVED"
|
|
done
|
|
done
|
|
|
|
|
|
# Add supplied libraries
|
|
# Add supplied libraries
|
|
@@ -301,7 +271,7 @@ done
|
|
# --------------------------------------------------
|
|
# --------------------------------------------------
|
|
|
|
|
|
# Create compiler dynamically
|
|
# Create compiler dynamically
|
|
-cat $TOOURCOMPILER > $TMPDIR/compiler.js
|
|
|
|
|
|
+cat $TOCOMPILER > $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 ..."
|