From d112b3987e43f9d29c57d2bb155bc678014d9c3e Mon Sep 17 00:00:00 2001 From: Robo Date: Wed, 18 Feb 2026 00:13:55 +0900 Subject: [PATCH] chore: update application name logic for win32 scripts (#295777) --- build/gulpfile.vscode.ts | 35 +++++++++++++++++++++++------------ scripts/code-cli.bat | 3 ++- scripts/code.bat | 3 ++- scripts/node-electron.bat | 3 ++- scripts/test.bat | 3 ++- 5 files changed, 31 insertions(+), 16 deletions(-) diff --git a/build/gulpfile.vscode.ts b/build/gulpfile.vscode.ts index cbf6cc94527..31c31f58406 100644 --- a/build/gulpfile.vscode.ts +++ b/build/gulpfile.vscode.ts @@ -387,14 +387,20 @@ function packageTask(platform: string, arch: string, sourceFolderName: string, d })); - const packageSubJsonStream = gulp.src(['package.json'], { base: '.' }) - .pipe(jsonEditor((json: Record) => { - json.name = `sessions-${quality || 'oss-dev'}`; - return json; - })) - .pipe(rename('package.sub.json')); + const isInsiderOrExploration = quality === 'insider' || quality === 'exploration'; + const embedded = isInsiderOrExploration + ? (product as typeof product & { embedded?: { nameShort: string; nameLong: string; applicationName: string; dataFolderName: string; darwinBundleIdentifier: string } }).embedded + : undefined; + + const packageSubJsonStream = isInsiderOrExploration + ? gulp.src(['package.json'], { base: '.' }) + .pipe(jsonEditor((json: Record) => { + json.name = `sessions-${quality || 'oss-dev'}`; + return json; + })) + .pipe(rename('package.sub.json')) + : undefined; - const embedded = (product as typeof product & { embedded?: { nameShort: string; nameLong: string; applicationName: string; dataFolderName: string; darwinBundleIdentifier: string } }).embedded; const productSubJsonStream = embedded ? gulp.src(['product.json'], { base: '.' }) .pipe(jsonEditor((json: Record) => { @@ -406,7 +412,7 @@ function packageTask(platform: string, arch: string, sourceFolderName: string, d return json; })) .pipe(rename('product.sub.json')) - : gulp.src(['product.sub.json'], { base: '.', allowEmpty: true }); + : undefined; const license = gulp.src([product.licenseFileName, 'ThirdPartyNotices.txt', 'licenses/**'], { base: '.', allowEmpty: true }); @@ -443,17 +449,22 @@ function packageTask(platform: string, arch: string, sourceFolderName: string, d 'node_modules/vsda/**' // retain copy of `vsda` in node_modules for internal use ], 'node_modules.asar')); - let all = es.merge( + const mergeStreams = [ packageJsonStream, productJsonStream, - packageSubJsonStream, - productSubJsonStream, license, api, telemetry, sources, deps - ); + ]; + if (packageSubJsonStream) { + mergeStreams.push(packageSubJsonStream); + } + if (productSubJsonStream) { + mergeStreams.push(productSubJsonStream); + } + let all = es.merge(...mergeStreams); if (platform === 'win32') { all = es.merge(all, gulp.src([ diff --git a/scripts/code-cli.bat b/scripts/code-cli.bat index e28f03f6cdc..543106f45c8 100644 --- a/scripts/code-cli.bat +++ b/scripts/code-cli.bat @@ -8,7 +8,8 @@ pushd %~dp0.. :: Get electron, compile, built-in extensions if "%VSCODE_SKIP_PRELAUNCH%"=="" node build/lib/preLaunch.ts -for /f "tokens=2 delims=:," %%a in ('findstr /R /C:"\"nameShort\":.*" product.json') do set NAMESHORT=%%~a +set "NAMESHORT=" +for /f "tokens=2 delims=:," %%a in ('findstr /R /C:"\"nameShort\":.*" product.json') do if not defined NAMESHORT set "NAMESHORT=%%~a" set NAMESHORT=%NAMESHORT: "=% set NAMESHORT=%NAMESHORT:"=%.exe set CODE=".build\electron\%NAMESHORT%" diff --git a/scripts/code.bat b/scripts/code.bat index 784efeaecaf..62cfd0b4c49 100644 --- a/scripts/code.bat +++ b/scripts/code.bat @@ -10,7 +10,8 @@ if "%VSCODE_SKIP_PRELAUNCH%"=="" ( node build/lib/preLaunch.ts ) -for /f "tokens=2 delims=:," %%a in ('findstr /R /C:"\"nameShort\":.*" product.json') do set NAMESHORT=%%~a +set "NAMESHORT=" +for /f "tokens=2 delims=:," %%a in ('findstr /R /C:"\"nameShort\":.*" product.json') do if not defined NAMESHORT set "NAMESHORT=%%~a" set NAMESHORT=%NAMESHORT: "=% set NAMESHORT=%NAMESHORT:"=%.exe set CODE=".build\electron\%NAMESHORT%" diff --git a/scripts/node-electron.bat b/scripts/node-electron.bat index ee24da09acc..33d4fdd71fc 100644 --- a/scripts/node-electron.bat +++ b/scripts/node-electron.bat @@ -5,7 +5,8 @@ set ELECTRON_RUN_AS_NODE=1 pushd %~dp0\.. -for /f "tokens=2 delims=:," %%a in ('findstr /R /C:"\"nameShort\":.*" product.json') do set NAMESHORT=%%~a +set "NAMESHORT=" +for /f "tokens=2 delims=:," %%a in ('findstr /R /C:"\"nameShort\":.*" product.json') do if not defined NAMESHORT set "NAMESHORT=%%~a" set NAMESHORT=%NAMESHORT: "=% set NAMESHORT=%NAMESHORT:"=%.exe set CODE=".build\electron\%NAMESHORT%" diff --git a/scripts/test.bat b/scripts/test.bat index 4e0f89fb501..dee40972d80 100644 --- a/scripts/test.bat +++ b/scripts/test.bat @@ -6,7 +6,8 @@ set ELECTRON_RUN_AS_NODE= pushd %~dp0\.. :: Get Code.exe location -for /f "tokens=2 delims=:," %%a in ('findstr /R /C:"\"nameShort\":.*" product.json') do set NAMESHORT=%%~a +set "NAMESHORT=" +for /f "tokens=2 delims=:," %%a in ('findstr /R /C:"\"nameShort\":.*" product.json') do if not defined NAMESHORT set "NAMESHORT=%%~a" set NAMESHORT=%NAMESHORT: "=% set NAMESHORT=%NAMESHORT:"=%.exe set CODE=".build\electron\%NAMESHORT%"