Gruntfile.js 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. var path = require('path');
  2. module.exports = function(grunt) {
  3. grunt.loadTasks('./internal/grunt-tasks');
  4. grunt.loadNpmTasks('amber-dev');
  5. grunt.loadNpmTasks('grunt-contrib-jshint');
  6. grunt.loadNpmTasks('grunt-contrib-clean');
  7. grunt.loadNpmTasks('grunt-execute');
  8. grunt.registerTask('default', ['peg', 'amberc:all']);
  9. grunt.registerTask('amberc:all', ['amberc:amber', 'amberc:attic', 'amberc:cli']);
  10. grunt.registerTask('test', ['amberc:test_runner', 'execute:test_runner', 'clean:test_runner']);
  11. grunt.registerTask('devel', ['amdconfig:amber']);
  12. grunt.initConfig({
  13. pkg: grunt.file.readJSON('package.json'),
  14. meta: {
  15. banner: '/*!\n <%= pkg.title || pkg.name %> - v<%= pkg.version %> - <%= grunt.template.today("yyyy-mm-dd") %> \n License: <%= pkg.license.type %> \n*/\n'
  16. },
  17. peg: {
  18. parser: {
  19. options: {
  20. cache: true,
  21. export_var: '$globals.SmalltalkParser'
  22. },
  23. src: 'support/parser.pegjs',
  24. dest: 'support/parser.js'
  25. }
  26. },
  27. amdconfig: {amber: {dest: 'config.js'}},
  28. amberc: {
  29. options: {
  30. amber_dir: process.cwd(),
  31. closure_jar: ''
  32. },
  33. amber: {
  34. output_dir : 'src',
  35. src: ['src/Kernel-Objects.st', 'src/Kernel-Classes.st', 'src/Kernel-Methods.st', 'src/Kernel-Collections.st',
  36. 'src/Kernel-Infrastructure.st', 'src/Kernel-Exceptions.st', 'src/Kernel-Transcript.st', 'src/Kernel-Announcements.st',
  37. 'src/Kernel-ImportExport.st', 'src/Compiler-Exceptions.st', 'src/Compiler-Core.st', 'src/Compiler-AST.st',
  38. 'src/Compiler-IR.st', 'src/Compiler-Inlining.st', 'src/Compiler-Semantic.st', 'src/Compiler-Interpreter.st',
  39. 'src/Web.st', 'src/SUnit.st',
  40. 'src/Kernel-Tests.st', 'src/Compiler-Tests.st', 'src/SUnit-Tests.st'
  41. ],
  42. jsGlobals: ['navigator']
  43. },
  44. cli: {
  45. output_dir: 'external/amber-cli/src',
  46. src: ['external/amber-cli/src/AmberCli.st'],
  47. libraries: [
  48. 'Compiler-Exceptions', 'Compiler-Core', 'Compiler-AST',
  49. 'Compiler-IR', 'Compiler-Inlining', 'Compiler-Semantic', 'Compiler-Interpreter', 'parser',
  50. 'SUnit', 'Kernel-ImportExport',
  51. 'Kernel-Tests', 'Compiler-Tests', 'SUnit-Tests'
  52. ],
  53. main_class: 'AmberCli',
  54. output_name: '../support/amber-cli',
  55. amd_namespace: 'amber_cli'
  56. },
  57. dev: {
  58. output_dir: 'external/amber-dev/lib',
  59. src: ['external/amber-dev/lib/Test.st']
  60. },
  61. test_runner: {
  62. src: ['node_modules/amber-dev/lib/Test.st'],
  63. libraries: [
  64. 'Compiler-Exceptions', 'Compiler-Core', 'Compiler-AST',
  65. 'Compiler-IR', 'Compiler-Inlining', 'Compiler-Semantic', 'Compiler-Interpreter', 'parser',
  66. 'SUnit', 'Kernel-ImportExport',
  67. 'Kernel-Tests', 'Compiler-Tests', 'SUnit-Tests'],
  68. main_class: 'NodeTestRunner',
  69. output_name: 'test_runner'
  70. }
  71. },
  72. execute: {
  73. test_runner: {
  74. src: ['test_runner.js']
  75. }
  76. },
  77. clean: {
  78. test_runner: ['test_runner.js']
  79. },
  80. jshint: {
  81. amber: ['src/*.js', 'support/[^p]*.js'],
  82. cli: ['external/amber-cli/src/*.js', 'external/amber-cli/support/*.js'],
  83. dev: ['external/amber-dev/lib/*.js'],
  84. grunt: ['Gruntfile.js', 'internal/grunt-tasks/*.js', 'external/amber-dev/tasks/*.js']
  85. }
  86. });
  87. };