Update VS Code to 1.37.0
This commit is contained in:
58
scripts/build-json.js
Normal file
58
scripts/build-json.js
Normal file
@ -0,0 +1,58 @@
|
||||
// This builds the package and product JSON files for the final build.
|
||||
const crypto = require("crypto");
|
||||
const fs = require("fs");
|
||||
const path = require("path");
|
||||
const rootPath = path.resolve(__dirname, "..");
|
||||
const sourcePath = process.argv[2];
|
||||
const buildPath = process.argv[3];
|
||||
const vscodeVersion = process.argv[4];
|
||||
const codeServerVersion = process.argv[5];
|
||||
const util = require(path.join(sourcePath, "build/lib/util"));
|
||||
|
||||
function computeChecksum(filename) {
|
||||
return crypto.createHash("md5").update(fs.readFileSync(filename))
|
||||
.digest("base64").replace(/=+$/, "");
|
||||
}
|
||||
|
||||
const computeChecksums = (filenames) => {
|
||||
const result = {};
|
||||
filenames.forEach(function (filename) {
|
||||
result[filename] = computeChecksum(path.join(buildPath, "out", filename));
|
||||
});
|
||||
return result;
|
||||
};
|
||||
|
||||
const mergeAndWrite = (name, json = {}) => {
|
||||
const aJson = JSON.parse(fs.readFileSync(path.join(sourcePath, `${name}.json`)));
|
||||
const bJson = JSON.parse(fs.readFileSync(path.join(rootPath, "scripts", `${name}.json`)));
|
||||
|
||||
delete aJson.scripts;
|
||||
delete aJson.dependencies;
|
||||
delete aJson.devDependencies;
|
||||
delete aJson.optionalDependencies;
|
||||
|
||||
fs.writeFileSync(path.join(buildPath, `${name}.json`), JSON.stringify({
|
||||
...aJson,
|
||||
...bJson,
|
||||
...json,
|
||||
}, null, 2));
|
||||
};
|
||||
|
||||
|
||||
const writeProduct = () => {
|
||||
const checksums = computeChecksums([
|
||||
"vs/workbench/workbench.web.api.js",
|
||||
"vs/workbench/workbench.web.api.css",
|
||||
"vs/code/browser/workbench/workbench.html",
|
||||
"vs/code/browser/workbench/workbench.js",
|
||||
"vs/server/src/cli.js",
|
||||
"vs/server/src/uriTransformer.js",
|
||||
"vs/server/src/login/index.html"
|
||||
]);
|
||||
const date = new Date().toISOString();
|
||||
const commit = util.getVersion(rootPath);
|
||||
mergeAndWrite("product", { commit, date, checksums });
|
||||
mergeAndWrite("package", { codeServerVersion: `${codeServerVersion}-vsc${vscodeVersion}` });
|
||||
};
|
||||
|
||||
writeProduct();
|
@ -1,23 +0,0 @@
|
||||
// This is used to merge JSON files (package.json and product.json) and delete a
|
||||
// few entries we don't want. It's extremely simple, expects very specific
|
||||
// input, and doesn't have any error handling.
|
||||
const fs = require("fs");
|
||||
|
||||
const a = process.argv[2];
|
||||
const b = process.argv[3];
|
||||
const out = process.argv[4];
|
||||
const json = JSON.parse(process.argv[5] || "{}");
|
||||
|
||||
const aJson = JSON.parse(fs.readFileSync(a));
|
||||
const bJson = JSON.parse(fs.readFileSync(b));
|
||||
|
||||
delete aJson.scripts;
|
||||
delete aJson.dependencies;
|
||||
delete aJson.devDependencies;
|
||||
delete aJson.optionalDependencies;
|
||||
|
||||
fs.writeFileSync(out, JSON.stringify({
|
||||
...aJson,
|
||||
...bJson,
|
||||
...json,
|
||||
}, null, 2));
|
@ -56,9 +56,9 @@ function prepend-loader() {
|
||||
# Copy code-server into VS Code then build it.
|
||||
function build-code-server() {
|
||||
copy-server
|
||||
yarn gulp compile-build --max-old-space-size=32384
|
||||
|
||||
local min=""
|
||||
export BUILD_SOURCEVERSION
|
||||
BUILD_SOURCEVERSION=$(node -p "require('${sourcePath}/build/lib/git.js').getVersion('${rootPath}')")
|
||||
if [[ -n "${minify}" ]] ; then
|
||||
min="-min"
|
||||
yarn gulp minify-vscode --max-old-space-size=32384
|
||||
@ -74,11 +74,9 @@ function build-code-server() {
|
||||
cd "${buildPath}" && yarn --production --force --build-from-source
|
||||
rm "${buildPath}/"{package.json,yarn.lock,.yarnrc}
|
||||
|
||||
local packageJson="{\"codeServerVersion\": \"${codeServerVersion}-vsc${vscodeVersion}\"}"
|
||||
cp -r "${sourcePath}/.build/extensions" "${buildPath}"
|
||||
node "${rootPath}/scripts/merge.js" "${sourcePath}/package.json" "${rootPath}/scripts/package.json" "${buildPath}/package.json" "${packageJson}"
|
||||
node "${rootPath}/scripts/merge.js" "${sourcePath}/.build/product.json" "${rootPath}/scripts/product.json" "${buildPath}/product.json"
|
||||
cp -r "${sourcePath}/out-vscode${min}" "${buildPath}/out"
|
||||
node "${rootPath}/scripts/build-json.js" "${sourcePath}" "${buildPath}" "${vscodeVersion}" "${codeServerVersion}"
|
||||
|
||||
# Only keep production dependencies for the server.
|
||||
cp "${rootPath}/"{package.json,yarn.lock} "${buildPath}/out/vs/server"
|
||||
@ -143,7 +141,7 @@ function build-task() {
|
||||
log "Pre-built VS Code ${vscodeVersion} has no built extensions" "error"
|
||||
exit 1
|
||||
fi
|
||||
yarn gulp extensions-build-package --max-old-space-size=32384
|
||||
yarn gulp compile-extensions-build --max-old-space-size=32384
|
||||
fi
|
||||
build-code-server
|
||||
}
|
||||
|
1655
scripts/vscode.patch
1655
scripts/vscode.patch
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user