|
@@ -20,7 +20,7 @@ var amber_dir = path.normalize(path.join(path.dirname(process.argv[1]), '..'));
|
|
|
|
|
|
var compiler = new amberc.Compiler(amber_dir);
|
|
var compiler = new amberc.Compiler(amber_dir);
|
|
|
|
|
|
-var configuration = handle_options(parameters, amber_dir);
|
|
|
|
|
|
+var configuration = handle_options(parameters);
|
|
|
|
|
|
compiler.main(configuration);
|
|
compiler.main(configuration);
|
|
|
|
|
|
@@ -29,16 +29,19 @@ compiler.main(configuration);
|
|
* Process given program options and update defaults values.
|
|
* Process given program options and update defaults values.
|
|
* Followed by check_for_closure_compiler() and then collect_files().
|
|
* Followed by check_for_closure_compiler() and then collect_files().
|
|
*/
|
|
*/
|
|
-function handle_options(optionsArray, amber_dir) {
|
|
|
|
|
|
+function handle_options(optionsArray) {
|
|
var programName = [];
|
|
var programName = [];
|
|
var currentItem = optionsArray.shift();
|
|
var currentItem = optionsArray.shift();
|
|
- var defaults = amberc.createDefaults(amber_dir);
|
|
|
|
|
|
+ var defaults = amberc.createDefaults();
|
|
|
|
|
|
while(undefined !== currentItem) {
|
|
while(undefined !== currentItem) {
|
|
switch(currentItem) {
|
|
switch(currentItem) {
|
|
case '-l':
|
|
case '-l':
|
|
defaults.load.push.apply(defaults.load, optionsArray.shift().split(','));
|
|
defaults.load.push.apply(defaults.load, optionsArray.shift().split(','));
|
|
break;
|
|
break;
|
|
|
|
+ case '-L':
|
|
|
|
+ defaults.jsLibraryDirs.push.apply(defaults.jsLibraryDirs, optionsArray.shift().split(','));
|
|
|
|
+ break;
|
|
case '-g':
|
|
case '-g':
|
|
defaults.jsGlobals.push.apply(defaults.jsGlobals, optionsArray.shift().split(','));
|
|
defaults.jsGlobals.push.apply(defaults.jsGlobals, optionsArray.shift().split(','));
|
|
break;
|
|
break;
|
|
@@ -99,8 +102,8 @@ function handle_options(optionsArray, amber_dir) {
|
|
|
|
|
|
// print available flags
|
|
// print available flags
|
|
function print_usage() {
|
|
function print_usage() {
|
|
- console.log('Usage: amberc [-l lib1,lib2...] [-i init_file] [-m main_class] [-M main_file]');
|
|
|
|
- console.log(' [-o] [-O|-A] [-d] [-s suffix] [-S suffix] [file1 [file2 ...]] [Program]');
|
|
|
|
|
|
+ console.log('Usage: amberc [-l lib1,lib2...] [-g jsGlobal1,jsGlobla2] [-m main_class] [-M main_file]');
|
|
|
|
+ console.log(' [-n namespace] [-D output_dir] [-v] [-s suffix] [-S suffix] [file1 [file2 ...]] [Program]');
|
|
console.log('');
|
|
console.log('');
|
|
console.log(' amberc compiles Amber files - either separately or into a complete runnable');
|
|
console.log(' amberc compiles Amber files - either separately or into a complete runnable');
|
|
console.log(' program. If no .st files are listed only a linking stage is performed.');
|
|
console.log(' program. If no .st files are listed only a linking stage is performed.');
|
|
@@ -120,10 +123,18 @@ function print_usage() {
|
|
console.log(' If no <Program> is specified each given .st file will be compiled into');
|
|
console.log(' If no <Program> is specified each given .st file will be compiled into');
|
|
console.log(' a matching .js file. Otherwise a <Program>.js file is linked together based on');
|
|
console.log(' a matching .js file. Otherwise a <Program>.js file is linked together based on');
|
|
console.log(' the given options:');
|
|
console.log(' the given options:');
|
|
|
|
+ console.log('');
|
|
console.log(' -l library1,library2');
|
|
console.log(' -l library1,library2');
|
|
console.log(' Add listed JavaScript libraries in listed order.');
|
|
console.log(' Add listed JavaScript libraries in listed order.');
|
|
console.log(' Libraries are not separated by spaces or end with .js.');
|
|
console.log(' Libraries are not separated by spaces or end with .js.');
|
|
console.log('');
|
|
console.log('');
|
|
|
|
+ console.log(' -L directory1,directory2');
|
|
|
|
+ console.log(' Add listed directories to the library search path.');
|
|
|
|
+ console.log(' The order of processing is:');
|
|
|
|
+ console.log(' 1. current directory');
|
|
|
|
+ console.log(' 2. directories specified by -L');
|
|
|
|
+ console.log(' 3. $AMBER');
|
|
|
|
+ console.log('');
|
|
console.log(' -g jsGlobal1,jsGlobal2');
|
|
console.log(' -g jsGlobal1,jsGlobal2');
|
|
console.log(' Comma separated list of JS global variable names.');
|
|
console.log(' Comma separated list of JS global variable names.');
|
|
console.log(' The names are added to a list containing "window", "document" and others.');
|
|
console.log(' The names are added to a list containing "window", "document" and others.');
|
|
@@ -138,6 +149,9 @@ function print_usage() {
|
|
console.log(' Export packages with <amd_namespace> as the require.js namespace.');
|
|
console.log(' Export packages with <amd_namespace> as the require.js namespace.');
|
|
console.log(' Default value is "amber_core".');
|
|
console.log(' Default value is "amber_core".');
|
|
console.log('');
|
|
console.log('');
|
|
|
|
+ console.log(' -v');
|
|
|
|
+ console.log(' Produce a more verbose output.');
|
|
|
|
+ console.log('');
|
|
console.log(' -D');
|
|
console.log(' -D');
|
|
console.log(' Specifies the output directory for all generated .js files.');
|
|
console.log(' Specifies the output directory for all generated .js files.');
|
|
console.log(' The hierarchy of the input files is not maintaned.');
|
|
console.log(' The hierarchy of the input files is not maintaned.');
|
|
@@ -164,9 +178,8 @@ function print_usage() {
|
|
console.log(' amberc -m Hello Hello.st Program');
|
|
console.log(' amberc -m Hello Hello.st Program');
|
|
console.log('');
|
|
console.log('');
|
|
console.log(' Compile Cat1.st and Cat2.st files into corresponding .js files.');
|
|
console.log(' Compile Cat1.st and Cat2.st files into corresponding .js files.');
|
|
- console.log(' Link them with myboot.js and myKernel.js and add myinit.js as custom');
|
|
|
|
- console.log(' initializer file. Add main.js last which contains the startup code');
|
|
|
|
- console.log(' and merge everything into a complete program named Program.js:');
|
|
|
|
|
|
+ console.log(' Link them with myboot.js and myKernel.js');
|
|
|
|
+ console.log(' and merge everything into a complete program named Program.js:');
|
|
console.log('');
|
|
console.log('');
|
|
- console.log(' amberc -M main.js -i myinit.js myboot.js myKernel.js Cat1.st Cat2.st Program');
|
|
|
|
|
|
+ console.log(' amberc -M main.js myboot.js myKernel.js Cat1.st Cat2.st Program');
|
|
};
|
|
};
|