Gruntfile.js 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  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', 'amberc:all']);
  11. grunt.registerTask('amberc:all', ['amberc:amber', 'amberc:cli', 'amberc:dev']);
  12. grunt.registerTask('test', ['amdconfig:amber', 'requirejs:test_runner', 'execute:test_runner', 'clean:test_runner']);
  13. grunt.registerTask('devel', ['amdconfig:amber']);
  14. grunt.initConfig({
  15. pkg: grunt.file.readJSON('package.json'),
  16. meta: {
  17. banner: '/*!\n <%= pkg.title || pkg.name %> - v<%= pkg.version %> - <%= grunt.template.today("yyyy-mm-dd") %> \n License: <%= pkg.license.type %> \n*/\n'
  18. },
  19. peg: {
  20. parser: {
  21. options: {
  22. cache: true,
  23. export_var: '$globals.SmalltalkParser'
  24. },
  25. src: 'support/parser.pegjs',
  26. dest: 'support/parser.js'
  27. }
  28. },
  29. amdconfig: {amber: {dest: 'config.js'}},
  30. amberc: {
  31. options: {
  32. amber_dir: process.cwd(),
  33. closure_jar: ''
  34. },
  35. amber: {
  36. output_dir: 'src',
  37. src: ['src/Kernel-Objects.st', 'src/Kernel-Classes.st', 'src/Kernel-Methods.st', 'src/Kernel-Collections.st',
  38. 'src/Kernel-Infrastructure.st', 'src/Kernel-Exceptions.st', 'src/Kernel-Announcements.st',
  39. 'src/Platform-Services.st', 'src/Platform-ImportExport.st', 'src/Platform-Browser.st',
  40. 'src/Compiler-Exceptions.st', 'src/Compiler-Core.st', 'src/Compiler-AST.st',
  41. 'src/Compiler-IR.st', 'src/Compiler-Inlining.st', 'src/Compiler-Semantic.st', 'src/Compiler-Interpreter.st',
  42. 'src/SUnit.st',
  43. 'src/Kernel-Tests.st', 'src/Compiler-Tests.st', 'src/SUnit-Tests.st'
  44. ],
  45. jsGlobals: ['navigator']
  46. },
  47. cli: {
  48. output_dir: 'external/amber-cli/src',
  49. src: ['external/amber-cli/src/AmberCli.st'],
  50. libraries: [
  51. 'Compiler-Exceptions', 'Compiler-Core', 'Compiler-AST',
  52. 'Compiler-IR', 'Compiler-Inlining', 'Compiler-Semantic', 'Compiler-Interpreter', 'parser',
  53. 'SUnit', 'Platform-ImportExport',
  54. 'Kernel-Tests', 'Compiler-Tests', 'SUnit-Tests'
  55. ],
  56. main_class: 'AmberCli',
  57. output_name: '../support/amber-cli',
  58. amd_namespace: 'amber_cli'
  59. },
  60. dev: {
  61. output_dir: 'external/amber-dev/lib',
  62. src: ['external/amber-dev/lib/NodeTestRunner.st'],
  63. amd_namespace: 'amber_devkit'
  64. }
  65. },
  66. requirejs: {
  67. test_runner: {
  68. options: {
  69. mainConfigFile: "config.js",
  70. rawText: {
  71. "app": "(" + function () {
  72. define(["amber/devel", "amber_devkit/NodeTestRunner"], function (amber) {
  73. amber.initialize();
  74. amber.globals.NodeTestRunner._main();
  75. });
  76. } + "());"
  77. },
  78. paths: {"amber_devkit": helpers.libPath},
  79. pragmas: {
  80. // none, amber tests test contexts as well as eg. class copying which needs sources
  81. },
  82. include: ['config-node', 'app'],
  83. optimize: "none",
  84. wrap: helpers.nodeWrap('app'),
  85. out: "test_runner.js"
  86. }
  87. }
  88. },
  89. execute: {
  90. test_runner: {
  91. src: ['test_runner.js']
  92. }
  93. },
  94. clean: {
  95. test_runner: ['test_runner.js']
  96. },
  97. jshint: {
  98. amber: ['src/*.js', 'support/[^p]*.js'],
  99. cli: ['external/amber-cli/src/*.js', 'external/amber-cli/support/*.js'],
  100. dev: ['external/amber-dev/lib/*.js'],
  101. grunt: ['Gruntfile.js', 'internal/grunt-tasks/*.js', 'external/amber-dev/tasks/*.js']
  102. }
  103. });
  104. };