mirror of
https://github.com/Microsoft/vscode
synced 2024-08-27 13:00:58 +00:00
build: use new cli patch method (#187629)
This commit is contained in:
parent
4295a96b60
commit
ef8b1483fc
|
@ -30,7 +30,7 @@ steps:
|
|||
workingDirectory: build
|
||||
displayName: Install pipeline build
|
||||
|
||||
- script: node build/azure-pipelines/distro/apply-cli-patches
|
||||
- script: node .build/distro/cli-patches/index.js
|
||||
displayName: Apply distro patches
|
||||
|
||||
- task: Npm@1
|
||||
|
|
|
@ -1,17 +1,5 @@
|
|||
steps:
|
||||
- template: ../distro/download-distro.yml
|
||||
|
||||
- task: Cache@2
|
||||
inputs:
|
||||
key: '"build_node_modules" | build/yarn.lock'
|
||||
path: build/node_modules
|
||||
cacheHitVar: BUILD_NODE_MODULES_RESTORED
|
||||
displayName: Restore node_modules cache
|
||||
|
||||
- script: yarn --frozen-lockfile --ignore-optional --check-files
|
||||
workingDirectory: build
|
||||
condition: and(succeeded(), ne(variables.BUILD_NODE_MODULES_RESTORED, 'true'))
|
||||
displayName: Install pipeline build
|
||||
|
||||
- script: node build/azure-pipelines/distro/apply-cli-patches
|
||||
- script: node .build/distro/cli-patches/index.js
|
||||
displayName: Apply distro patches
|
||||
|
|
|
@ -1,45 +0,0 @@
|
|||
"use strict";
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const fs = require("fs");
|
||||
const cp = require("child_process");
|
||||
const toml = require("@iarna/toml");
|
||||
function log(...args) {
|
||||
console.log(`[${new Date().toLocaleTimeString('en', { hour12: false })}]`, '[distro]', ...args);
|
||||
}
|
||||
log(`Applying CLI patches...`);
|
||||
const basePath = `.build/distro/cli-patches`;
|
||||
const patchTomlSuffix = '.patch.toml';
|
||||
function deepMerge(target, source) {
|
||||
for (const [key, value] of Object.entries(source)) {
|
||||
if (value && typeof value === 'object' && !Array.isArray(value)) {
|
||||
if (!target.hasOwnProperty(key)) {
|
||||
target[key] = value;
|
||||
}
|
||||
else {
|
||||
deepMerge(target[key], value);
|
||||
}
|
||||
}
|
||||
else {
|
||||
target[key] = value;
|
||||
}
|
||||
}
|
||||
return target;
|
||||
}
|
||||
for (const patch of fs.readdirSync(basePath)) {
|
||||
if (patch.endsWith(patchTomlSuffix)) {
|
||||
// this does not support nested filepaths, but that's fine for now...
|
||||
const originalPath = `cli/${patch.slice(0, -patchTomlSuffix.length)}.toml`;
|
||||
const contents = toml.parse(fs.readFileSync(originalPath, 'utf8'));
|
||||
deepMerge(contents, toml.parse(fs.readFileSync(`${basePath}/${patch}`, 'utf8')));
|
||||
fs.writeFileSync(originalPath, toml.stringify(contents));
|
||||
}
|
||||
else {
|
||||
cp.execSync(`git apply --ignore-whitespace --ignore-space-change ${basePath}/${patch}`, { stdio: 'inherit' });
|
||||
}
|
||||
log('Applied CLI patch:', patch, '✔︎');
|
||||
}
|
||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYXBwbHktY2xpLXBhdGNoZXMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJhcHBseS1jbGktcGF0Y2hlcy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUE7OztnR0FHZ0c7O0FBRWhHLHlCQUF5QjtBQUN6QixvQ0FBb0M7QUFDcEMsb0NBQW9DO0FBRXBDLFNBQVMsR0FBRyxDQUFDLEdBQUcsSUFBVztJQUMxQixPQUFPLENBQUMsR0FBRyxDQUFDLElBQUksSUFBSSxJQUFJLEVBQUUsQ0FBQyxrQkFBa0IsQ0FBQyxJQUFJLEVBQUUsRUFBRSxNQUFNLEVBQUUsS0FBSyxFQUFFLENBQUMsR0FBRyxFQUFFLFVBQVUsRUFBRSxHQUFHLElBQUksQ0FBQyxDQUFDO0FBQ2pHLENBQUM7QUFFRCxHQUFHLENBQ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BQUMsS0FBSyxDQUFDLEVBQUUsQ0FBQyxZQUFZLENBQUMsWUFBWSxFQUFFLE1BQU0sQ0FBQyxDQUFDLENBQUM7UUFDbkUsU0FBUyxDQUFDLFFBQVEsRUFBRSxJQUFJLENBQUMsS0FBSyxDQUFDLEVBQUUsQ0FBQyxZQUFZLENBQUMsR0FBRyxRQUFRLElBQUksS0FBSyxFQUFFLEVBQUUsTUFBTSxDQUFDLENBQUMsQ0FBQyxDQUFDO1FBQ2pGLEVBQUUsQ0FBQyxhQUFhLENBQUMsWUFBWSxFQUFFLElBQUksQ0FBQyxTQUFTLENBQUMsUUFBUSxDQUFDLENBQUMsQ0FBQztLQUN6RDtTQUFNO1FBQ04sRUFBRSxDQUFDLFFBQVEsQ0FBQyx1REFBdUQsUUFBUSxJQUFJLEtBQUssRUFBRSxFQUFFLEVBQUUsS0FBSyxFQUFFLFNBQVMsRUFBRSxDQUFDLENBQUM7S0FDOUc7SUFDRCxHQUFHLENBQUMsb0JBQW9CLEVBQUUsS0FBSyxFQUFFLElBQUksQ0FBQyxDQUFDO0NBQ3ZDIn0=
|
|
@ -1,45 +0,0 @@
|
|||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as fs from 'fs';
|
||||
import * as cp from 'child_process';
|
||||
import * as toml from '@iarna/toml';
|
||||
|
||||
function log(...args: any[]): void {
|
||||
console.log(`[${new Date().toLocaleTimeString('en', { hour12: false })}]`, '[distro]', ...args);
|
||||
}
|
||||
|
||||
log(`Applying CLI patches...`);
|
||||
|
||||
const basePath = `.build/distro/cli-patches`;
|
||||
const patchTomlSuffix = '.patch.toml';
|
||||
|
||||
function deepMerge(target: any, source: any): any {
|
||||
for (const [key, value] of Object.entries(source)) {
|
||||
if (value && typeof value === 'object' && !Array.isArray(value)) {
|
||||
if (!target.hasOwnProperty(key)) {
|
||||
target[key] = value;
|
||||
} else {
|
||||
deepMerge(target[key], value);
|
||||
}
|
||||
} else {
|
||||
target[key] = value;
|
||||
}
|
||||
}
|
||||
return target;
|
||||
}
|
||||
|
||||
for (const patch of fs.readdirSync(basePath)) {
|
||||
if (patch.endsWith(patchTomlSuffix)) {
|
||||
// this does not support nested filepaths, but that's fine for now...
|
||||
const originalPath = `cli/${patch.slice(0, -patchTomlSuffix.length)}.toml`;
|
||||
const contents = toml.parse(fs.readFileSync(originalPath, 'utf8'));
|
||||
deepMerge(contents, toml.parse(fs.readFileSync(`${basePath}/${patch}`, 'utf8')));
|
||||
fs.writeFileSync(originalPath, toml.stringify(contents));
|
||||
} else {
|
||||
cp.execSync(`git apply --ignore-whitespace --ignore-space-change ${basePath}/${patch}`, { stdio: 'inherit' });
|
||||
}
|
||||
log('Applied CLI patch:', patch, '✔︎');
|
||||
}
|
|
@ -7,7 +7,6 @@
|
|||
"@azure/identity": "^3.1.3",
|
||||
"@azure/storage-blob": "^12.13.0",
|
||||
"@electron/get": "^1.12.4",
|
||||
"@iarna/toml": "^2.2.5",
|
||||
"@types/ansi-colors": "^3.2.0",
|
||||
"@types/byline": "^4.2.32",
|
||||
"@types/cssnano": "^4.0.0",
|
||||
|
@ -24,7 +23,6 @@
|
|||
"@types/gulp-postcss": "^8.0.0",
|
||||
"@types/gulp-rename": "^0.0.33",
|
||||
"@types/gulp-sourcemaps": "^0.0.32",
|
||||
"@types/iarna__toml": "^2.0.2",
|
||||
"@types/mime": "0.0.29",
|
||||
"@types/minimatch": "^3.0.3",
|
||||
"@types/minimist": "^1.2.1",
|
||||
|
|
|
@ -339,11 +339,6 @@
|
|||
resolved "https://registry.yarnpkg.com/@esbuild/win32-x64/-/win32-x64-0.17.14.tgz#e81fb49de05fed91bf74251c9ca0343f4fc77d31"
|
||||
integrity sha512-gPQmsi2DKTaEgG14hc3CHXHp62k8g6qr0Pas+I4lUxRMugGSATh/Bi8Dgusoz9IQ0IfdrvLpco6kujEIBoaogA==
|
||||
|
||||
"@iarna/toml@^2.2.5":
|
||||
version "2.2.5"
|
||||
resolved "https://registry.yarnpkg.com/@iarna/toml/-/toml-2.2.5.tgz#b32366c89b43c6f8cefbdefac778b9c828e3ba8c"
|
||||
integrity sha512-trnsAYxU3xnS1gPHPyU961coFyLkh4gAD/0zQ5mymY4yOZ+CYvsPqUbOFSw0aDM4y0tV7tiFxL/1XfXPNC6IPg==
|
||||
|
||||
"@malept/cross-spawn-promise@^1.1.0":
|
||||
version "1.1.1"
|
||||
resolved "https://registry.yarnpkg.com/@malept/cross-spawn-promise/-/cross-spawn-promise-1.1.1.tgz#504af200af6b98e198bce768bc1730c6936ae01d"
|
||||
|
@ -506,13 +501,6 @@
|
|||
"@types/undertaker" "*"
|
||||
"@types/vinyl-fs" "*"
|
||||
|
||||
"@types/iarna__toml@^2.0.2":
|
||||
version "2.0.2"
|
||||
resolved "https://registry.yarnpkg.com/@types/iarna__toml/-/iarna__toml-2.0.2.tgz#2e61b079e50760b477bc70e4df1fe5b633ef6c63"
|
||||
integrity sha512-Q3obxKhBLVVbEQ8zsAmsQVobAAZhi8dFFFjF0q5xKXiaHvH8IkSxcbM27e46M9feUMieR03SPpmp5CtaNzpdBg==
|
||||
dependencies:
|
||||
"@types/node" "*"
|
||||
|
||||
"@types/js-beautify@*":
|
||||
version "1.8.0"
|
||||
resolved "https://registry.yarnpkg.com/@types/js-beautify/-/js-beautify-1.8.0.tgz#0369d3d0e1f35a6aec07cb4da2ee2bcda111367c"
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "code-oss-dev",
|
||||
"version": "1.81.0",
|
||||
"distro": "ce5df90ac966be777544d3f332705138a9e4d73e",
|
||||
"distro": "bed7b201bc6ebbfc63268cb4c390d788a86b0192",
|
||||
"author": {
|
||||
"name": "Microsoft Corporation"
|
||||
},
|
||||
|
|
Loading…
Reference in a new issue