2
0

Gruntfile.js 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  1. module.exports = function(grunt) {
  2. grunt.loadTasks('./grunt/tasks');
  3. grunt.loadNpmTasks('grunt-contrib-jshint');
  4. // grunt.loadNpmTasks('grunt-image-embed');
  5. // grunt.loadNpmTasks('grunt-contrib-mincss');
  6. grunt.registerTask('default', ['peg', 'amberc:all']);
  7. grunt.initConfig({
  8. pkg: grunt.file.readJSON('package.json'),
  9. meta: {
  10. banner: '/*!\n <%= pkg.title || pkg.name %> - v<%= pkg.version %> - <%= grunt.template.today("yyyy-mm-dd") %> \n License: <%= pkg.license.type %> \n*/\n'
  11. },
  12. peg: {
  13. amber_parser: {
  14. options: {
  15. trackLineAndColumn: true,
  16. cache: true,
  17. export_var: 'smalltalk.parser'
  18. },
  19. src: 'js/parser.pegjs',
  20. dest: 'js/parser.js',
  21. }
  22. },
  23. amberc: {
  24. _config: {
  25. amber_dir: process.cwd(),
  26. closure_jar: ''
  27. },
  28. all: {
  29. output_dir : 'js',
  30. src: ['st/Kernel-Objects.st', 'st/Kernel-Classes.st', 'st/Kernel-Methods.st', 'st/Kernel-Collections.st',
  31. 'st/Kernel-Exceptions.st', 'st/Kernel-Transcript.st', 'st/Kernel-Announcements.st',
  32. 'st/Importer-Exporter.st', 'st/Compiler-Exceptions.st', 'st/Compiler-Core.st', 'st/Compiler-AST.st',
  33. 'st/Compiler-IR.st', 'st/Compiler-Inlining.st', 'st/Compiler-Semantic.st',
  34. 'st/Canvas.st', 'st/SUnit.st', 'st/IDE.st',
  35. 'st/Kernel-Tests.st', 'st/Compiler-Tests.st', 'st/SUnit-Tests.st'
  36. ],
  37. deploy: true
  38. },
  39. amber_kernel: {
  40. output_dir : 'js',
  41. src: ['st/Kernel-Objects.st', 'st/Kernel-Classes.st', 'st/Kernel-Methods.st', 'st/Kernel-Collections.st',
  42. 'st/Kernel-Exceptions.st', 'st/Kernel-Transcript.st', 'st/Kernel-Announcements.st'],
  43. deploy: true
  44. },
  45. amber_compiler: {
  46. output_dir : 'js',
  47. src: ['st/Importer-Exporter.st', 'st/Compiler-Exceptions.st', 'st/Compiler-Core.st', 'st/Compiler-AST.st',
  48. 'st/Compiler-IR.st', 'st/Compiler-Inlining.st', 'st/Compiler-Semantic.st'],
  49. output_name: 'Compiler',
  50. deploy: true
  51. },
  52. amber_canvas: {
  53. output_dir : 'js',
  54. src: ['st/Canvas.st', 'st/SUnit.st'],
  55. deploy: true,
  56. verbose: true
  57. },
  58. amber_IDE: {
  59. output_dir : 'js',
  60. src: ['st/IDE.st'],
  61. libraries: ['Canvas'],
  62. deploy: true
  63. },
  64. amber_tests: {
  65. output_dir : 'js',
  66. src: ['st/Kernel-Tests.st', 'st/Compiler-Tests.st', 'st/SUnit-Tests.st'],
  67. libraries: ['SUnit']
  68. },
  69. amber_test_runner: {
  70. src: ['test/Test.st'],
  71. libraries: [
  72. 'Compiler-Exceptions', 'Compiler-Core', 'Compiler-AST',
  73. 'Compiler-IR', 'Compiler-Inlining', 'Compiler-Semantic', 'Compiler-Interpreter', 'parser',
  74. 'SUnit',
  75. 'Kernel-Tests', 'Compiler-Tests', 'SUnit-Tests'],
  76. output_name: 'test/amber_test_runner'
  77. },
  78. amber_dev: {
  79. src: [
  80. 'Compiler-Exceptions.js', 'Compiler-Core.js', 'Compiler-AST.js',
  81. 'Compiler-IR.js', 'Compiler-Inlining.js', 'Compiler-Semantic.js',
  82. 'Canvas.js', 'IDE.js', 'SUnit.js',
  83. 'Kernel-Tests.js', 'Compiler-Tests.js', 'SUnit-Tests.js'],
  84. output_name: 'js/amber_dev'
  85. },
  86. amber_cli: {
  87. output_dir: 'cli/js',
  88. src: ['cli/st/AmberCli.st'],
  89. libraries: [
  90. 'Compiler-Exceptions', 'Compiler-Core', 'Compiler-AST',
  91. 'Compiler-IR', 'Compiler-Inlining', 'Compiler-Semantic', 'Compiler-Interpreter', 'parser'
  92. ],
  93. main_class: 'AmberCli',
  94. output_name: 'amber-cli'
  95. }
  96. },
  97. jshint: {
  98. amber: ['js/*.js'],
  99. server: ['server/*.js'],
  100. repl: ['repl/*.js'],
  101. tests: ['test/*.js'],
  102. grunt: ['grunt.js', 'grunt/**/*.js']
  103. },
  104. /*
  105. concat: {
  106. deploy: {
  107. src: ['tmp/amber-compiled.deploy.js'],
  108. dest: 'dist/amber-<%= pkg.version %>.deploy.js'
  109. },
  110. css: {
  111. src: [
  112. 'css/amber.css',
  113. 'js/lib/CodeMirror/codemirror.css',
  114. 'js/lib/CodeMirror/amber.css'
  115. ],
  116. dest: 'tmp/amber.css'
  117. },
  118. dev: {
  119. src: [
  120. 'js/lib/jQuery/jquery-ui-1.8.16.custom.min.js',
  121. 'js/lib/jQuery/jquery.textarea.js',
  122. 'js/lib/CodeMirror/codemirror.js',
  123. 'js/lib/CodeMirror/smalltalk.js',
  124. 'tmp/amber-compiled.js',
  125. 'tmp/css.js'
  126. ],
  127. dest: 'dist/amber-<%= pkg.version %>.js'
  128. }
  129. },
  130. imageEmbed: {
  131. dev: {
  132. src: ['tmp/amber.css'],
  133. dest: 'tmp/amber-images.css',
  134. options: {baseDir: 'public'}
  135. }
  136. },
  137. mincss: {
  138. dev: {
  139. src: ['tmp/amber-images.css'],
  140. dest: 'tmp/amber.min.css'
  141. }
  142. },
  143. css2js: {
  144. dev: {
  145. src: 'tmp/amber.min.css',
  146. dest: 'tmp/css.js'
  147. }
  148. },
  149. min: {
  150. deploy: {
  151. src: 'dist/amber-<%= pkg.version %>.deploy.js',
  152. dest: 'dist/amber-<%= pkg.version %>.deploy.min.js'
  153. }
  154. }
  155. */
  156. });
  157. };