forked from webrtc/apprtc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gruntfile.js
200 lines (188 loc) · 6.18 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
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
'use strict';
/* globals module */
var out_app_engine_dir = 'out/app_engine';
module.exports = function(grunt) {
// configure project
grunt.initConfig({
// make node configurations available
pkg: grunt.file.readJSON('package.json'),
csslint: {
options: {
csslintrc: 'build/.csslintrc'
},
strict: {
options: {
import: 2
},
src: ['src/**/*.css'
]
},
lax: {
options: {
import: false
},
src: ['src/**/*.css'
]
}
},
htmlhint: {
html1: {
src: [
'src/**/*_template.html'
]
}
},
jscs: {
src: ['src/**/*.js', '!src/**/enums.js'],
options: {
preset: 'google', // as per Google style guide – could use '.jscsrc' instead
requireCurlyBraces: ['if']
}
},
jshint: {
options: {
jshintrc: 'build/.jshintrc'
},
// files to validate
// can choose more than one name + array of paths
// usage with this name: grunt jshint:files
files: ['src/**/*.js', '!src/**/enums.js', '!src/**/adapter.js']
},
shell: {
getPythonTestDeps: {
command: 'python build/get_python_test_deps.py'
},
installPythonTestDepsOnLinux: {
command: 'python build/install_webtest_on_linux.py webtest-master/'
},
runPythonTests: {
command: ['python', 'build/run_python_tests.py', 'google_appengine/',
out_app_engine_dir, 'webtest-master/'].join(' ')
},
buildAppEnginePackage: {
command: ['python', './build/build_app_engine_package.py', 'src',
out_app_engine_dir].join(' ')
},
buildAppEnginePackageWithTests: {
command: ['python', './build/build_app_engine_package.py', 'src',
out_app_engine_dir, '--include-tests'].join(' ')
},
removePythonTestsFromOutAppEngineDir: {
command: ['python', './build/remove_python_tests.py',
out_app_engine_dir].join(' ')
},
genJsEnums: {
command: ['python', './build/gen_js_enums.py', 'src',
'src/web_app/js'].join(' ')
},
},
'grunt-chrome-build' : {
apprtc: {
options: {
buildDir: 'out/chrome_app',
zipFile: 'out/chrome_app/apprtc.zip',
// If values for chromeBinary and keyFile are not provided, the packaging
// step will be skipped.
// chromeBinary should be set to the Chrome executable on your system.
chromeBinary: null,
// keyFile should be set to the key you want to use to create the crx package
keyFile: null,
appwindowHtmlSrc: 'src/web_app/html/index_template.html',
appwindowHtmlDest: 'out/chrome_app/appwindow.html'
},
files: [
{
expand: true,
cwd: 'src/web_app/chrome_app',
src: [
'manifest.json'
],
dest: 'out/chrome_app/'
},
{
expand: true,
cwd: out_app_engine_dir,
src: [
'**/*.js',
'**/*.css',
'**/images/apprtc*.png',
'!**/*.pem'
],
dest: 'out/chrome_app/'
},
{
expand: true,
cwd: 'src/web_app',
src: [
'js/background.js',
'js/appwindow.js',
'!**/*.pem'
],
dest: 'out/chrome_app/'
}
],
}
},
jstdPhantom: {
options: {
useLatest : true,
port: 9876,
},
files: [
'build/js_test_driver.conf',
]},
closurecompiler: {
debug: {
files: {
// Destination: [source files]
'out/app_engine/js/apprtc.debug.js': [
'node_modules/webrtc-adapter/out/adapter.js',
'src/web_app/js/analytics.js',
'src/web_app/js/enums.js',
'src/web_app/js/adapter.js',
'src/web_app/js/appcontroller.js',
'src/web_app/js/call.js',
'src/web_app/js/constants.js',
'src/web_app/js/infobox.js',
'src/web_app/js/peerconnectionclient.js',
'src/web_app/js/remotewebsocket.js',
'src/web_app/js/roomselection.js',
'src/web_app/js/sdputils.js',
'src/web_app/js/signalingchannel.js',
'src/web_app/js/stats.js',
'src/web_app/js/storage.js',
'src/web_app/js/util.js',
'src/web_app/js/windowport.js',
]
},
options: {
'compilation_level': 'WHITESPACE_ONLY',
'language_in': 'ECMASCRIPT5',
'formatting': 'PRETTY_PRINT'
},
},
},
});
// Enable plugins.
grunt.loadNpmTasks('grunt-contrib-csslint');
grunt.loadNpmTasks('grunt-htmlhint');
grunt.loadNpmTasks('grunt-jscs');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-shell');
grunt.loadNpmTasks('grunt-jstestdriver-phantomjs');
grunt.loadNpmTasks('grunt-closurecompiler');
grunt.loadTasks('build/grunt-chrome-build');
// Set default tasks to run when grunt is called without parameters.
grunt.registerTask('default', ['csslint', 'htmlhint', 'jscs', 'jshint',
'runPythonTests', 'shell:genJsEnums', 'jstests']);
grunt.registerTask('travis', ['shell:getPythonTestDeps',
'shell:installPythonTestDepsOnLinux',
'default']);
grunt.registerTask('runPythonTests', ['shell:buildAppEnginePackageWithTests',
'shell:getPythonTestDeps',
'shell:runPythonTests',
'shell:removePythonTestsFromOutAppEngineDir']);
grunt.registerTask('jstests', ['shell:genJsEnums', 'closurecompiler:debug', 'grunt-chrome-build', 'jstdPhantom']);
// buildAppEnginePackage must be done before closurecompiler since buildAppEnginePackage resets out/app_engine.
grunt.registerTask('build', ['shell:buildAppEnginePackage', 'shell:genJsEnums', 'closurecompiler:debug', 'grunt-chrome-build']);
};