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

Commit f83b907

Browse files
saurabh95nethip
authored andcommitted
Now Windows CRT dlls are packaged with Brackets executable (#622)
1 parent 2b741e4 commit f83b907

File tree

3 files changed

+206
-6
lines changed

3 files changed

+206
-6
lines changed

Gruntfile.js

Lines changed: 54 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,10 @@ module.exports = function (grunt) {
104104
"icu-win": {
105105
"dest" : "<%= downloads %>",
106106
"src" : "<%= icu.url %>/icu_<%= icu.version %>_windows32.zip"
107+
},
108+
"vs-crt-win": {
109+
"dest" : "<%= downloads %>",
110+
"src" : "<%= vsCrt.url %>/vs<%= vsCrt.version %>-crt-ia32.zip"
107111
}
108112
},
109113
"clean": {
@@ -136,6 +140,50 @@ module.exports = function (grunt) {
136140
"icuuc58.dll",
137141
"icuin58.dll",
138142
"icudt58.dll",
143+
"api-ms-win-core-console-l1-1-0.dll",
144+
"api-ms-win-core-handle-l1-1-0.dll",
145+
"api-ms-win-core-processenvironment-l1-1-0.dll",
146+
"api-ms-win-core-synch-l1-2-0.dll",
147+
"api-ms-win-crt-filesystem-l1-1-0.dll",
148+
"api-ms-win-crt-runtime-l1-1-0.dll",
149+
"vccorlib140.dll",
150+
"api-ms-win-core-datetime-l1-1-0.dll",
151+
"api-ms-win-core-heap-l1-1-0.dll",
152+
"api-ms-win-core-processthreads-l1-1-0.dll",
153+
"api-ms-win-core-sysinfo-l1-1-0.dll",
154+
"api-ms-win-crt-heap-l1-1-0.dll",
155+
"api-ms-win-crt-stdio-l1-1-0.dll",
156+
"vcruntime140.dll",
157+
"api-ms-win-core-debug-l1-1-0.dll",
158+
"api-ms-win-core-interlocked-l1-1-0.dll",
159+
"api-ms-win-core-processthreads-l1-1-1.dll",
160+
"api-ms-win-core-timezone-l1-1-0.dll",
161+
"api-ms-win-crt-locale-l1-1-0.dll",
162+
"api-ms-win-crt-string-l1-1-0.dll",
163+
"api-ms-win-core-errorhandling-l1-1-0.dll",
164+
"api-ms-win-core-libraryloader-l1-1-0.dll",
165+
"api-ms-win-core-profile-l1-1-0.dll",
166+
"api-ms-win-core-util-l1-1-0.dll",
167+
"api-ms-win-crt-math-l1-1-0.dll",
168+
"api-ms-win-crt-time-l1-1-0.dll",
169+
"api-ms-win-core-file-l1-1-0.dll",
170+
"api-ms-win-core-localization-l1-2-0.dll",
171+
"api-ms-win-core-rtlsupport-l1-1-0.dll",
172+
"api-ms-win-crt-conio-l1-1-0.dll",
173+
"api-ms-win-crt-multibyte-l1-1-0.dll",
174+
"api-ms-win-crt-utility-l1-1-0.dll",
175+
"api-ms-win-core-file-l1-2-0.dll",
176+
"api-ms-win-core-memory-l1-1-0.dll",
177+
"api-ms-win-core-string-l1-1-0.dll",
178+
"api-ms-win-crt-convert-l1-1-0.dll",
179+
"api-ms-win-crt-private-l1-1-0.dll",
180+
"msvcp140.dll",
181+
"api-ms-win-core-file-l2-1-0.dll",
182+
"api-ms-win-core-namedpipe-l1-1-0.dll",
183+
"api-ms-win-core-synch-l1-1-0.dll",
184+
"api-ms-win-crt-environment-l1-1-0.dll",
185+
"api-ms-win-crt-process-l1-1-0.dll",
186+
"ucrtbase.dll",
139187
"natives_blob.bin",
140188
"snapshot_blob.bin",
141189
"command/**"
@@ -271,7 +319,11 @@ module.exports = function (grunt) {
271319
"icu": {
272320
"url" : "http://s3.amazonaws.com/files.brackets.io/icu",
273321
"version" : "58"
274-
}
322+
},
323+
"vsCrt": {
324+
"url" : "http://s3.amazonaws.com/files.brackets.io/vs-crt",
325+
"version" : "2015"
326+
},
275327
});
276328

277329
grunt.loadTasks("tasks");
@@ -281,4 +333,4 @@ module.exports = function (grunt) {
281333
grunt.loadNpmTasks("grunt-curl");
282334

283335
grunt.registerTask("default", ["setup", "build"]);
284-
};
336+
};

appshell.gyp

Lines changed: 52 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,57 @@
177177
# Copy ICU dlls
178178
'destination': '<(PRODUCT_DIR)',
179179
'files': ['deps/icu/bin/icuuc58.dll', 'deps/icu/bin/icuin58.dll', 'deps/icu/bin/icudt58.dll'],
180-
}
180+
},
181+
{
182+
# Copy VS2015 CRT dlls
183+
'destination': '<(PRODUCT_DIR)',
184+
'files': [
185+
'deps/vs-crt/api-ms-win-core-console-l1-1-0.dll',
186+
'deps/vs-crt/api-ms-win-core-handle-l1-1-0.dll',
187+
'deps/vs-crt/api-ms-win-core-processenvironment-l1-1-0.dll',
188+
'deps/vs-crt/api-ms-win-core-synch-l1-2-0.dll',
189+
'deps/vs-crt/api-ms-win-crt-filesystem-l1-1-0.dll',
190+
'deps/vs-crt/api-ms-win-crt-runtime-l1-1-0.dll',
191+
'deps/vs-crt/vccorlib140.dll',
192+
'deps/vs-crt/api-ms-win-core-datetime-l1-1-0.dll',
193+
'deps/vs-crt/api-ms-win-core-heap-l1-1-0.dll',
194+
'deps/vs-crt/api-ms-win-core-processthreads-l1-1-0.dll',
195+
'deps/vs-crt/api-ms-win-core-sysinfo-l1-1-0.dll',
196+
'deps/vs-crt/api-ms-win-crt-heap-l1-1-0.dll',
197+
'deps/vs-crt/api-ms-win-crt-stdio-l1-1-0.dll',
198+
'deps/vs-crt/vcruntime140.dll',
199+
'deps/vs-crt/api-ms-win-core-debug-l1-1-0.dll',
200+
'deps/vs-crt/api-ms-win-core-interlocked-l1-1-0.dll',
201+
'deps/vs-crt/api-ms-win-core-processthreads-l1-1-1.dll',
202+
'deps/vs-crt/api-ms-win-core-timezone-l1-1-0.dll',
203+
'deps/vs-crt/api-ms-win-crt-locale-l1-1-0.dll',
204+
'deps/vs-crt/api-ms-win-crt-string-l1-1-0.dll',
205+
'deps/vs-crt/api-ms-win-core-errorhandling-l1-1-0.dll',
206+
'deps/vs-crt/api-ms-win-core-libraryloader-l1-1-0.dll',
207+
'deps/vs-crt/api-ms-win-core-profile-l1-1-0.dll',
208+
'deps/vs-crt/api-ms-win-core-util-l1-1-0.dll',
209+
'deps/vs-crt/api-ms-win-crt-math-l1-1-0.dll',
210+
'deps/vs-crt/api-ms-win-crt-time-l1-1-0.dll',
211+
'deps/vs-crt/api-ms-win-core-file-l1-1-0.dll',
212+
'deps/vs-crt/api-ms-win-core-localization-l1-2-0.dll',
213+
'deps/vs-crt/api-ms-win-core-rtlsupport-l1-1-0.dll',
214+
'deps/vs-crt/api-ms-win-crt-conio-l1-1-0.dll',
215+
'deps/vs-crt/api-ms-win-crt-multibyte-l1-1-0.dll',
216+
'deps/vs-crt/api-ms-win-crt-utility-l1-1-0.dll',
217+
'deps/vs-crt/api-ms-win-core-file-l1-2-0.dll',
218+
'deps/vs-crt/api-ms-win-core-memory-l1-1-0.dll',
219+
'deps/vs-crt/api-ms-win-core-string-l1-1-0.dll',
220+
'deps/vs-crt/api-ms-win-crt-convert-l1-1-0.dll',
221+
'deps/vs-crt/api-ms-win-crt-private-l1-1-0.dll',
222+
'deps/vs-crt/msvcp140.dll',
223+
'deps/vs-crt/api-ms-win-core-file-l2-1-0.dll',
224+
'deps/vs-crt/api-ms-win-core-namedpipe-l1-1-0.dll',
225+
'deps/vs-crt/api-ms-win-core-synch-l1-1-0.dll',
226+
'deps/vs-crt/api-ms-win-crt-environment-l1-1-0.dll',
227+
'deps/vs-crt/api-ms-win-crt-process-l1-1-0.dll',
228+
'deps/vs-crt/ucrtbase.dll',
229+
],
230+
},
181231
],
182232
}],
183233
[ 'OS=="win" and multi_threaded_dll', {
@@ -578,4 +628,4 @@
578628
},
579629
}],
580630
],
581-
}
631+
}

tasks/setup.js

Lines changed: 100 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,61 @@ module.exports = function (grunt) {
178178
grunt.task.run("curl-dir:" + grunt.config("icuConfig"));
179179
});
180180

181+
// task: vs-crt
182+
grunt.registerTask("vs-crt", "Download and setup VS CRT dlls", function () {
183+
if (platform === "win") {
184+
var config = "vs-crt-" + platform + common.arch(),
185+
zipSrc = grunt.config("curl-dir." + config + ".src"),
186+
zipName = path.basename(zipSrc),
187+
zipDest = path.resolve(process.cwd(), path.join(grunt.config("curl-dir." + config + ".dest"), zipName)),
188+
txtName;
189+
190+
// extract zip file name and set config property
191+
grunt.config("vsCRTZipDest", zipDest);
192+
grunt.config("vsCRTZipSrc", zipSrc);
193+
grunt.config("vsCRTZipName", zipName);
194+
grunt.config("vsCRTConfig", config);
195+
196+
// remove .zip extension
197+
txtName = zipName.substr(0, zipName.lastIndexOf(".")) + ".txt";
198+
199+
// optionally download if vs-crt is not found
200+
if (!grunt.file.exists("deps/vs-crt/" + txtName)) {
201+
var vsCRTTasks = ["vs-crt-clean", "vs-crt-extract"];
202+
203+
if (grunt.file.exists(zipDest)) {
204+
grunt.verbose.writeln("Found VS CRT download " + zipDest);
205+
} else {
206+
vsCRTTasks.unshift("vs-crt-download");
207+
}
208+
209+
grunt.task.run(vsCRTTasks);
210+
} else {
211+
grunt.verbose.writeln("Skipping vs-crt download. Found deps/vs-crt/" + txtName);
212+
}
213+
}
214+
});
215+
216+
// task: vs-crt-clean
217+
grunt.registerTask("vs-crt-clean", "Removes CEF binaries and linked folders", function () {
218+
// delete dev symlinks from "setup_for_hacking"
219+
common.deleteFile("Release/dev", { force: true });
220+
common.deleteFile("Debug/dev", { force: true });
221+
222+
// finally delete vs-crt binary\
223+
common.deleteFile("deps/vs-crt", { force: true });
224+
});
225+
226+
// task: vs-crt-download
227+
grunt.registerTask("vs-crt-download", "Download vs crt, see curl-dir config in Gruntfile.js", function () {
228+
// requires download-vs-crt to set "vsCRTZipName" in config
229+
grunt.task.requires(["vs-crt"]);
230+
231+
// run curl
232+
grunt.log.writeln("Downloading " + grunt.config("vsCRTZipSrc") + ". This may take a while...");
233+
grunt.task.run("curl-dir:" + grunt.config("vsCRTConfig"));
234+
});
235+
181236
function cefFileLocation() {
182237
return path.resolve(process.cwd(), "deps/cef");
183238
}
@@ -390,6 +445,45 @@ module.exports = function (grunt) {
390445
});
391446
});
392447

448+
// task: vs-crt-extract
449+
grunt.registerTask("vs-crt-extract", "Extract vs-crt zip", function () {
450+
// requires vs-crt to set "vsCRTZipName" in config
451+
grunt.task.requires(["vs-crt"]);
452+
453+
var done = this.async(),
454+
zipDest = grunt.config("vsCRTZipDest"),
455+
zipName = grunt.config("vsCRTZipName"),
456+
unzipPromise;
457+
458+
// unzip to deps/
459+
unzipPromise = unzip(zipDest, "deps");
460+
461+
// remove .zip ext
462+
zipName = path.basename(zipName, ".zip");
463+
464+
unzipPromise.then(function () {
465+
// rename version stamped name to cef
466+
return rename("deps/" + zipName, "deps/vs-crt");
467+
}).then(function () {
468+
var memo = path.resolve(process.cwd(), "deps/vs-crt/" + zipName + ".txt"),
469+
permissionsPromise;
470+
471+
permissionsPromise = q.resolve();
472+
473+
return permissionsPromise.then(function () {
474+
// write empty file with zip file
475+
grunt.file.write(memo, "");
476+
477+
return q.resolve();
478+
});
479+
}).then(function () {
480+
done();
481+
}, function (err) {
482+
grunt.log.writeln(err);
483+
done(false);
484+
});
485+
});
486+
393487
// task: cef-symlinks
394488
grunt.registerTask("cef-symlinks", "Create symlinks for CEF", function () {
395489
var done = this.async(),
@@ -589,5 +683,9 @@ module.exports = function (grunt) {
589683
});
590684

591685
// task: setup
592-
grunt.registerTask("setup", ["cef", "node", "node-check", "icu", "create-project"]);
593-
};
686+
if (platform === "win") {
687+
grunt.registerTask("setup", ["cef", "node", "node-check", "icu", "vs-crt", "create-project"]);
688+
} else {
689+
grunt.registerTask("setup", ["cef", "node", "node-check", "icu", "create-project"]);
690+
}
691+
};

0 commit comments

Comments
 (0)