forked from webrtc/apprtc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gruntfile.js
189 lines (179 loc) · 5.73 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
'use strict';
/* globals module */
var out_app_engine_dir = 'out/app_engine';
var app_engine_path = 'temp/google-cloud-sdk/platform/google_appengine'
// Check if running on travis, if so do not install in User due to using
// pythonEnv.
var isTravis = ('TRAVIS' in process.env && 'CI' in process.env) ?
'' : '--user';
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'
]
}
},
eslint: {
options: {
configFile: 'build/.eslintrc'
},
target: ['src/**/*.js', '!src/**/enums.js', '!src/**/adapter.js' ]
},
shell: {
pipInstall : {
command: ['pip install', isTravis, '--requirement requirements.txt']
.join(' ')
},
ensureGcloudSDKIsInstalled: {
command: 'python build/ensure_gcloud_sdk_is_installed.py'
},
runPythonTests: {
command: ['python', 'build/run_python_tests.py',
app_engine_path, out_app_engine_dir].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(' ')
},
runUnitTests: {
command: 'bash ./build/start-tests.sh'
}
},
'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/'
}
],
}
},
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/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'
},
},
},
karma: {
unit: {
configFile: 'karma.conf.js'
}
}
});
// Enable plugins.
grunt.loadNpmTasks('grunt-contrib-csslint');
grunt.loadNpmTasks('grunt-htmlhint');
grunt.loadNpmTasks('grunt-shell');
grunt.loadNpmTasks('grunt-closurecompiler-new-grunt');
grunt.loadNpmTasks('grunt-eslint');
grunt.loadTasks('build/grunt-chrome-build');
// Set default tasks to run when grunt is called without parameters.
grunt.registerTask('default', ['runLinting', 'runPythonTests', 'build',
'runUnitTests']);
grunt.registerTask('runLinting', ['csslint', 'htmlhint', 'eslint']);
grunt.registerTask('runPythonTests', ['shell:pipInstall',
'shell:ensureGcloudSDKIsInstalled',
'shell:buildAppEnginePackageWithTests',
'shell:runPythonTests',
'shell:removePythonTestsFromOutAppEngineDir']);
grunt.registerTask('runUnitTests', ['shell:runUnitTests']),
grunt.registerTask('build', ['shell:buildAppEnginePackage', 'shell:genJsEnums', 'closurecompiler:debug', 'grunt-chrome-build']);
};