@@ -127,84 +127,87 @@ module.exports = function (grunt) {
127
127
grunt . task . run ( "curl-dir:" + grunt . config ( "cefConfig" ) ) ;
128
128
} ) ;
129
129
130
+ function symbolFileLocation ( ) {
131
+ return path . resolve ( process . cwd ( ) , "deps/cef/symbols/" ) ;
132
+ }
133
+
130
134
grunt . registerTask ( "cef-symbols" , "Download and unpack the CEF symbols" , function ( ) {
131
135
var config = "cef-" + platform + common . arch ( ) + "-symbols" ,
132
136
zipSymbols = grunt . config ( "curl-dir." + config + ".src" ) ;
133
137
134
138
if ( zipSymbols ) {
135
- var zipName = path . basename ( zipSymbols ) ,
136
- zipDest = path . resolve ( process . cwd ( ) , path . join ( grunt . config ( "curl-dir." + config + ".dest" ) , zipName ) ) ,
137
- txtName ;
139
+ var symbolSrcUrls = zipSymbols ;
140
+
141
+ if ( ! Array . isArray ( zipSymbols ) ) {
142
+ symbolSrcUrls = [ ] ;
143
+ symbolSrcUrls . push ( zipSymbols ) ;
144
+ }
145
+
146
+ symbolSrcUrls . forEach ( function ( srcUrl ) {
147
+ var zipName = path . basename ( srcUrl ) ,
148
+ zipDest = path . resolve ( process . cwd ( ) , path . join ( grunt . config ( "curl-dir." + config + ".dest" ) , zipName ) ) ,
149
+ txtName ;
150
+
151
+ // extract zip file name and set config property
152
+ grunt . config ( "cefConfig" , config ) ;
138
153
139
- // extract zip file name and set config property
140
- grunt . config ( "cefSymbolsZipDest" , zipDest ) ;
141
- grunt . config ( "cefSymbolsZipSrc" , zipSymbols ) ;
142
- grunt . config ( "cefSymbolsZipName" , zipName ) ;
143
- grunt . config ( "cefConfig" , config ) ;
154
+ // remove .zip extension
155
+ txtName = path . basename ( zipName , ".zip" ) + ".txt" ;
144
156
145
- // remove .zip extension
146
- txtName = zipName . substr ( 0 , zipName . lastIndexOf ( "." ) ) + ".txt" ;
157
+ // optionally download if CEF is not found
158
+ if ( ! grunt . file . exists ( path . resolve ( path . join ( symbolFileLocation ( ) , txtName ) ) ) ) {
159
+ // pass the name of the zip file
160
+ var cefTasks = [ "cef-symbols-extract" + ":" + zipDest ] ;
147
161
148
- // optionally download if CEF is not found
149
- if ( ! grunt . file . exists ( "symbols/cef/" + txtName ) ) {
150
- var cefTasks = [ "cef-symbols-extract" ] ;
162
+ if ( grunt . file . exists ( zipDest ) ) {
163
+ grunt . verbose . writeln ( "Found CEF symbols download " + zipDest ) ;
164
+ } else {
165
+ cefTasks . unshift ( "cef-symbols-download" + ":" + config ) ;
166
+ }
151
167
152
- if ( grunt . file . exists ( zipDest ) ) {
153
- grunt . verbose . writeln ( "Found CEF symbols download " + zipDest ) ;
168
+ grunt . task . run ( cefTasks ) ;
154
169
} else {
155
- cefTasks . unshift ( "cef- symbols- download" ) ;
170
+ grunt . verbose . writeln ( "Skipping CEF symbols download. Found deps/cef/symbols/" + txtName ) ;
156
171
}
157
-
158
- grunt . task . run ( cefTasks ) ;
159
- } else {
160
- grunt . verbose . writeln ( "Skipping CEF symbols download. Found symbols/cef/" + txtName ) ;
161
- }
172
+ } ) ;
162
173
}
163
174
} ) ;
164
175
165
176
// task: cef-extract-symbols
166
177
grunt . registerTask ( "cef-symbols-extract" , "Extract CEF symbols zip" , function ( ) {
167
- // requires cef to set "cefZipName" in config
168
178
grunt . task . requires ( [ "cef-symbols" ] ) ;
169
179
170
- // var done = this.async(),
171
- // zipDest = grunt.config("cefSymbolsZipDest"),
172
- // zipName = grunt.config("cefSymbolsZipName"),
173
- // unzipPromise;
174
- //
175
- // // unzip to symbols/
176
- // unzipPromise = unzip(zipDest, "symbols");
177
- //
178
- // // remove .zip ext
179
- // zipName = path.basename(zipName, ".7z");
180
- //
181
- // unzipPromise.then(function () {
182
- // // rename version stamped name to cef
183
- // return rename("deps/" + zipName, "deps/cef");
184
- // }).then(function () {
185
- // var memo = path.resolve(process.cwd(), "symbols/cef/" + zipName + ".txt"),
186
- // permissionsPromise,
187
- // defer = q.defer();
188
- //
189
- // // write empty file with zip file
190
- // grunt.file.write(memo, "");
191
- // done();
192
- // }, function (err) {
193
- // grunt.log.writeln(err);
194
- // done(false);
195
- // });
180
+ var done = this . async ( ) ,
181
+ zipDest = arguments [ 0 ] ,
182
+ zipName = path . basename ( zipDest , '.zip' ) ,
183
+ unzipPromise ;
184
+
185
+ // unzip to deps/cef/symbols/
186
+ unzipPromise = unzip ( zipDest , symbolFileLocation ( ) ) ;
187
+
188
+ unzipPromise . then ( function ( ) {
189
+ var memo = path . resolve ( path . join ( symbolFileLocation ( ) , zipName + ".txt" ) ) ;
190
+
191
+ // write empty file with zip file
192
+ grunt . file . write ( memo , "" ) ;
193
+ done ( ) ;
194
+ } , function ( err ) {
195
+ grunt . log . writeln ( err ) ;
196
+ done ( false ) ;
197
+ } ) ;
196
198
} ) ;
197
199
198
200
// task: cef-download-symbols
199
201
grunt . registerTask ( "cef-symbols-download" , "Download and extract the CEF debug/release symbols" , function ( ) {
200
- // requires -cef-download-symbols to set "cefSymbolZipName" in config
201
202
grunt . task . requires ( [ "cef-symbols" ] ) ;
202
203
204
+ var downloadConfig = arguments [ 0 ] ;
205
+
203
206
// run curl
204
- grunt . log . writeln ( "Downloading " + grunt . config ( "cefSymbolZipSrc" ) + ". This may take a while..." ) ;
207
+ grunt . log . writeln ( "Downloading " + downloadConfig + ". This may take a while..." ) ;
205
208
// curl doesn't give me the option to handle download errors on my own. If the requested file can't
206
209
// be found, curl will log an error to the console.
207
- grunt . task . run ( "curl-dir:" + grunt . config ( "cefConfig" ) ) ;
210
+ grunt . task . run ( "curl-dir:" + downloadConfig ) ;
208
211
} ) ;
209
212
210
213
// task: cef-extract
0 commit comments