2
0

Gruntfile.js 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  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:core', '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. amber_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. amberc: {
  27. options: {
  28. amber_dir: process.cwd(),
  29. closure_jar: ''
  30. },
  31. core: {
  32. output_dir : 'src',
  33. src: ['src/Kernel-Objects.st', 'src/Kernel-Classes.st', 'src/Kernel-Methods.st', 'src/Kernel-Collections.st',
  34. 'src/Kernel-Infrastructure.st', 'src/Kernel-Exceptions.st', 'src/Kernel-Transcript.st', 'src/Kernel-Announcements.st',
  35. 'src/Kernel-ImportExport.st', 'src/Compiler-Exceptions.st', 'src/Compiler-Core.st', 'src/Compiler-AST.st',
  36. 'src/Compiler-IR.st', 'src/Compiler-Inlining.st', 'src/Compiler-Semantic.st', 'src/Compiler-Interpreter.st',
  37. 'src/Web.st', 'src/SUnit.st', 'src/IDE.st',
  38. 'src/Kernel-Tests.st', 'src/Compiler-Tests.st', 'src/SUnit-Tests.st',
  39. 'src/Benchfib.st', 'src/Examples.st'
  40. ],
  41. jsGlobals: ['navigator']
  42. },
  43. amber_kernel: {
  44. output_dir : 'src',
  45. src: ['src/Kernel-Objects.st', 'src/Kernel-Classes.st', 'src/Kernel-Methods.st', 'src/Kernel-Collections.st',
  46. 'src/Kernel-Infrastructure.st', 'src/Kernel-Exceptions.st', 'src/Kernel-Transcript.st', 'src/Kernel-Announcements.st']
  47. },
  48. amber_web: {
  49. output_dir : 'src',
  50. src: ['src/Web.st', 'src/SUnit.st']
  51. },
  52. amber_IDE: {
  53. output_dir : 'src',
  54. src: ['src/IDE.st'],
  55. libraries: ['Web']
  56. },
  57. amber_tests: {
  58. output_dir : 'src',
  59. src: ['src/Kernel-Tests.st', 'src/Compiler-Tests.st', 'src/SUnit-Tests.st'],
  60. libraries: ['SUnit']
  61. },
  62. cli: {
  63. output_dir: 'external/amber-cli/src',
  64. src: ['external/amber-cli/src/AmberCli.st'],
  65. libraries: [
  66. 'Compiler-Exceptions', 'Compiler-Core', 'Compiler-AST',
  67. 'Compiler-IR', 'Compiler-Inlining', 'Compiler-Semantic', 'Compiler-Interpreter', 'parser',
  68. 'SUnit', 'Kernel-ImportExport',
  69. 'Kernel-Tests', 'Compiler-Tests', 'SUnit-Tests'
  70. ],
  71. main_class: 'AmberCli',
  72. output_name: '../support/amber-cli',
  73. amd_namespace: 'amber_cli'
  74. },
  75. dev: {
  76. output_dir: 'external/amber-dev/lib',
  77. src: ['external/amber-dev/lib/Test.st']
  78. },
  79. test_runner: {
  80. src: ['node_modules/amber-dev/lib/Test.st'],
  81. libraries: [
  82. 'Compiler-Exceptions', 'Compiler-Core', 'Compiler-AST',
  83. 'Compiler-IR', 'Compiler-Inlining', 'Compiler-Semantic', 'Compiler-Interpreter', 'parser',
  84. 'SUnit', 'Kernel-ImportExport',
  85. 'Kernel-Tests', 'Compiler-Tests', 'SUnit-Tests'],
  86. main_class: 'NodeTestRunner',
  87. output_name: 'test_runner'
  88. }
  89. },
  90. execute: {
  91. test_runner: {
  92. src: ['test_runner.js']
  93. }
  94. },
  95. clean: {
  96. test_runner: ['test_runner.js']
  97. },
  98. jshint: {
  99. amber: ['src/*.js'],
  100. cli: ['external/amber-cli/src/*.js', 'external/amber-cli/support/*.js'],
  101. dev: ['external/amber-dev/lib/*.js'],
  102. grunt: ['Gruntfile.js', 'internal/grunt-tasks/*.js', 'external/amber-dev/tasks/*.js']
  103. }
  104. });
  105. };