forked from webrtc/apprtc
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGruntfile.js
More file actions
174 lines (162 loc) · 4.78 KB
/
Copy pathGruntfile.js
File metadata and controls
174 lines (162 loc) · 4.78 KB
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
'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',
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']
},
shell: {
runPythonTests: {
command: './build/run_python_tests.sh'
},
buildAppEnginePackage: {
command: 'python ./build/build_app_engine_package.py src ' + out_app_engine_dir,
options: {
stdout: true,
stderr: true
}
}
},
'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': [
'src/web_app/js/adapter.js',
'src/web_app/js/appcontroller.js',
'src/web_app/js/call.js',
'src/web_app/js/infobox.js',
'src/web_app/js/peerconnectionclient.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',
]
},
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', 'jstests']);
grunt.registerTask('runPythonTests', ['shell:buildAppEnginePackage', 'shell:runPythonTests']);
grunt.registerTask('jstests', ['closurecompiler:debug', 'jstdPhantom']);
// buildAppEnginePackage must be done before closurecompiler since buildAppEnginePackage resets the out/app_engine dir.
grunt.registerTask('build', ['shell:buildAppEnginePackage', 'closurecompiler:debug', 'grunt-chrome-build']);
// also possible to call JavaScript directly in registerTask()
// or to call external tasks with grunt.loadTasks()
};