1
0

Gruntfile.js 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. var path = require('path');
  2. module.exports = function (grunt) {
  3. grunt.loadNpmTasks('grunt-contrib-jshint');
  4. grunt.loadNpmTasks('grunt-contrib-clean');
  5. grunt.loadNpmTasks('grunt-contrib-requirejs');
  6. grunt.loadNpmTasks('grunt-execute');
  7. grunt.loadTasks('./internal/grunt-tasks');
  8. grunt.loadTasks('./external/amber-dev/tasks');
  9. var helpers = require('./external/amber-dev').helpers;
  10. grunt.registerTask('default', ['peg', 'build:all']);
  11. grunt.registerTask('build:all', ['amberc:amber', 'build:cli', 'amberc:dev']);
  12. grunt.registerTask('build:cli', ['amberc:cli', 'amdconfig:amber', 'requirejs:cli']);
  13. grunt.registerTask('test', ['amdconfig:amber', 'requirejs:test_runner', 'execute:test_runner', 'clean:test_runner']);
  14. grunt.registerTask('devel', ['amdconfig:amber']);
  15. grunt.initConfig({
  16. pkg: grunt.file.readJSON('package.json'),
  17. meta: {
  18. banner: '/*!\n <%= pkg.title || pkg.name %> - v<%= pkg.version %> - <%= grunt.template.today("yyyy-mm-dd") %> \n License: <%= pkg.license.type %> \n*/\n'
  19. },
  20. peg: {
  21. parser: {
  22. options: {
  23. cache: true,
  24. export_var: '$globals.SmalltalkParser'
  25. },
  26. src: 'support/parser.pegjs',
  27. dest: 'support/parser.js'
  28. }
  29. },
  30. amdconfig: {amber: {dest: 'config.js'}},
  31. amberc: {
  32. options: {
  33. amber_dir: process.cwd(),
  34. closure_jar: ''
  35. },
  36. amber: {
  37. output_dir: 'src',
  38. src: ['src/Kernel-Objects.st', 'src/Kernel-Classes.st', 'src/Kernel-Methods.st', 'src/Kernel-Collections.st',
  39. 'src/Kernel-Infrastructure.st', 'src/Kernel-Promises.st', 'src/Kernel-Exceptions.st', 'src/Kernel-Announcements.st',
  40. 'src/Platform-Services.st', 'src/Platform-ImportExport.st', 'src/Platform-Browser.st', 'src/Platform-Node.st',
  41. 'src/Platform-DOM.st',
  42. 'src/Kernel-Dag.st', 'src/Compiler-Core.st', 'src/Compiler-AST.st', 'src/Compiler-Strom.st',
  43. 'src/Compiler-IR.st', 'src/Compiler-Inlining.st', 'src/Compiler-Semantic.st', 'src/Compiler-Interpreter.st',
  44. 'src/SUnit.st',
  45. 'src/Kernel-Tests.st', 'src/Compiler-Tests.st', 'src/Platform-DOM-Tests.st', 'src/SUnit-Tests.st'
  46. ],
  47. jsGlobals: ['navigator']
  48. },
  49. cli: {
  50. output_dir: 'external/amber-cli/src',
  51. src: ['external/amber-cli/src/AmberCli.st'],
  52. amd_namespace: 'amber_cli'
  53. },
  54. dev: {
  55. output_dir: 'external/amber-dev/lib',
  56. src: ['external/amber-dev/lib/NodeTestRunner.st'],
  57. amd_namespace: 'amber_devkit'
  58. }
  59. },
  60. requirejs: {
  61. options: {
  62. useStrict: true
  63. },
  64. cli: {
  65. options: {
  66. mainConfigFile: "config.js",
  67. rawText: {
  68. "app": "(" + function () {
  69. define(["amber/devel", "amber_cli/AmberCli"], function (amber) {
  70. amber.initialize().then(function () {
  71. amber.globals.AmberCli._main();
  72. });
  73. });
  74. } + "());"
  75. },
  76. pragmas: {
  77. // none, for repl to have all info
  78. },
  79. include: ['config-node', 'app', 'amber/lazypack'],
  80. insertRequire: ['app'],
  81. optimize: "none",
  82. wrap: helpers.nodeWrapperWithShebang,
  83. out: "external/amber-cli/support/amber-cli.js"
  84. }
  85. },
  86. test_runner: {
  87. options: {
  88. mainConfigFile: "config.js",
  89. rawText: {
  90. "app": "(" + function () {
  91. define(["amber/devel", "amber_devkit/NodeTestRunner"], function (amber) {
  92. amber.initialize().then(function () {
  93. amber.globals.NodeTestRunner._main();
  94. });
  95. });
  96. } + "());"
  97. },
  98. paths: {"amber_devkit": helpers.libPath},
  99. pragmas: {
  100. // none, amber tests test contexts as well as eg. class copying which needs sources
  101. },
  102. include: ['config-node', 'app', 'amber/lazypack'],
  103. insertRequire: ['app'],
  104. optimize: "none",
  105. wrap: helpers.nodeWrapperWithShebang,
  106. out: "test_runner.js"
  107. }
  108. }
  109. },
  110. execute: {
  111. test_runner: {
  112. src: ['test_runner.js']
  113. }
  114. },
  115. clean: {
  116. test_runner: ['test_runner.js']
  117. },
  118. jshint: {
  119. amber: ['src/*.js', 'support/[^p]*.js'],
  120. cli: ['external/amber-cli/src/*.js', 'external/amber-cli/support/*.js'],
  121. dev: ['external/amber-dev/lib/*.js'],
  122. grunt: ['Gruntfile.js', 'internal/grunt-tasks/*.js', 'external/amber-dev/tasks/*.js']
  123. }
  124. });
  125. };