amberc.js 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709
  1. #!/usr/bin/env node
  2. // This is a "compiler" for Amber code. Run without arguments for help.
  3. var path = require('path'),
  4. util = require('util'),
  5. fs = require('fs'),
  6. exec = require('child_process').exec;
  7. /**
  8. * Map the async filter function onto array and evaluate callback, once all have finished.
  9. * Taken from: http://howtonode.org/control-flow-part-iii
  10. */
  11. function map(array, filter, callback) {
  12. var counter = array.length;
  13. var new_array = [];
  14. array.forEach(function (item, index) {
  15. filter(item, function (err, result) {
  16. if (err) { callback(err); return; }
  17. new_array[index] = result;
  18. counter--;
  19. if (counter === 0) {
  20. callback(null, new_array);
  21. }
  22. });
  23. });
  24. }
  25. /**
  26. * Combine several async functions and evaluate callback once all of them have finished.
  27. * Taken from: http://howtonode.org/control-flow
  28. */
  29. function Combo(callback) {
  30. this.callback = callback;
  31. this.items = 0;
  32. this.results = [];
  33. }
  34. Combo.prototype = {
  35. add: function () {
  36. var self = this,
  37. id = this.items;
  38. this.items++;
  39. return function () {
  40. self.check(id, arguments);
  41. };
  42. },
  43. check: function (id, arguments) {
  44. this.results[id] = Array.prototype.slice.call(arguments);
  45. this.items--;
  46. if (this.items == 0) {
  47. this.callback.apply(this, this.results);
  48. }
  49. }
  50. };
  51. console.time('Compile Time');
  52. /**
  53. * Stores default values.
  54. */
  55. var defaults = function() {
  56. // Get Amber root directory from the location of this script so that
  57. // we can find the st and js directories etc.
  58. var amber_dir = path.join(path.dirname(process.argv[1]), '..');
  59. amber_dir = path.normalize(amber_dir);
  60. var kernel_libraries = ['boot', 'Kernel-Objects', 'Kernel-Classes', 'Kernel-Methods', 'Kernel-Collections', 'Kernel-Exceptions', 'Kernel-Transcript', 'Kernel-Announcements'];
  61. var compiler_libs = ['parser', 'Compiler', 'Compiler-Exceptions'];//, 'Compiler-Core', 'Compiler-AST', 'Compiler-IR', 'Compiler-Inlining', 'Compiler-Semantic'];
  62. return {
  63. 'amber_dir': amber_dir,
  64. 'smalltalk': {}, // the evaluated compiler will be stored in this variable (see create_compiler)
  65. 'base': kernel_libraries,
  66. 'compiler_libraries': kernel_libraries.concat(compiler_libs),
  67. 'load': [],
  68. 'init': path.join(amber_dir, 'js', 'init.js'),
  69. 'main': undefined,
  70. 'mainfile': undefined,
  71. 'closure': false,
  72. 'closure_parts': false,
  73. 'closure_full': false,
  74. 'closure_options': '',
  75. 'closure_jar': path.resolve(path.join(process.env['HOME'], 'compiler.jar')),
  76. 'suffix': '',
  77. 'loadsuffix': '',
  78. 'suffix_used': '',
  79. 'deploy': false,
  80. 'libraries': [],
  81. 'compile': [],
  82. 'compiled_categories': [],
  83. 'compiled': [],
  84. 'program': undefined
  85. };
  86. }();
  87. /**
  88. * Main program flow starts here.
  89. */
  90. if (3 > process.argv.length) {
  91. usage();
  92. } else {
  93. handle_options(process.argv.slice(2));
  94. }
  95. /**
  96. * Process given program options and update defaults values.
  97. * Followed by check_for_closure_compiler() and then collect_files().
  98. */
  99. function handle_options(optionsArray) {
  100. var stFiles = [];
  101. var jsFiles = [];
  102. var programName = [];
  103. var currentItem = optionsArray.shift();
  104. while(undefined !== currentItem) {
  105. switch(currentItem) {
  106. case '-l':
  107. defaults.load.push.apply(defaults.load, optionsArray.shift().split(','));
  108. break;
  109. case '-i':
  110. defaults.init = optionsArray.shift();
  111. break;
  112. case '-m':
  113. defaults.main = optionsArray.shift();
  114. break;
  115. case '-M':
  116. defaults.mainfile = optionsArray.shift();
  117. break;
  118. case '-o':
  119. defaults.closure = true;
  120. defaults.closure_parts = true;
  121. break;
  122. case '-O':
  123. defaults.closure = true;
  124. defaults.closure_full = true;
  125. break;
  126. case '-A':
  127. defaults.closure = true;
  128. defaults.closure_options = defaults.closure_options + ' --compilation_level ADVANCED_OPTIMIZATIONS';
  129. defaults.closure_full = true;
  130. break;
  131. case '-d':
  132. defaults.deploy = true;
  133. break;
  134. case '-s':
  135. defaults.suffix = optionsArray.shift();
  136. defaults.suffix_used = defaults.suffix;
  137. break;
  138. case '-S':
  139. defaults.loadsuffix = optionsArray.shift();
  140. defaults.suffix_used = defaults.suffix;
  141. break;
  142. case '-h':
  143. case '--help':
  144. case '?':
  145. usage();
  146. break;
  147. default:
  148. var fileSuffix = path.extname(currentItem);
  149. switch (fileSuffix) {
  150. case '.st':
  151. stFiles.push(currentItem);
  152. break;
  153. case '.js':
  154. jsFiles.push(currentItem);
  155. break;
  156. default:
  157. // Will end up being the last non js/st argument
  158. programName.push(currentItem);
  159. break;
  160. };
  161. };
  162. currentItem = optionsArray.shift();
  163. }
  164. if(1 < programName.length) {
  165. throw new Error('More than one name for ProgramName given: ' + programName);
  166. } else {
  167. defaults.program = programName[0];
  168. }
  169. check_for_closure_compiler(function() {
  170. collect_files(stFiles, jsFiles);
  171. });
  172. }
  173. /**
  174. * Print usage options and exit.
  175. */
  176. function usage() {
  177. console.log('Usage: $0 [-l lib1,lib2...] [-i init_file] [-m main_class] [-M main_file]');
  178. console.log(' [-o] [-O|-A] [-d] [-s suffix] [-S suffix] [file1 [file2 ...]] [Program]');
  179. console.log('');
  180. console.log(' amberc compiles Amber files - either separately or into a complete runnable');
  181. console.log(' program. If no .st files are listed only a linking stage is performed.');
  182. console.log(' Files listed will be handled using the following rules:');
  183. console.log('');
  184. console.log(' *.js');
  185. console.log(' Files are linked (concatenated) in listed order.');
  186. console.log(' If not found we look in $AMBER/js/');
  187. console.log('');
  188. console.log(' *.st');
  189. console.log(' Files are compiled into .js files before concatenation.');
  190. console.log(' If not found we look in $AMBER/st/.');
  191. console.log('');
  192. console.log(' NOTE: Each file is currently considered to be a fileout of a single class');
  193. console.log(' category of the same name as the file!');
  194. console.log('');
  195. console.log(' If no Program is specified each given .st file will be compiled into');
  196. console.log(' a .js file. Otherwise a <Program>.js file is linked together based on');
  197. console.log(' the options:');
  198. console.log('');
  199. console.log(' -l library1,library2');
  200. console.log(' Additionally add listed JavaScript libraries (no spaces or .js) in listed order.');
  201. console.log('');
  202. console.log(' -i init_file');
  203. console.log(' Add library initializer <init_file> instead of default $AMBER/js/init.js ');
  204. console.log('');
  205. console.log(' -m main_class');
  206. console.log(' Add at end a call to #main in class <main_class>.');
  207. console.log('');
  208. console.log(' -M main_file');
  209. console.log(' Add at end javascript file <main_file> acting as main.');
  210. console.log('');
  211. console.log(' -o');
  212. console.log(' Optimize each .js file using the Google closure compiler.');
  213. console.log(' Using Closure compiler found at ~/compiler.jar');
  214. console.log('');
  215. console.log(' -O');
  216. console.log(' Optimize final <Program>.js using the Google closure compiler.');
  217. console.log(' Using Closure compiler found at ~/compiler.jar');
  218. console.log('');
  219. console.log(' -A Same as -O but use --compilation_level ADVANCED_OPTIMIZATIONS');
  220. console.log('');
  221. console.log(' -d');
  222. console.log(' Additionally export code for deploy - stripped from source etc.');
  223. console.log(' Uses suffix ".deploy.js" in addition to any explicit given suffic using -s.');
  224. console.log('');
  225. console.log(' -s suffix');
  226. console.log(' Add <suffix> to compiled js files so that File.st is compiled into');
  227. console.log(' File.<suffix>.js.');
  228. console.log('');
  229. console.log(' -S suffix');
  230. console.log(' Use <suffix> for all libraries accessed using -L or -l. This makes it possible');
  231. console.log(' to have multiple flavors of Amber and libraries in the same place.');
  232. console.log('');
  233. console.log('');
  234. console.log(' Example invocations:');
  235. console.log('');
  236. console.log(' Just compile Kernel-Objects.st to Kernel-Objects.js:');
  237. console.log('');
  238. console.log(' amberc Kernel-Objects.st');
  239. console.log('');
  240. console.log(' Compile Hello.st to Hello.js and create complete program called');
  241. console.log(' Program.js and adding a call to class method #main in class Hello:');
  242. console.log('');
  243. console.log(' amberc -m Hello Hello.st Program');
  244. console.log('');
  245. console.log(' Compile two .st files into corresponding .js files,');
  246. console.log(' and link with specific myboot.js, myKernel.js, myinit.js');
  247. console.log(' and main.js and create complete program called Program.js:');
  248. console.log('');
  249. console.log(' amberc -M main.js myinit.js myboot.js myKernel.js Cat1.st Cat2.st Program');
  250. process.exit();
  251. }
  252. /**
  253. * Checks if the java executable exists and afterwards,
  254. * if compiler.jar exists at the path stored in defaults.closure_jar.
  255. * All closure related entries are set to false upon failure.
  256. *
  257. * callback gets called in any case.
  258. */
  259. function check_for_closure_compiler(callback) {
  260. if (defaults.closure) {
  261. exec('which java', function(error, stdout, stderr) {
  262. // stdout contains path to java executable
  263. if (null !== error) {
  264. console.warn('java is not installed and is needed for -O, -A or -o (Closure compiler).');
  265. defaults.closure = false;
  266. defaults.closure_parts = false;
  267. defaults.closure_full = false;
  268. callback();
  269. return;
  270. }
  271. path.exists(defaults.closure_jar, function(exists) {
  272. if (!exists) {
  273. console.warn('Can not find Closure compiler at: ' + defaults.closure_jar);
  274. defaults.closure = false;
  275. defaults.closure_parts = false;
  276. defaults.closure_full = false;
  277. callback();
  278. return;
  279. }
  280. });
  281. });
  282. } else {
  283. callback();
  284. }
  285. }
  286. /**
  287. * Check if the file given as parameter exists in the local directory or in $AMBER/js/.
  288. * '.js' is appended first.
  289. *
  290. * @param filename name of a file without '.js' prefix
  291. * @param callback gets called on success with path to .js file as parameter
  292. */
  293. function resolve_js(filename, callback) {
  294. var jsFile = filename + defaults.loadsuffix + '.js';
  295. var amberJsFile = path.join(defaults.amber_dir, 'js', jsFile);
  296. console.log('Resolving: ' + jsFile);
  297. path.exists(jsFile, function(exists) {
  298. if (exists) {
  299. callback(jsFile);
  300. } else {
  301. path.exists(amberJsFile, function(exists) {
  302. if (exists) {
  303. callback(amberJsFile);
  304. } else {
  305. throw(new Error('JavaScript file not found: ' + jsFile));
  306. }
  307. });
  308. }
  309. });
  310. }
  311. /**
  312. * Always evaluates the callback parameter.
  313. * Used by Combo blocks to always call the next function,
  314. * even if all of the other functions did not run.
  315. */
  316. function always_resolve(callback) {
  317. callback();
  318. }
  319. /**
  320. * Collect libraries and Smalltalk files looking
  321. * both locally and in $AMBER/js and $AMBER/st.
  322. * Followed by resolve_libraries().
  323. */
  324. function collect_files(stFiles, jsFiles) {
  325. var collected_files = new Combo(function() {
  326. resolve_libraries();
  327. });
  328. collect_st_files(stFiles, collected_files.add());
  329. collect_js_files(jsFiles, collected_files.add());
  330. }
  331. /**
  332. * Resolve st files given by stFiles and add them to defaults.compile.
  333. * Respective categories get added to defaults.compile_categories.
  334. * callback is evaluated afterwards.
  335. */
  336. function collect_st_files(stFiles, callback) {
  337. var collected_st_files = new Combo(function() {
  338. Array.prototype.slice.call(arguments).forEach(function(data) {
  339. if (undefined !== data[0]) {
  340. var stFile = data[0];
  341. var stCategory = data[1];
  342. defaults.compile.push(stFile);
  343. defaults.compiled_categories.push(stCategory);
  344. defaults.compiled.push(stCategory + defaults.suffix_used + '.js');
  345. }
  346. });
  347. callback();
  348. });
  349. stFiles.forEach(function(stFile) {
  350. var _callback = collected_st_files.add();
  351. console.log('Checking: ' + stFile);
  352. var category = path.basename(stFile, '.st');
  353. var amberStFile = path.join(defaults.amber_dir, 'st', stFile);
  354. path.exists(stFile, function(exists) {
  355. if (exists) {
  356. _callback(stFile, category);
  357. } else {
  358. path.exists(amberJsFile, function(exists) {
  359. if (exists) {
  360. _callback(amberStFile, category);
  361. } else {
  362. throw(new Error('JavaScript file not found: ' + jsFile));
  363. }
  364. });
  365. }
  366. });
  367. });
  368. always_resolve(collected_st_files.add());
  369. }
  370. /**
  371. * Resolve js files given by jsFiles and add them to defaults.libraries.
  372. * callback is evaluated afterwards.
  373. */
  374. function collect_js_files(jsFiles, callback) {
  375. var collected_js_files = new Combo(function() {
  376. Array.prototype.slice.call(arguments).forEach(function(file) {
  377. if (undefined !== file[0]) {
  378. defaults.libraries.push(file[0]);
  379. }
  380. });
  381. callback();
  382. });
  383. jsFiles.forEach(function(jsFile) {
  384. resolve_js(currentFile, collected_js_files.add());
  385. });
  386. always_resolve(collected_js_files.add());
  387. }
  388. /**
  389. * Resolve kernel and compiler files.
  390. * Followed by resolve_init().
  391. */
  392. function resolve_libraries() {
  393. // Resolve libraries listed in defaults.base
  394. var all_resolved = new Combo(function(resolved_library_files, resolved_compiler_files) {
  395. resolve_init(resolved_compiler_files[0]);
  396. });
  397. resolve_kernel(all_resolved.add());
  398. resolve_compiler(all_resolved.add());
  399. }
  400. /**
  401. * Resolve .js files needed by kernel
  402. * callback is evaluated afterwards.
  403. */
  404. function resolve_kernel(callback) {
  405. var kernel_files = defaults.base.concat(defaults.load);
  406. var kernel_resolved = new Combo(function() {
  407. Array.prototype.slice.call(arguments).forEach(function(file) {
  408. if (undefined !== file[0]) {
  409. defaults.libraries.push(file[0]);
  410. }
  411. });
  412. callback(null);
  413. });
  414. kernel_files.forEach(function(file) {
  415. resolve_js(file, kernel_resolved.add());
  416. });
  417. always_resolve(kernel_resolved.add());
  418. }
  419. /**
  420. * Resolve .js files needed by compiler.
  421. * callback is evaluated afterwards with resolved files as argument.
  422. */
  423. function resolve_compiler(callback) {
  424. // Resolve compiler libraries
  425. var compiler_files = defaults.compiler_libraries.concat(defaults.load);
  426. var compiler_resolved = new Combo(function() {
  427. var compilerFiles = [];
  428. Array.prototype.slice.call(arguments).forEach(function(file) {
  429. if (undefined !== file[0]) {
  430. compilerFiles.push(file[0]);
  431. }
  432. });
  433. callback(compilerFiles);
  434. });
  435. compiler_files.forEach(function(file) {
  436. resolve_js(file, compiler_resolved.add());
  437. });
  438. always_resolve(compiler_resolved.add());
  439. }
  440. /**
  441. * Resolves default.init and adds it to compilerFiles.
  442. * Followed by create_compiler().
  443. */
  444. function resolve_init(compilerFiles) {
  445. // check and add init.js
  446. var initFile = defaults.init;
  447. if ('.js' !== path.extname(initFile)) {
  448. initFile = resolve_js(initFile);
  449. defaults.init = initFile;
  450. }
  451. compilerFiles.push(initFile);
  452. create_compiler(compilerFiles);
  453. }
  454. /**
  455. * Read all .js files needed by compiler and eval() them.
  456. * The finished Compiler gets stored in defaults.smalltalk.
  457. * Followed by compile().
  458. */
  459. function create_compiler(compilerFilesArray) {
  460. var compiler_files = new Combo(function() {
  461. var content = '(function() {';
  462. Array.prototype.slice.call(arguments).forEach(function(data) {
  463. // data is an array where index 0 is the error code and index 1 contains the data
  464. content += data[1];
  465. });
  466. content = content + 'return smalltalk;})();';
  467. defaults.smalltalk = eval(content);
  468. console.log('Compiler loaded');
  469. compile();
  470. });
  471. compilerFilesArray.forEach(function(file) {
  472. console.log('Loading file: ' + file);
  473. fs.readFile(file, compiler_files.add());
  474. });
  475. };
  476. /**
  477. * Compile all given .st files by importing them.
  478. * Followed by category_export().
  479. */
  480. function compile() {
  481. console.log('Compiling collected .st files')
  482. // import .st files
  483. var imports = new Combo(function() {
  484. Array.prototype.slice.call(arguments).forEach(function(code) {
  485. // get element 0 of code since all return values are stored inside an array by Combo
  486. defaults.smalltalk.Importer._new()._import_(code[0]._stream());
  487. });
  488. category_export();
  489. });
  490. defaults.compile.forEach(function(stFile) {
  491. var callback = imports.add();
  492. if (/\.st/.test(stFile)) {
  493. console.log('Importing: ' + stFile);
  494. fs.readFile(stFile, 'utf8', function(err, data) {
  495. if (!err)
  496. callback(data);
  497. else
  498. throw new Error('Could not import: ' + stFile);
  499. });
  500. }
  501. });
  502. }
  503. /**
  504. * Export compiled categories to JavaScript files.
  505. * Followed by verify().
  506. */
  507. function category_export() {
  508. // export categories as .js
  509. map(defaults.compiled_categories, function(category, callback) {
  510. var jsFile = category + defaults.suffix_used + '.js';
  511. var jsFileDeploy = category + defaults.suffix_used + '.deploy.js';
  512. console.log('Exporting ' + (defaults.deploy ? '(debug + deploy)' : '(debug)')
  513. + ' category ' + category + ' as ' + jsFile
  514. + (defaults.deploy ? ' and ' + jsFileDeploy : ''));
  515. fs.writeFile(jsFile, defaults.smalltalk.Exporter._new()._exportPackage_(category), function(err) {
  516. if (defaults.deploy) {
  517. fs.writeFile(jsFileDeploy, defaults.smalltalk.StrippedExporter._new()._exportPackage_(category), callback);
  518. } else {
  519. callback(null, null);
  520. }
  521. });
  522. }, function(err, result){
  523. verify();
  524. });
  525. }
  526. /**
  527. * Verify if all .st files have been compiled.
  528. * Followed by compose_js_files() and optimize().
  529. */
  530. function verify() {
  531. console.log('Verifying if all .st files were compiled');
  532. map(defaults.compiled, function(file, callback) {
  533. path.exists(file, function(exists) {
  534. if (exists)
  535. callback(null, null);
  536. else
  537. throw(new Error('Compilation failed of: ' + file));
  538. });
  539. }, function(err, result) {
  540. compose_js_files();
  541. optimize();
  542. });
  543. }
  544. /**
  545. * Synchronous function.
  546. * Concatenates compiled JavaScript files into one file in the correct order.
  547. * The name of the produced file is given by defaults.program (set by the last commandline option).
  548. */
  549. function compose_js_files() {
  550. if (undefined !== defaults.program) {
  551. return;
  552. }
  553. var program_files = [];
  554. if (undefined !== defaults.libraries) {
  555. console.log('Collecting libraries: ' + defaults.libraries);
  556. program_files.push.apply(program_files, defaults.libraries);
  557. }
  558. if (undefined !== defaults.compiled) {
  559. console.log('Collecting compiled files: ' + defaults.compiled);
  560. program_files.push.apply(program_files, defaults.compiled);
  561. }
  562. if (undefined !== defaults.init) {
  563. console.log('Adding initializer ' + defaults.init);
  564. program_files.push(defaults.init);
  565. }
  566. console.log('Writing program file: %s.js', defaults.program);
  567. var fileStream = fs.createWriteStream(defaults.program + '.js');
  568. fileStream.on('error', function(error) {
  569. console.log(error);
  570. });
  571. program_files.forEach(function(file) {
  572. console.log('Checking : ' + file);
  573. if(path.existsSync(file)) {
  574. fileStream.write(fs.readFileSync(file));
  575. } else {
  576. throw(new Error('Can not find file ' + file));
  577. }
  578. });
  579. if (undefined !== defaults.main) {
  580. console.log('Adding call to: %s>>main', defaults.main);
  581. fileStream.write('smalltalk.' + defaults.main + '._main()');
  582. }
  583. if (undefined !== defaults.mainfile && path.existsSync(defaults.mainfile)) {
  584. console.log('Adding main file: ' + defaults.mainfile);
  585. fileStream.write(fs.readFileSync(defaults.mainfile));
  586. }
  587. fileStream.end();
  588. console.log('Done.');
  589. }
  590. /**
  591. * Optimize created JavaScript files with Google Closure compiler depending
  592. * on the flags: defaults.closure_parts, defaults.closure_full.
  593. */
  594. function optimize() {
  595. var optimization_done = new Combo(function() {
  596. console.timeEnd('Compile Time');
  597. });
  598. if (defaults.closure_parts) {
  599. console.log('Compiling all js files using Google closure compiler.');
  600. var allJsFiles = defaults.compiled.concat(defaults.libraries);
  601. allJsFiles.forEach(function(file) {
  602. var minifiedName = path.basename(file, '.js') + '.min.js';
  603. closure_compile(file, minifiedName, optimization_done.add());
  604. });
  605. }
  606. if (defaults.closure_full) {
  607. console.log('Compiling ' + defaults.program + '.js file using Google closure compiler.');
  608. closure_compile(defaults.program + '.js', defaults.program + '.min.js', optimization_done.add());
  609. }
  610. always_resolve(optimization_done.add());
  611. }
  612. /**
  613. * Compile sourceFile into minifiedFile with Google Closure compiler.
  614. * callback gets executed once finished.
  615. */
  616. function closure_compile(sourceFile, minifiedFile, callback) {
  617. // exec is asynchronous
  618. exec(
  619. 'java -jar ' +
  620. defaults.closure_jar + ' ' +
  621. defaults.closure_options +
  622. ' --js '+ sourceFile +
  623. ' --js_output_file '+ minifiedFile,
  624. function (error, stdout, stderr) {
  625. if (error) {
  626. console.log(stderr);
  627. } else {
  628. console.log(stdout);
  629. console.log(' '+ minifiedFile + ' built.');
  630. }
  631. callback();
  632. }
  633. );
  634. }