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:cli']);
  10. grunt.registerTask('test', ['amberc:test_runner', 'execute:test_runner', 'clean:test_runner']);
  11. grunt.initConfig({
  12. pkg: grunt.file.readJSON('package.json'),
  13. meta: {
  14. banner: '/*!\n <%= pkg.title || pkg.name %> - v<%= pkg.version %> - <%= grunt.template.today("yyyy-mm-dd") %> \n License: <%= pkg.license.type %> \n*/\n'
  15. },
  16. peg: {
  17. parser: {
  18. options: {
  19. cache: true,
  20. export_var: 'globals.SmalltalkParser'
  21. },
  22. src: 'support/parser.pegjs',
  23. dest: 'support/parser.js'
  24. }
  25. },
  26. amdconfig: {amber: {dest: 'config.js'}},
  27. amberc: {
  28. options: {
  29. amber_dir: process.cwd(),
  30. closure_jar: ''
  31. },
  32. amber: {
  33. output_dir : 'src',
  34. src: ['src/Kernel-Objects.st', 'src/Kernel-Classes.st', 'src/Kernel-Methods.st', 'src/Kernel-Collections.st',
  35. 'src/Kernel-Infrastructure.st', 'src/Kernel-Exceptions.st', 'src/Kernel-Transcript.st', 'src/Kernel-Announcements.st',
  36. 'src/Kernel-ImportExport.st', 'src/Compiler-Exceptions.st', 'src/Compiler-Core.st', 'src/Compiler-AST.st',
  37. 'src/Compiler-IR.st', 'src/Compiler-Inlining.st', 'src/Compiler-Semantic.st', 'src/Compiler-Interpreter.st',
  38. 'src/Web.st', 'src/SUnit.st', 'src/IDE.st',
  39. 'src/Kernel-Tests.st', 'src/Compiler-Tests.st', 'src/SUnit-Tests.st',
  40. 'src/Benchfib.st', 'src/Examples.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'],
  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. };