Gruntfile.js 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. var path = require('path');
  2. module.exports = function (grunt) {
  3. var helpers = require('./external/amber-dev/lib/helpers');
  4. grunt.loadTasks('./internal/grunt-tasks');
  5. grunt.loadTasks('./external/amber-dev/tasks');
  6. grunt.loadNpmTasks('grunt-contrib-jshint');
  7. grunt.loadNpmTasks('grunt-contrib-clean');
  8. grunt.loadNpmTasks('grunt-contrib-requirejs');
  9. grunt.loadNpmTasks('grunt-execute');
  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', '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-Exceptions.st', 'src/Kernel-Announcements.st',
  40. 'src/Platform-Services.st', 'src/Platform-ImportExport.st', 'src/Platform-Browser.st',
  41. 'src/Compiler-Exceptions.st', 'src/Compiler-Core.st', 'src/Compiler-AST.st',
  42. 'src/Compiler-IR.st', 'src/Compiler-Inlining.st', 'src/Compiler-Semantic.st', 'src/Compiler-Interpreter.st',
  43. 'src/SUnit.st',
  44. 'src/Kernel-Tests.st', 'src/Compiler-Tests.st', 'src/SUnit-Tests.st'
  45. ],
  46. jsGlobals: ['navigator']
  47. },
  48. cli: {
  49. output_dir: 'external/amber-cli/src',
  50. src: ['external/amber-cli/src/AmberCli.st'],
  51. libraries: [
  52. 'Compiler-Exceptions', 'Compiler-Core', 'Compiler-AST',
  53. 'Compiler-IR', 'Compiler-Inlining', 'Compiler-Semantic', 'Compiler-Interpreter', 'parser',
  54. 'SUnit', 'Platform-ImportExport',
  55. 'Kernel-Tests', 'Compiler-Tests', 'SUnit-Tests'
  56. ],
  57. amd_namespace: 'amber_cli'
  58. },
  59. dev: {
  60. output_dir: 'external/amber-dev/lib',
  61. src: ['external/amber-dev/lib/NodeTestRunner.st'],
  62. amd_namespace: 'amber_devkit'
  63. }
  64. },
  65. requirejs: {
  66. cli: {
  67. options: {
  68. mainConfigFile: "config.js",
  69. rawText: {
  70. "app": "(" + function () {
  71. define(["amber/devel", "amber_cli/AmberCli"], function (amber) {
  72. amber.initialize();
  73. amber.globals.AmberCli._main();
  74. });
  75. } + "());"
  76. },
  77. pragmas: {
  78. // none, for repl to have all info
  79. },
  80. include: ['config-node', 'app'],
  81. optimize: "none",
  82. wrap: helpers.nodeWrap('app'),
  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();
  93. amber.globals.NodeTestRunner._main();
  94. });
  95. } + "());"
  96. },
  97. paths: {"amber_devkit": helpers.libPath},
  98. pragmas: {
  99. // none, amber tests test contexts as well as eg. class copying which needs sources
  100. },
  101. include: ['config-node', 'app'],
  102. optimize: "none",
  103. wrap: helpers.nodeWrap('app'),
  104. out: "test_runner.js"
  105. }
  106. }
  107. },
  108. execute: {
  109. test_runner: {
  110. src: ['test_runner.js']
  111. }
  112. },
  113. clean: {
  114. test_runner: ['test_runner.js']
  115. },
  116. jshint: {
  117. amber: ['src/*.js', 'support/[^p]*.js'],
  118. cli: ['external/amber-cli/src/*.js', 'external/amber-cli/support/*.js'],
  119. dev: ['external/amber-dev/lib/*.js'],
  120. grunt: ['Gruntfile.js', 'internal/grunt-tasks/*.js', 'external/amber-dev/tasks/*.js']
  121. }
  122. });
  123. };