1
0

Gruntfile.js 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  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: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', 'src/IDE.st',
  40. 'src/Kernel-Tests.st', 'src/Compiler-Tests.st', 'src/SUnit-Tests.st',
  41. 'src/Benchfib.st', 'src/Examples.st'
  42. ],
  43. jsGlobals: ['navigator']
  44. },
  45. cli: {
  46. output_dir: 'external/amber-cli/src',
  47. src: ['external/amber-cli/src/AmberCli.st'],
  48. libraries: [
  49. 'Compiler-Exceptions', 'Compiler-Core', 'Compiler-AST',
  50. 'Compiler-IR', 'Compiler-Inlining', 'Compiler-Semantic', 'Compiler-Interpreter', 'parser',
  51. 'SUnit', 'Kernel-ImportExport',
  52. 'Kernel-Tests', 'Compiler-Tests', 'SUnit-Tests'
  53. ],
  54. main_class: 'AmberCli',
  55. output_name: '../support/amber-cli',
  56. amd_namespace: 'amber_cli'
  57. },
  58. dev: {
  59. output_dir: 'external/amber-dev/lib',
  60. src: ['external/amber-dev/lib/Test.st']
  61. },
  62. test_runner: {
  63. src: ['node_modules/amber-dev/lib/Test.st'],
  64. libraries: [
  65. 'Compiler-Exceptions', 'Compiler-Core', 'Compiler-AST',
  66. 'Compiler-IR', 'Compiler-Inlining', 'Compiler-Semantic', 'Compiler-Interpreter', 'parser',
  67. 'SUnit', 'Kernel-ImportExport',
  68. 'Kernel-Tests', 'Compiler-Tests', 'SUnit-Tests'],
  69. main_class: 'NodeTestRunner',
  70. output_name: 'test_runner'
  71. }
  72. },
  73. execute: {
  74. test_runner: {
  75. src: ['test_runner.js']
  76. }
  77. },
  78. clean: {
  79. test_runner: ['test_runner.js']
  80. },
  81. jshint: {
  82. amber: ['src/*.js', 'support/[^p]*.js'],
  83. cli: ['external/amber-cli/src/*.js', 'external/amber-cli/support/*.js'],
  84. dev: ['external/amber-dev/lib/*.js'],
  85. grunt: ['Gruntfile.js', 'internal/grunt-tasks/*.js', 'external/amber-dev/tasks/*.js']
  86. }
  87. });
  88. };