Archived
1
0

Add windows support (#41)

* Add windows support

* Improve multi-platform support

* Install with network-concurrency 1

* Use file-glob to upload windows binary

* Don't install packages in parallel if on windows

* Rename vscode-remote to code-server

* Add output at intervals so CI doesn't kill build

* Update all tasks to provide timed output

* Don't perform tasks sync otherwise we can't log
This commit is contained in:
Kyle Carberry
2019-02-28 14:04:19 -06:00
committed by GitHub
parent 1e30831c91
commit e8174095ca
27 changed files with 769 additions and 72 deletions

View File

@ -1,4 +1,5 @@
#!/bin/bash
set -e
npm install -g cross-env
yarn task build:server:binary

View File

@ -7,45 +7,48 @@ import { logger, field } from "../packages/logger";
/**
* Install dependencies for a single package.
*/
const doInstall = (pkg: string, path: string): void => {
const doInstall = (pkg: string, path: string): Promise<void> => {
logger.info(`Installing "${pkg}" dependencies...`);
exec("yarn", {
cwd: path,
maxBuffer: 1024 * 1024 * 10,
}, (error, stdout, stderr) => {
if (error) {
logger.error(
`Failed to install "${pkg}" dependencies`,
field("error", error),
field("stdout", stdout),
field("stderr", stderr),
);
process.exit(1);
}
logger.info(`Successfully grabbed \"${pkg}\" dependencies!`);
return new Promise((resolve): void => {
exec("yarn --network-concurrency 1", {
cwd: path,
maxBuffer: 1024 * 1024 * 10,
}, (error, stdout, stderr) => {
if (error) {
logger.error(
`Failed to install "${pkg}" dependencies`,
field("error", error),
field("stdout", stdout),
field("stderr", stderr),
);
process.exit(1);
}
logger.info(`Successfully grabbed \"${pkg}\" dependencies!`);
resolve();
});
});
};
/**
* Install dependencies for all packages.
*/
const handlePackages = (dir: string): void => {
readdirSync(dir).forEach((pkg) => {
const handlePackages = async (dir: string): Promise<void> => {
const dirs = readdirSync(dir);
for (let i = 0; i < dirs.length; i++) {
const pkg = dirs[i];
const pkgDir = join(dir, pkg);
const pkgJsonPath = join(pkgDir, "package.json");
if (existsSync(pkgJsonPath)) {
doInstall(pkg, pkgDir);
const ip = doInstall(pkg, pkgDir);
if (os.platform() === "win32") {
await ip;
}
}
});
}
};
if (os.platform() === "win32") {
execSync("yarn", {
cwd: resolve(__dirname, "..", "packages", "vscode"),
maxBuffer: 1024 * 1024 * 10,
});
}
handlePackages(resolve(__dirname, "..", "packages"));
handlePackages(resolve(__dirname, "..", "packages", "app"));
handlePackages(resolve(__dirname, "..", "packages")).then(() => {
return handlePackages(resolve(__dirname, "..", "packages", "app"));
});

View File

@ -282,7 +282,7 @@ index 605c1209e1..e8131513de 100644
- platform.isMacintosh
+ browser.isMacintosh
diff --git a/src/vs/loader.js b/src/vs/loader.js
index 4eddcab3a0..5d80768406 100644
index 4eddcab3a0..abda3c04f9 100644
--- a/src/vs/loader.js
+++ b/src/vs/loader.js
@@ -671,4 +671,4 @@ var AMDLoader;
@ -294,15 +294,20 @@ index 4eddcab3a0..5d80768406 100644
+ this._vm = require('vm');
+ this._path = require('path');
+ this._crypto = require('crypto');
@@ -736,0 +737,7 @@ var AMDLoader;
@@ -736,0 +737,12 @@ var AMDLoader;
+ const context = require.context("../", true, /.*/);
+ if (scriptSrc.indexOf("file:///") !== -1) {
+ const vsSrc = scriptSrc.split("file:///")[1].split(".js")[0];
+ if (vsSrc && vsSrc.startsWith("vs/")) {
+ if (this._env.isWindows) {
+ const vsSrcSplit = vsSrc.split(":/");
+ vsSrcSplit.shift();
+ vsSrc = vsSrcSplit.join(":/");
+ }
+ if (vsSrc && vsSrc.startsWith("vs/")) {
+ scriptSrc = `node|./${vsSrc}`;
+ }
+ }
@@ -741 +748 @@ var AMDLoader;
@@ -741 +753 @@ var AMDLoader;
- moduleExports_1 = nodeRequire(pieces[1]);
+ moduleExports_1 = context(pieces[1]);
diff --git a/src/vs/platform/clipboard/electron-browser/clipboardService.ts b/src/vs/platform/clipboard/electron-browser/clipboardService.ts

View File

@ -45,7 +45,7 @@ module.exports = (options = {}) => ({
type: "javascript/auto",
}, {
// Fixes spdlog.
test: /spdlog\/index\.js/,
test: /spdlog(\\|\/)index\.js/,
loader: "string-replace-loader",
options: {
multiple: [{
@ -56,7 +56,7 @@ module.exports = (options = {}) => ({
},
}, {
// This is required otherwise it attempts to require("package.json")
test: /@oclif\/command\/lib\/index\.js/,
test: /@oclif(\\|\/)command(\\|\/)lib(\\|\/)index\.js/,
loader: "string-replace-loader",
options: {
multiple: [{
@ -66,7 +66,7 @@ module.exports = (options = {}) => ({
}],
},
}, {
test: /node\-pty\/lib\/index\.js/,
test: /node\-pty\-prebuilt(\\|\/)lib(\\|\/)index\.js/,
loader: "string-replace-loader",
options: {
multiple: [{
@ -75,6 +75,16 @@ module.exports = (options = {}) => ({
flags: "g",
}],
},
}, {
test: /node\-pty\-prebuilt(\\|\/)lib(\\|\/)windowsPtyAgent\.js/,
loader: "string-replace-loader",
options: {
multiple: [{
search: "var pty = .*;",
replace: "var pty = __non_webpack_require__(global.NODEPTY_LOCATION);",
flags: "g",
}],
},
}],
},
resolve: {