Bootstrap.js 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. var os = require('os');
  2. var path = require('path');
  3. // get the root folder
  4. var atomicRoot = path.resolve(__dirname, "../..") + "/";
  5. // patch in our local node_modules
  6. process.env.NODE_PATH = atomicRoot + "Build/node_modules/";
  7. require('module').Module._initPaths();
  8. var fs = require('fs-extra');
  9. // Load `jake` global
  10. require('../node_modules/jake/lib/jake');
  11. var config = require('./BuildConfig');
  12. var host = require('./Host');
  13. require('./BuildCommon');
  14. var cmd = config._[0];
  15. function printHelp() {
  16. console.log("\nAtomic Editor Build Script");
  17. console.log("--------------------------");
  18. console.log("--help : This help text");
  19. console.log("--with-android : Build with Android platform support");
  20. console.log("--with-ios : Build with iOS platform support");
  21. console.log("--with-web : Build with Web platform support");
  22. console.log("--debug : Build debug version of the editor and associated platform runtimes");
  23. console.log("--noclean : Do not clean before building, useful during development");
  24. console.log("--nonet : Build without AtomicNET C# scripting support");
  25. console.log("--with-docs : Build and install API documents into the editor (requires npm on path)");
  26. console.log("--noexamples : Don't include examples with editor");
  27. console.log("--task=name : Build the specified task (for development)");
  28. console.log("--package : packages the editor to Artifacts/Dist");
  29. console.log("--------------------------")
  30. process.exit(0);
  31. }
  32. if (config["help"]) {
  33. printHelp();
  34. }
  35. if (config["lint"]) {
  36. var lintTask = jake.Task['build:lint'];
  37. lintTask.invoke();
  38. }
  39. if (config["task"]) {
  40. var task = jake.Task[config["task"]];
  41. if (!task) {
  42. console.log("\nBUILD ERROR:\n\nUnknown task: " + config["task"] + "\n");
  43. process.exit(1);
  44. }
  45. cmd = "";
  46. task.invoke();
  47. }
  48. // Atomic Editor Build
  49. if (cmd == "buildeditor") {
  50. console.log("\n\nBuilding Atomic Editor, this process will take a few minutes\n");
  51. var buildTask = jake.Task['build:atomiceditor'];
  52. if (config["with-android"]) {
  53. if (!process.env.ANDROID_NDK) {
  54. console.log("\nANDROID_NDK environment variable not set, exiting\n");
  55. process.exit(1);
  56. }
  57. }
  58. if (config["with-web"]) {
  59. if (!process.env.EMSCRIPTEN) {
  60. console.log("\nEMSCRIPTEN environment variable not set, consider running 'source /Path/To/emsdk_env.sh', exiting\n");
  61. process.exit(1);
  62. }
  63. }
  64. if (config["with-ios"]) {
  65. if (os.platform() != "darwin") {
  66. console.log("\niOS platform requires macOS, exiting\n");
  67. process.exit(1);
  68. }
  69. }
  70. buildTask.invoke();
  71. }