mkbundle.ck 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. /*++
  2. Copyright (c) 2017 Minoca Corp.
  3. This file is licensed under the terms of the GNU General Public License
  4. version 3. Alternative licensing terms are available. Contact
  5. info@minocacorp.com for details. See the LICENSE file at the root of this
  6. project for complete licensing information.
  7. Module Name:
  8. mkbundle.ck
  9. Abstract:
  10. This module is a build script that can created a single executable version
  11. of the santa application.
  12. Author:
  13. Evan Green 24-May-2017
  14. Environment:
  15. Chalk
  16. --*/
  17. //
  18. // ------------------------------------------------------------------- Includes
  19. //
  20. from app import argv;
  21. from bundle import create;
  22. import santa;
  23. from santa.config import loadConfig;
  24. from santa.modules import enumerateCommands, enumerateContainmentTypes,
  25. enumeratePresentationTypes, initModuleSupport;
  26. import io;
  27. import os;
  28. //
  29. // --------------------------------------------------------------------- Macros
  30. //
  31. //
  32. // ---------------------------------------------------------------- Definitions
  33. //
  34. //
  35. // ------------------------------------------------------ Data Type Definitions
  36. //
  37. //
  38. // ----------------------------------------------- Internal Function Prototypes
  39. //
  40. //
  41. // -------------------------------------------------------------------- Globals
  42. //
  43. //
  44. // ------------------------------------------------------------------ Functions
  45. //
  46. function
  47. main (
  48. )
  49. /*++
  50. Routine Description:
  51. This routine implements the entry point into the create bundle application.
  52. Arguments:
  53. None.
  54. Return Value:
  55. 0 always, or an exception is raised.
  56. --*/
  57. {
  58. var ignoredModules = [null, "__main", "app", "bundle"];
  59. var modules;
  60. var command = "from santa import main;"
  61. "from os import exit;"
  62. "exit(main());";
  63. if (argv.length() != 2) {
  64. Core.raise(ValueError("Usage: %s output_file" % [argv[0]]));
  65. }
  66. //
  67. // Perform enough app-wide init to do the enumerations below.
  68. //
  69. loadConfig(null, {});
  70. initModuleSupport();
  71. //
  72. // Load up all the various modules to pull in the full module graph.
  73. //
  74. enumerateCommands();
  75. enumerateContainmentTypes();
  76. enumeratePresentationTypes();
  77. modules = [];
  78. for (key in Core.modules()) {
  79. if (!ignoredModules.contains(key)) {
  80. modules.append(Core.modules()[key]);
  81. }
  82. }
  83. create(argv[1], modules, command);
  84. return 0;
  85. }
  86. main();
  87. //
  88. // --------------------------------------------------------- Internal Functions
  89. //