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

Commit ea2d08e

Browse files
committed
Merge pull request #372 from adobe/jasonsanjose/jenkins
Specify downloads folder path to allow Jenkins to cache CEF and Node downloads
2 parents 0faa50c + 191097f commit ea2d08e

File tree

3 files changed

+28
-19
lines changed

3 files changed

+28
-19
lines changed

Gruntfile.js

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -41,40 +41,41 @@ module.exports = function (grunt) {
4141
grunt.initConfig({
4242
"pkg": grunt.file.readJSON("package.json"),
4343
"config-json": staging + "/www/config.json",
44+
"downloads": grunt.option("downloads") || "downloads",
4445
"curl-dir": {
4546
/* linux */
4647
"cef-linux32": {
47-
"dest" : "downloads/",
48+
"dest" : "<%= downloads %>",
4849
"src" : "http://dev.brackets.io/cef/cef_binary_<%= cef.version %>_linux32_release.zip"
4950
},
5051
"cef-linux64": {
51-
"dest" : "downloads/",
52+
"dest" : "<%= downloads %>",
5253
"src" : "http://dev.brackets.io/cef/cef_binary_<%= cef.version %>_linux64_release.zip"
5354
},
5455
"node-linux32": {
55-
"dest" : "downloads/",
56+
"dest" : "<%= downloads %>",
5657
"src" : "http://nodejs.org/dist/v<%= node.version %>/node-v<%= node.version %>-linux-x86.tar.gz"
5758
},
5859
"node-linux64": {
59-
"dest" : "downloads/",
60+
"dest" : "<%= downloads %>",
6061
"src" : "http://nodejs.org/dist/v<%= node.version %>/node-v<%= node.version %>-linux-x64.tar.gz"
6162
},
6263
/* mac */
6364
"cef-mac": {
64-
"dest" : "downloads/",
65+
"dest" : "<%= downloads %>",
6566
"src" : "http://dev.brackets.io/cef/cef_binary_<%= cef.version %>_macosx.zip"
6667
},
6768
"node-mac": {
68-
"dest" : "downloads/",
69+
"dest" : "<%= downloads %>",
6970
"src" : "http://nodejs.org/dist/v<%= node.version %>/node-v<%= node.version %>-darwin-x86.tar.gz"
7071
},
7172
/* win */
7273
"cef-win": {
73-
"dest" : "downloads/",
74+
"dest" : "<%= downloads %>",
7475
"src" : "http://dev.brackets.io/cef/cef_binary_<%= cef.version %>_windows.zip"
7576
},
7677
"node-win": {
77-
"dest" : "downloads/",
78+
"dest" : "<%= downloads %>",
7879
"src" : ["http://nodejs.org/dist/v<%= node.version %>/node.exe",
7980
"http://nodejs.org/dist/npm/npm-<%= npm.version %>.zip"]
8081
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,6 @@
2626
"scripts": {
2727
"preinstall": "bash -c 'mv appshell.gyp .appshell.gyp'",
2828
"install": "",
29-
"postinstall": "bash -c 'mv .appshell.gyp appshell.gyp; grunt'"
29+
"postinstall": "bash -c 'mv .appshell.gyp appshell.gyp;'"
3030
}
3131
}

tasks/setup.js

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ module.exports = function (grunt) {
2828
var common = require("./common")(grunt),
2929
fs = require("fs"),
3030
child_process = require("child_process"),
31+
path = require("path"),
3132
q = require("q"),
3233
/* win only (lib), mac only (Resources, tools) */
3334
CEF_MAPPING = {
@@ -70,8 +71,8 @@ module.exports = function (grunt) {
7071
grunt.registerTask("cef", "Download and setup CEF", function () {
7172
var config = "cef-" + platform + common.arch(),
7273
zipSrc = grunt.config("curl-dir." + config + ".src"),
73-
zipName = zipSrc.substr(zipSrc.lastIndexOf("/") + 1),
74-
zipDest = grunt.config("curl-dir." + config + ".dest") + zipName,
74+
zipName = path.basename(zipSrc),
75+
zipDest = path.resolve(process.cwd(), path.join(grunt.config("curl-dir." + config + ".dest"), zipName)),
7576
txtName;
7677

7778
// extract zip file name and set config property
@@ -140,22 +141,29 @@ module.exports = function (grunt) {
140141
unzipPromise = unzip(zipDest, "deps");
141142

142143
// remove .zip ext
143-
zipName = zipName.substr(0, zipName.lastIndexOf("."));
144+
zipName = path.basename(zipName, ".zip");
144145

145146
unzipPromise.then(function () {
146147
// rename version stamped name to cef
147148
return rename("deps/" + zipName, "deps/cef");
148149
}).then(function () {
150+
var memo = path.resolve(process.cwd(), "deps/cef/" + zipName + ".txt"),
151+
permissionsPromise,
152+
defer = q.defer();
153+
149154
if (platform === "mac") {
150155
// FIXME figure out how to use fs.chmod to only do additive mode u+x
151-
return exec("chmod u+x deps/cef/tools/*");
156+
permissionsPromise = exec("chmod u+x deps/cef/tools/*");
157+
} else {
158+
permissionsPromise = q.resolve();
152159
}
153160

154-
// write empty file with zip file
155-
grunt.file.write("deps/cef/" + zipName + ".txt", "");
156-
157-
// return a resolved promise
158-
return q.resolve();
161+
return permissionsPromise.then(function () {
162+
// write empty file with zip file
163+
grunt.file.write(memo, "");
164+
165+
return q.resolve();
166+
});
159167
}).then(function () {
160168
done();
161169
}, function (err) {
@@ -208,7 +216,7 @@ module.exports = function (grunt) {
208216
// curl-dir:node-win32 defines multiple downloads, account for this array
209217
nodeSrc.forEach(function (value, index) {
210218
nodeSrc[index] = value.substr(value.lastIndexOf("/") + 1);
211-
nodeDest[index] = dest + nodeSrc[index];
219+
nodeDest[index] = path.join(dest, nodeSrc[index]);
212220

213221
missingDest = missingDest || !grunt.file.exists(nodeDest[index]);
214222
});

0 commit comments

Comments
 (0)