forked from webrtc/samples
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gruntfile.js
173 lines (160 loc) · 5.38 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
'use strict';
/* globals module */
module.exports = function(grunt) {
// configure project
grunt.initConfig({
// make node configurations available
pkg: grunt.file.readJSON('package.json'),
csslint: {
options: {
csslintrc: 'samples/web/.csslintrc'
},
strict: {
options: {
import: 2
},
src: ['samples/web/content/**/*.css',
'!samples/web/content/**/*_nolint.css',
'!samples/web/content/testrtc/bower_components/**/*.css'
]
},
lax: {
options: {
import: false
},
src: ['samples/web/content/**/*.css',
'!samples/web/content/**/*_nolint.css',
'!samples/web/content/testrtc/bower_components/**/*.css'
]
}
},
htmlhint: {
html1: {
src: [
'samples/web/content/apprtc/index.html',
'samples/web/content/datachannel/index.html',
'samples/web/content/getusermedia/**/index.html',
'samples/web/content/peerconnection/**/index.html'
]
}
},
jscs: {
src: 'samples/web/content/**/*.js',
options: {
preset: 'google', // as per Google style guide – could use '.jscsrc' instead
'excludeFiles': [
'samples/web/content/apprtc/js/compiled/*.js',
'samples/web/content/apprtc/js/vr.js',
'samples/web/content/apprtc/js/stereoscopic.js',
'samples/web/content/getusermedia/desktopcapture/extension/content-script.js',
'samples/web/content/testrtc/bower_components/**',
// TODO (chuckhays) : remove these exclusions after code passes.
'samples/web/content/getusermedia/**/*.js',
'samples/web/content/peerconnection/**/*.js',
'samples/web/content/datachannel/**/*.js'
]
}
},
jshint: {
options: {
ignores: [
'samples/web/content/getusermedia/desktopcapture/**',
'samples/web/content/apprtc/js/compiled/*.js',
'samples/web/content/apprtc/js/stereoscopic.js',
'samples/web/content/apprtc/js/ga.js',
'samples/web/content/apprtc/js/vr.js',
'samples/web/content/testrtc/bower_components/**'
],
// use default .jshintrc files
jshintrc: true
},
// files to validate
// can choose more than one name + array of paths
// usage with this name: grunt jshint:files
files: ['samples/web/content/**/*.js']
},
shell: {
runPythonTests: {
command: './run_python_tests.sh'
},
},
'grunt-chrome-build' : {
apprtc: {
options: {
buildDir: 'build/chrome-app',
zipFile: 'build/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
},
files: [
{
expand: true,
cwd: 'samples/web/content/apprtc',
src: [
'**/*.js',
'!**/*test.js',
'**/*.css',
'images/apprtc*.png',
'manifest.json',
'!*.pem'
],
dest: 'build/chrome-app/'
}
]
}
},
jstdPhantom: {
options: {
useLatest : true,
port: 9876,
},
files: [
'samples/web/content/apprtc/js_test_driver.conf',
]},
closurecompiler: {
debug: {
files: {
// Destination: [source files]
'samples/web/content/apprtc/js/compiled/apprtc.debug.js': [
'samples/web/content/apprtc/js/adapter.js',
'samples/web/content/apprtc/js/appcontroller.js',
'samples/web/content/apprtc/js/call.js',
'samples/web/content/apprtc/js/infobox.js',
'samples/web/content/apprtc/js/peerconnectionclient.js',
'samples/web/content/apprtc/js/roomselection.js',
'samples/web/content/apprtc/js/sdputils.js',
'samples/web/content/apprtc/js/signalingchannel.js',
'samples/web/content/apprtc/js/stats.js',
'samples/web/content/apprtc/js/storage.js',
'samples/web/content/apprtc/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('grunt-chrome-build');
// set default tasks to run when grunt is called without parameters
grunt.registerTask('default', ['csslint', 'htmlhint',
'jscs', 'jshint', 'shell:runPythonTests', 'jstests']);
grunt.registerTask('jstests', ['closurecompiler:debug', 'jstdPhantom']);
grunt.registerTask('build', ['closurecompiler:debug', 'grunt-chrome-build']);
// also possible to call JavaScript directly in registerTask()
// or to call external tasks with grunt.loadTasks()
};