Today's Insiders update failed (Windows) (#220999) (#221132)

This commit is contained in:
Benjamin Pasero 2024-07-08 16:42:25 +02:00 committed by GitHub
parent 125c83df26
commit b7c13a78e9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 25 additions and 19 deletions

View File

@ -8,7 +8,13 @@ exports.inlineMeta = inlineMeta;
const es = require("event-stream");
const path_1 = require("path");
const packageJsonMarkerId = 'BUILD_INSERT_PACKAGE_CONFIGURATION';
const productJsonMarkerId = 'BUILD_INSERT_PRODUCT_CONFIGURATION';
// TODO@bpasero in order to inline `product.json`, more work is
// needed to ensure that we cover all cases where modifications
// are done to the product configuration during build. There are
// at least 2 more changes that kick in very late:
// - a `darwinUniversalAssetId` is added in`create-universal-app.ts`
// - a `target` is added in `gulpfile.vscode.win32.js`
// const productJsonMarkerId = 'BUILD_INSERT_PRODUCT_CONFIGURATION';
function inlineMeta(result, ctx) {
return result.pipe(es.through(function (file) {
if (matchesFile(file, ctx)) {
@ -19,18 +25,14 @@ function inlineMeta(result, ctx) {
content = content.replace(packageMarker, JSON.stringify(JSON.parse(ctx.packageJsonFn())).slice(1, -1) /* trim braces */);
markerFound = true;
}
const productMarker = `${productJsonMarkerId}:"${productJsonMarkerId}"`; // this needs to be the format after esbuild has processed the file (e.g. double quotes)
if (content.includes(productMarker)) {
content = content.replace(productMarker, JSON.stringify(JSON.parse(ctx.productJsonFn())).slice(1, -1) /* trim braces */);
markerFound = true;
}
// const productMarker = `${productJsonMarkerId}:"${productJsonMarkerId}"`; // this needs to be the format after esbuild has processed the file (e.g. double quotes)
// if (content.includes(productMarker)) {
// content = content.replace(productMarker, JSON.stringify(JSON.parse(ctx.productJsonFn())).slice(1, -1) /* trim braces */);
// markerFound = true;
// }
if (markerFound) {
file.contents = Buffer.from(content);
}
else if (content.includes(packageJsonMarkerId) || content.includes(productJsonMarkerId)) {
this.emit('error', new Error(`Unable to inline metadata because expected markers where not found in ${file.basename}.`));
return;
}
}
this.emit('data', file);
}));

View File

@ -14,7 +14,14 @@ export interface IInlineMetaContext {
}
const packageJsonMarkerId = 'BUILD_INSERT_PACKAGE_CONFIGURATION';
const productJsonMarkerId = 'BUILD_INSERT_PRODUCT_CONFIGURATION';
// TODO@bpasero in order to inline `product.json`, more work is
// needed to ensure that we cover all cases where modifications
// are done to the product configuration during build. There are
// at least 2 more changes that kick in very late:
// - a `darwinUniversalAssetId` is added in`create-universal-app.ts`
// - a `target` is added in `gulpfile.vscode.win32.js`
// const productJsonMarkerId = 'BUILD_INSERT_PRODUCT_CONFIGURATION';
export function inlineMeta(result: NodeJS.ReadWriteStream, ctx: IInlineMetaContext): NodeJS.ReadWriteStream {
return result.pipe(es.through(function (file: File) {
@ -28,17 +35,14 @@ export function inlineMeta(result: NodeJS.ReadWriteStream, ctx: IInlineMetaConte
markerFound = true;
}
const productMarker = `${productJsonMarkerId}:"${productJsonMarkerId}"`; // this needs to be the format after esbuild has processed the file (e.g. double quotes)
if (content.includes(productMarker)) {
content = content.replace(productMarker, JSON.stringify(JSON.parse(ctx.productJsonFn())).slice(1, -1) /* trim braces */);
markerFound = true;
}
// const productMarker = `${productJsonMarkerId}:"${productJsonMarkerId}"`; // this needs to be the format after esbuild has processed the file (e.g. double quotes)
// if (content.includes(productMarker)) {
// content = content.replace(productMarker, JSON.stringify(JSON.parse(ctx.productJsonFn())).slice(1, -1) /* trim braces */);
// markerFound = true;
// }
if (markerFound) {
file.contents = Buffer.from(content);
} else if (content.includes(packageJsonMarkerId) || content.includes(productJsonMarkerId)) {
this.emit('error', new Error(`Unable to inline metadata because expected markers where not found in ${file.basename}.`));
return;
}
}