BuildCommon.js 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. var fs = require('fs-extra');
  2. var os = require('os');
  3. var path = require("path");
  4. var host = require("./Host");
  5. var atomicRoot = host.atomicRoot;
  6. namespace('build', function() {
  7. task('genscripts', {
  8. async: true
  9. }, function(platform) {
  10. process.chdir(atomicRoot);
  11. var modules = host.getScriptModules(platform);
  12. var bindCmd = host.atomicTool + " bind \"" + atomicRoot + "\" ";
  13. var node;
  14. switch(os.platform()) {
  15. case "win32":
  16. node = "Build/Windows/node/node.exe";
  17. break;
  18. case "darwin":
  19. node = "Build/Mac/node/node";
  20. break;
  21. case "linux":
  22. node = "Build/Linux/node/node";
  23. break;
  24. }
  25. var cmds = [];
  26. for (var pkgName in modules) {
  27. cmds.push(bindCmd + "Script/Packages/" + pkgName + "/ " + platform);
  28. }
  29. if (node) {
  30. // compile
  31. cmds.push(node + " ./Build/node_modules/typeScript/bin/tsc -p ./Script");
  32. // lint
  33. cmds.push(node + " ./Build/node_modules/tslint/bin/tslint -c ./Script/tslint.json ./Script/**/*.ts");
  34. } else {
  35. throw new Error("Node not configured for this platform: " + os.platform());
  36. }
  37. jake.exec(cmds, function() {
  38. complete();
  39. }, {
  40. printStdout: true
  41. });
  42. });
  43. }); // end of build namespace