未验证 提交 5baf1662 编写于 作者: A Asher

Fix VS Code product configuration not loading

上级 25641900
...@@ -172,21 +172,9 @@ class Builder { ...@@ -172,21 +172,9 @@ class Builder {
]) ])
}) })
await this.copyDependencies("code-server", this.rootPath, this.buildPath) await this.copyDependencies("code-server", this.rootPath, this.buildPath, {
await this.task("writing final code-server package.json", async () => {
const json = JSON.parse(await fs.readFile(path.join(this.buildPath, "package.json"), "utf8"))
return fs.writeFile(
path.join(this.buildPath, "package.json"),
JSON.stringify(
{
...json,
commit, commit,
}, version: process.env.VERSION,
null,
2
)
)
}) })
} }
...@@ -214,34 +202,6 @@ class Builder { ...@@ -214,34 +202,6 @@ class Builder {
}) })
} }
const { productJson, packageJson } = await this.task("generating vs code product configuration", async () => {
const merge = async (name: string, json: { [key: string]: string } = {}): Promise<{ [key: string]: string }> => {
return {
...JSON.parse(await fs.readFile(path.join(this.vscodeSourcePath, `${name}.json`), "utf8")),
...json,
}
}
const date = new Date().toISOString()
const [packageJson, productJson] = await Promise.all([merge("package", {}), merge("product", { commit, date })])
return { productJson, packageJson }
})
await this.task("inserting vs code product configuration", async () => {
const filePath = path.join(this.vscodeSourcePath, "out-build/vs/platform/product/common/product.js")
return fs.writeFile(
filePath,
(await fs.readFile(filePath, "utf8")).replace(
"{ /*BUILD->INSERT_PRODUCT_CONFIGURATION*/}",
JSON.stringify({
version: packageJson.version,
...productJson,
})
)
)
})
const vscodeBuildPath = path.join(this.buildPath, "lib/vscode") const vscodeBuildPath = path.join(this.buildPath, "lib/vscode")
await this.task("copying vs code into build directory", async () => { await this.task("copying vs code into build directory", async () => {
await fs.mkdirp(vscodeBuildPath) await fs.mkdirp(vscodeBuildPath)
...@@ -254,14 +214,13 @@ class Builder { ...@@ -254,14 +214,13 @@ class Builder {
]) ])
}) })
await this.copyDependencies("vs code", this.vscodeSourcePath, vscodeBuildPath) await this.copyDependencies("vs code", this.vscodeSourcePath, vscodeBuildPath, {
commit,
await this.task("writing final vs code product.json", () => { date: new Date().toISOString(),
return fs.writeFile(path.join(vscodeBuildPath, "product.json"), JSON.stringify(productJson, null, 2))
}) })
} }
private async copyDependencies(name: string, sourcePath: string, buildPath: string): Promise<void> { private async copyDependencies(name: string, sourcePath: string, buildPath: string, merge: object): Promise<void> {
await this.task(`copying ${name} dependencies`, async () => { await this.task(`copying ${name} dependencies`, async () => {
return Promise.all( return Promise.all(
["node_modules", "package.json", "yarn.lock"].map((fileName) => { ["node_modules", "package.json", "yarn.lock"].map((fileName) => {
...@@ -270,6 +229,22 @@ class Builder { ...@@ -270,6 +229,22 @@ class Builder {
) )
}) })
const fileName = name === "code-server" ? "package" : "product"
await this.task(`writing final ${name} ${fileName}.json`, async () => {
const json = JSON.parse(await fs.readFile(path.join(sourcePath, `${fileName}.json`), "utf8"))
return fs.writeFile(
path.join(buildPath, `${fileName}.json`),
JSON.stringify(
{
...json,
...merge,
},
null,
2
)
)
})
if (process.env.MINIFY) { if (process.env.MINIFY) {
await this.task(`restricting ${name} to production dependencies`, async () => { await this.task(`restricting ${name} to production dependencies`, async () => {
return util.promisify(cp.exec)("yarn --production --ignore-scripts", { cwd: buildPath }) return util.promisify(cp.exec)("yarn --production --ignore-scripts", { cwd: buildPath })
......
...@@ -2108,10 +2108,10 @@ index 0000000000..3c74512192 ...@@ -2108,10 +2108,10 @@ index 0000000000..3c74512192
+} +}
diff --git a/src/vs/server/node/server.ts b/src/vs/server/node/server.ts diff --git a/src/vs/server/node/server.ts b/src/vs/server/node/server.ts
new file mode 100644 new file mode 100644
index 0000000000..81d275a80a index 0000000000..ac6bbc8e98
--- /dev/null --- /dev/null
+++ b/src/vs/server/node/server.ts +++ b/src/vs/server/node/server.ts
@@ -0,0 +1,253 @@ @@ -0,0 +1,252 @@
+import * as net from 'net'; +import * as net from 'net';
+import * as path from 'path'; +import * as path from 'path';
+import { Emitter } from 'vs/base/common/event'; +import { Emitter } from 'vs/base/common/event';
...@@ -2161,6 +2161,7 @@ index 0000000000..81d275a80a ...@@ -2161,6 +2161,7 @@ index 0000000000..81d275a80a
+import { ExtensionEnvironmentChannel, FileProviderChannel, NodeProxyService } from 'vs/server/node/channel'; +import { ExtensionEnvironmentChannel, FileProviderChannel, NodeProxyService } from 'vs/server/node/channel';
+import { Connection, ExtensionHostConnection, ManagementConnection } from 'vs/server/node/connection'; +import { Connection, ExtensionHostConnection, ManagementConnection } from 'vs/server/node/connection';
+import { TelemetryClient } from 'vs/server/node/insights'; +import { TelemetryClient } from 'vs/server/node/insights';
+import { logger } from 'vs/server/node/logger';
+import { getLocaleFromConfig, getNlsConfiguration } from 'vs/server/node/nls'; +import { getLocaleFromConfig, getNlsConfiguration } from 'vs/server/node/nls';
+import { Protocol } from 'vs/server/node/protocol'; +import { Protocol } from 'vs/server/node/protocol';
+import { getUriTransformer } from 'vs/server/node/util'; +import { getUriTransformer } from 'vs/server/node/util';
...@@ -2193,11 +2194,9 @@ index 0000000000..81d275a80a ...@@ -2193,11 +2194,9 @@ index 0000000000..81d275a80a
+ logLevel: getLogLevel(environment), + logLevel: getLogLevel(environment),
+ }, + },
+ remoteUserDataUri: transformer.transformOutgoing(URI.file(environment.userDataPath)), + remoteUserDataUri: transformer.transformOutgoing(URI.file(environment.userDataPath)),
+ productConfiguration: { + productConfiguration: product,
+ extensionsGallery: product.extensionsGallery,
+ },
+ nlsConfiguration: await getNlsConfiguration(environment.args.locale || await getLocaleFromConfig(environment.userDataPath), environment.userDataPath), + nlsConfiguration: await getNlsConfiguration(environment.args.locale || await getLocaleFromConfig(environment.userDataPath), environment.userDataPath),
+ commit: product.commit || '', + commit: product.commit || 'development',
+ }; + };
+ } + }
+ +
...@@ -2222,7 +2221,7 @@ index 0000000000..81d275a80a ...@@ -2222,7 +2221,7 @@ index 0000000000..81d275a80a
+ +
+ private async connect(message: ConnectionTypeRequest, protocol: Protocol): Promise<void> { + private async connect(message: ConnectionTypeRequest, protocol: Protocol): Promise<void> {
+ if (product.commit && message.commit !== product.commit) { + if (product.commit && message.commit !== product.commit) {
+ throw new Error(`Version mismatch (${message.commit} instead of ${product.commit})`); + logger.warn(`Version mismatch (${message.commit} instead of ${product.commit})`);
+ } + }
+ +
+ switch (message.desiredConnectionType) { + switch (message.desiredConnectionType) {
......
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
<!-- Workbench Icon/Manifest/CSS --> <!-- Workbench Icon/Manifest/CSS -->
<link rel="icon" href="../static-{{COMMIT}}/src/browser/media/favicon.ico" type="image/x-icon" /> <link rel="icon" href="../static-{{COMMIT}}/src/browser/media/favicon.ico" type="image/x-icon" />
<link rel="manifest" href="../static-{{COMMIT}}/src/browser/media/manifest.json" crossorigin="use-credentials"> <link rel="manifest" href="../static-{{COMMIT}}/src/browser/media/manifest.json" crossorigin="use-credentials">
<link data-name="vs/workbench/workbench.web.api" rel="stylesheet" href="../static-{{COMMIT}}/out/vs/workbench/workbench.web.api.css"> <link data-name="vs/workbench/workbench.web.api" rel="stylesheet" href="./static-{{COMMIT}}/out/vs/workbench/workbench.web.api.css">
<link rel="apple-touch-icon" href="../static-{{COMMIT}}/src/browser/media/code-server.png" /> <link rel="apple-touch-icon" href="../static-{{COMMIT}}/src/browser/media/code-server.png" />
<meta name="apple-mobile-web-app-capable" content="yes"> <meta name="apple-mobile-web-app-capable" content="yes">
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册