Bootstrap.js 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  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("--debug : Build debug version of the editor and associated platform runtimes");
  22. console.log("--noclean : Do not clean before building, useful during development");
  23. console.log("--nonet : Build without AtomicNET C# scripting support");
  24. console.log("--with-docs : Build and install API documents into the editor (requires npm on path)");
  25. console.log("--with-examples : Install examples into the editor (require git on path)");
  26. console.log("--task=name : Build the specified task (for development)");
  27. console.log("--------------------------")
  28. process.exit(0);
  29. }
  30. if (config["help"]) {
  31. printHelp();
  32. }
  33. if (config["lint"]) {
  34. var lintTask = jake.Task['build:lint'];
  35. lintTask.invoke();
  36. }
  37. if (config["task"]) {
  38. var task = jake.Task[config["task"]];
  39. if (!task) {
  40. console.log("\nBUILD ERROR:\n\nUnknown task: " + config["task"] + "\n");
  41. process.exit(1);
  42. }
  43. cmd = "";
  44. task.invoke();
  45. }
  46. // Atomic Editor Build
  47. if (cmd == "buildeditor") {
  48. // simple build check for submodules not being initialized
  49. if (!fs.existsSync(config.atomicRoot + "Submodules/CEF/Windows")) {
  50. console.log("\nBUILD ERROR:\n\nSubmodules not initialized. When cloning repository, please use:\ngit clone --recursive https://github.com/AtomicGameEngine/AtomicGameEngine\n")
  51. process.exit(1);
  52. }
  53. console.log("\n\nBuilding Atomic Editor, this process will take a few minutes\n");
  54. var buildTask = jake.Task['build:atomiceditor'];
  55. if (config["with-android"]) {
  56. if (!process.env.ANDROID_NDK) {
  57. console.log("\nANDROID_NDK environment variable not set, exiting\n");
  58. process.exit(1);
  59. }
  60. }
  61. if (config["with-ios"]) {
  62. if (os.platform() != "darwin") {
  63. console.log("\niOS platform requires macOS, exiting\n");
  64. process.exit(1);
  65. }
  66. }
  67. buildTask.invoke();
  68. }