-
Notifications
You must be signed in to change notification settings - Fork 22
/
Gruntfile.js
162 lines (154 loc) · 4.88 KB
/
Gruntfile.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
'use strict';
module.exports = function(grunt) {
grunt.loadNpmTasks('grunt-closure-compiler');
grunt.loadNpmTasks('grunt-contrib-concat');
// Project configuration.
grunt.initConfig({
// Options
closurePath: (function() {
return process.env.CLOSURE_PATH;
})(),
js: [
'src/setup.js',
'src/sms.js',
'src/utils.js',
'src/sync-client.js',
'src/z80.js',
'src/debugger.js',
'src/keyboard.js',
'src/psg.js',
'src/vdp.js',
'<%= grunt.task.current.nameArgs == "closure-compiler:node" ? "src/node/ui.js" : "src/ui.js" %>',
'src/ports.js',
'src/compiler/bytecode.js',
'src/compiler/parser.js',
'src/compiler/opcodes-ast.js',
'src/compiler/opcodes-CB.js',
'src/compiler/opcodes-DD-FD.js',
'src/compiler/opcodes-ED.js',
'src/compiler/opcodes.js',
'src/compiler/analyzer.js',
'src/compiler/optimizer.js',
'src/compiler/generator.js',
'src/compiler/recompiler.js',
// Required for targets using `output_wrapper`.
'<%= grunt.task.current.nameArgs == "closure-compiler:node" ? "src/node/build/exports.js" : "src/build/exports.js" %>',
],
externs: ['<%= closurePath %>/contrib/externs/jquery-1.9.js'],
'closure-compiler': {
// Generates a minified version of the script.
min: {
js: '<%= js %>',
jsOutputFile: 'min/jssms.min.js',
options: {
externs: '<%= externs %>',
compilation_level: 'SIMPLE',
language_in: 'ECMASCRIPT5_STRICT',
language_out: 'ECMASCRIPT5_STRICT',
use_types_for_optimization: null,
summary_detail_level: 3,
warning_level: 'VERBOSE',
output_wrapper: '(function(window){%output%})(window);',
define: [
//'"DEBUG=false"',
'"ENABLE_DEBUGGER=false"',
//'"ENABLE_COMPILER=true"',
'"ACCURATE_INTERRUPT_EMULATION=false"',
'"ENABLE_SERVER_LOGGER=false"',
],
debug: false,
},
},
// Generates a minified version of the script for debugging.
debug: {
js: '<%= js %>',
jsOutputFile: 'min/jssms.debug.js',
options: {
externs: '<%= externs %>',
compilation_level: 'SIMPLE',
language_in: 'ECMASCRIPT5_STRICT',
language_out: 'ECMASCRIPT5_STRICT',
use_types_for_optimization: null,
summary_detail_level: 3,
warning_level: 'VERBOSE',
define: [
//'"DEBUG=true"',
'"ENABLE_DEBUGGER=true"',
//'"ENABLE_COMPILER=true"',
'"ACCURATE_INTERRUPT_EMULATION=false"',
'"ENABLE_SERVER_LOGGER=false"',
],
debug: true,
formatting: 'PRETTY_PRINT',
},
},
// Generates a unminified concatenated version.
// @todo Refactor to remove 'src/build/exports.js' from object `js` prop.
concat: {
js: '<%= js %>',
jsOutputFile: 'min/jssms.concat.js',
options: {
compilation_level: 'WHITESPACE_ONLY',
language_in: 'ECMASCRIPT5_STRICT',
language_out: 'ECMASCRIPT5_STRICT',
summary_detail_level: 3,
warning_level: 'VERBOSE',
debug: true,
formatting: 'PRETTY_PRINT',
},
},
// Generates a minified version of the script to use with node.js.
node: {
js: '<%= js %>',
jsOutputFile: 'min/jssms.node.js',
options: {
compilation_level: 'ADVANCED_OPTIMIZATIONS',
language_in: 'ECMASCRIPT5_STRICT',
language_out: 'ECMASCRIPT5_STRICT',
use_types_for_optimization: null,
summary_detail_level: 3,
warning_level: 'VERBOSE',
output_wrapper:
'(function(window){%output%module.exports=JSSMS\n})(global);',
define: [
//'"DEBUG=true"',
'"ENABLE_DEBUGGER=true"',
'"ENABLE_COMPILER=false"',
'"ACCURATE_INTERRUPT_EMULATION=true"',
'"ENABLE_SERVER_LOGGER=false"',
],
debug: true,
formatting: 'PRETTY_PRINT',
},
},
},
concat: {
jssms: {
options: {
banner: grunt.file.read('src/license.js'),
},
files: {
'min/jssms.min.js': ['min/jssms.min.js'],
'min/jssms.debug.js': ['min/jssms.debug.js'],
'min/jssms.concat.js': ['min/jssms.concat.js'],
},
},
node: {
options: {
banner: grunt.file.read('src/license.js'),
},
files: {
'min/jssms.node.js': ['min/jssms.node.js'],
},
},
},
});
// Default task.
grunt.registerTask('default', [
'closure-compiler:min',
'closure-compiler:debug',
'closure-compiler:concat',
'concat:jssms',
]);
grunt.registerTask('node', ['closure-compiler:node', 'concat:node']);
};