Skip to content
This repository was archived by the owner on Sep 2, 2021. It is now read-only.

Commit 43258ef

Browse files
committed
- small changes based on review feedback
1 parent 3227435 commit 43258ef

File tree

2 files changed

+56
-53
lines changed

2 files changed

+56
-53
lines changed

Gruntfile.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ module.exports = function (grunt) {
6666
"src" : "<%= cef.url %>/cef_binary_<%= cef.version %>_macosx.zip"
6767
},
6868
"cef-mac-symbols": {
69-
"src" : "<%= cef.url %>/cef_binary_<%= cef.version %>_macosx32_release_symbols.7z",
69+
"src" : "<%= cef.url %>/cef_binary_<%= cef.version %>_macosx32_release_symbols.zip",
7070
"dest" : "<%= downloads %>/cefsymbols"
7171
},
7272
"node-mac": {
@@ -79,7 +79,7 @@ module.exports = function (grunt) {
7979
"src" : "<%= cef.url %>/cef_binary_<%= cef.version %>_windows.zip"
8080
},
8181
"cef-win-symbols": {
82-
"src" : "<%= cef.url %>/cef_binary_<%= cef.version %>windows32_debug_symbols.7z",
82+
"src" : ["<%= cef.url %>/cef_binary_<%= cef.version %>_windows32_debug_symbols.zip", "<%= cef.url %>/cef_binary_<%= cef.version %>_windows32_release_symbols.zip"],
8383
"dest" : "<%= downloads %>/cefsymbols"
8484
},
8585
"node-win": {

tasks/setup.js

Lines changed: 54 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -127,84 +127,87 @@ module.exports = function (grunt) {
127127
grunt.task.run("curl-dir:" + grunt.config("cefConfig"));
128128
});
129129

130+
function symbolFileLocation() {
131+
return path.resolve(process.cwd(), "deps/cef/symbols/");
132+
}
133+
130134
grunt.registerTask("cef-symbols", "Download and unpack the CEF symbols", function () {
131135
var config = "cef-" + platform + common.arch() + "-symbols",
132136
zipSymbols = grunt.config("curl-dir." + config + ".src");
133137

134138
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);
138153

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";
144156

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];
147161

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+
}
151167

152-
if (grunt.file.exists(zipDest)) {
153-
grunt.verbose.writeln("Found CEF symbols download " + zipDest);
168+
grunt.task.run(cefTasks);
154169
} else {
155-
cefTasks.unshift("cef-symbols-download");
170+
grunt.verbose.writeln("Skipping CEF symbols download. Found deps/cef/symbols/" + txtName);
156171
}
157-
158-
grunt.task.run(cefTasks);
159-
} else {
160-
grunt.verbose.writeln("Skipping CEF symbols download. Found symbols/cef/" + txtName);
161-
}
172+
});
162173
}
163174
});
164175

165176
// task: cef-extract-symbols
166177
grunt.registerTask("cef-symbols-extract", "Extract CEF symbols zip", function () {
167-
// requires cef to set "cefZipName" in config
168178
grunt.task.requires(["cef-symbols"]);
169179

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+
});
196198
});
197199

198200
// task: cef-download-symbols
199201
grunt.registerTask("cef-symbols-download", "Download and extract the CEF debug/release symbols", function () {
200-
// requires -cef-download-symbols to set "cefSymbolZipName" in config
201202
grunt.task.requires(["cef-symbols"]);
202203

204+
var downloadConfig = arguments[0];
205+
203206
// 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...");
205208
// curl doesn't give me the option to handle download errors on my own. If the requested file can't
206209
// 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);
208211
});
209212

210213
// task: cef-extract

0 commit comments

Comments
 (0)