Update to 1.39.2

Also too the opportunity to rewrite the build script since there was a
change in the build steps (mainly how the product JSON is inserted) and
to get the build changes out of the patch. It also no longer relies on
external caching (we'll want to do this within CI instead).
This commit is contained in:
Asher
2019-10-18 18:20:02 -05:00
parent 56ce780522
commit bdd11f741b
25 changed files with 1122 additions and 1320 deletions

View File

@ -5,10 +5,9 @@ import { setUnexpectedErrorHandler } from "vs/base/common/errors";
import { main as vsCli } from "vs/code/node/cliProcessMain";
import { validatePaths } from "vs/code/node/paths";
import { ParsedArgs } from "vs/platform/environment/common/environment";
import { buildHelpMessage, buildVersionMessage, Option as VsOption, options as vsOptions } from "vs/platform/environment/node/argv";
import { buildHelpMessage, buildVersionMessage, Option as VsOption, OPTIONS, OptionDescriptions } from "vs/platform/environment/node/argv";
import { parseMainProcessArgv } from "vs/platform/environment/node/argvHelper";
import pkg from "vs/platform/product/node/package";
import product from "vs/platform/product/node/product";
import product from "vs/platform/product/common/product";
import { ipcMain } from "vs/server/src/node/ipc";
import { enableCustomMarketplace } from "vs/server/src/node/marketplace";
import { MainServer } from "vs/server/src/node/server";
@ -24,7 +23,7 @@ interface Args extends ParsedArgs {
"cert-key"?: string;
format?: string;
host?: string;
open?: string;
open?: boolean;
port?: string;
socket?: string;
}
@ -35,14 +34,9 @@ interface Option extends VsOption {
}
const getArgs = (): Args => {
const options = vsOptions as Option[];
// The last item is _ which is like -- so our options need to come before it.
const last = options.pop()!;
// Remove options that won't work or don't make sense.
let i = options.length;
while (i--) {
switch (options[i].id) {
for (let key in OPTIONS) {
switch (key) {
case "add":
case "diff":
case "file-uri":
@ -57,24 +51,21 @@ const getArgs = (): Args => {
case "prof-startup":
case "inspect-extensions":
case "inspect-brk-extensions":
options.splice(i, 1);
delete OPTIONS[key];
break;
}
}
options.push({ id: "base-path", type: "string", cat: "o", description: "Base path of the URL at which code-server is hosted (used for login redirects)." });
options.push({ id: "cert", type: "string", cat: "o", description: "Path to certificate. If the path is omitted, both this and --cert-key will be generated." });
options.push({ id: "cert-key", type: "string", cat: "o", description: "Path to the certificate's key if one was provided." });
options.push({ id: "extra-builtin-extensions-dir", type: "string", cat: "o", description: "Path to an extra builtin extension directory." });
options.push({ id: "extra-extensions-dir", type: "string", cat: "o", description: "Path to an extra user extension directory." });
options.push({ id: "format", type: "string", cat: "o", description: `Format for the version. ${buildAllowedMessage(FormatType)}.` });
options.push({ id: "host", type: "string", cat: "o", description: "Host for the server." });
options.push({ id: "auth", type: "string", cat: "o", description: `The type of authentication to use. ${buildAllowedMessage(AuthType)}.` });
options.push({ id: "open", type: "boolean", cat: "o", description: "Open in the browser on startup." });
options.push({ id: "port", type: "string", cat: "o", description: "Port for the main server." });
options.push({ id: "socket", type: "string", cat: "o", description: "Listen on a socket instead of host:port." });
options.push(last);
const options = OPTIONS as OptionDescriptions<Required<Args>>;
options["base-path"] = { type: "string", cat: "o", description: "Base path of the URL at which code-server is hosted (used for login redirects)." };
options["cert"] = { type: "string", cat: "o", description: "Path to certificate. If the path is omitted, both this and --cert-key will be generated." };
options["cert-key"] = { type: "string", cat: "o", description: "Path to the certificate's key if one was provided." };
options["format"] = { type: "string", cat: "o", description: `Format for the version. ${buildAllowedMessage(FormatType)}.` };
options["host"] = { type: "string", cat: "o", description: "Host for the server." };
options["auth"] = { type: "string", cat: "o", description: `The type of authentication to use. ${buildAllowedMessage(AuthType)}.` };
options["open"] = { type: "boolean", cat: "o", description: "Open in the browser on startup." };
options["port"] = { type: "string", cat: "o", description: "Port for the main server." };
options["socket"] = { type: "string", cat: "o", description: "Listen on a socket instead of host:port." };
const args = parseMainProcessArgv(process.argv);
if (!args["user-data-dir"]) {
@ -84,6 +75,10 @@ const getArgs = (): Args => {
args["extensions-dir"] = path.join(args["user-data-dir"], "extensions");
}
if (!args.verbose && !args.log && process.env.LOG_LEVEL) {
args.log = process.env.LOG_LEVEL;
}
return validatePaths(args);
};
@ -161,19 +156,19 @@ const startCli = (): boolean | Promise<void> => {
const args = getArgs();
if (args.help) {
const executable = `${product.applicationName}${os.platform() === "win32" ? ".exe" : ""}`;
console.log(buildHelpMessage(product.nameLong, executable, pkg.codeServerVersion, undefined, false));
console.log(buildHelpMessage(product.nameLong, executable, product.codeServerVersion, OPTIONS, false));
return true;
}
if (args.version) {
if (args.format === "json") {
console.log(JSON.stringify({
codeServerVersion: pkg.codeServerVersion,
codeServerVersion: product.codeServerVersion,
commit: product.commit,
vscodeVersion: pkg.version,
vscodeVersion: product.version,
}));
} else {
buildVersionMessage(pkg.codeServerVersion, product.commit).split("\n").map((line) => logger.info(line));
buildVersionMessage(product.codeServerVersion, product.commit).split("\n").map((line) => logger.info(line));
}
return true;
}