Files
vscode/build/win32/explorer-dll-fetcher.ts
Robo 4c5bfb172a feat: create versioned resources for windows setup (#263998)
* feat: create versioned resources for windows setup

* chore: use inno_updater to remove old installation

* chore: remove old installation as part of setup

* chore: update explorer-command

* chore: prefer session-end

* chore: uninst delete updating_version

* chore: make session-ending write synchronous

* chore: cleanup updateService.win32.ts

* chore: invoke inno_updater gc path for non background update

* chore: move session-end path to runtime

* chore: use commit for updating_version

* chore: fix invalid string

* chore: set appUpdate path

* chore: update inno_updater

* chore: empty commit for testing

* chore: some cleanups

1) Check for session-ending flag in appx and tunnel callsites
2) Move gc for background update to cleanup phase in updateservice
3) Set update state to ready when there is a running inno_setup

* chore: disallow same version update

* chore: disallow application launch in the middle of update

* chore: empty commit for testing

* chore: bump inno_updater

* chore: empty commit for testing

* chore: move gc to update startup

* chore: move feature behind insider only check

* chore: bump inno_updater

* chore: bump explorer-command

* fix: build

* fix: gc for background update in system setup

* chore: create separate cli entrypoints for build

* fix: check for setup mutex created by inno

* chore: remove problematic updatingVersionPath deletion

* chore: remove redundant update check

* chore: bump inno_updater

* chore: fix build

* chore: bump inno updater
2025-11-24 21:32:12 +09:00

76 lines
2.3 KiB
TypeScript

/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import fs from 'fs';
import debug from 'debug';
import path from 'path';
import { downloadArtifact } from '@electron/get';
import productJson from '../../product.json' with { type: 'json' };
interface ProductConfiguration {
quality?: string;
[key: string]: unknown;
}
const product: ProductConfiguration = productJson;
const d = debug('explorer-dll-fetcher');
export async function downloadExplorerDll(outDir: string, quality: string = 'stable', targetArch: string = 'x64'): Promise<void> {
const fileNamePrefix = quality === 'insider' ? 'code_insider' : 'code';
const fileName = `${fileNamePrefix}_explorer_command_${targetArch}.dll`;
if (!await fs.existsSync(outDir)) {
await fs.mkdirSync(outDir, { recursive: true });
}
// Read and parse checksums file
const checksumsFilePath = path.join(path.dirname(import.meta.dirname), 'checksums', 'explorer-dll.txt');
const checksumsContent = fs.readFileSync(checksumsFilePath, 'utf8');
const checksums: Record<string, string> = {};
checksumsContent.split('\n').forEach(line => {
const trimmedLine = line.trim();
if (trimmedLine) {
const [checksum, filename] = trimmedLine.split(/\s+/);
if (checksum && filename) {
checksums[filename] = checksum;
}
}
});
d(`downloading ${fileName}`);
const artifact = await downloadArtifact({
isGeneric: true,
version: 'v5.0.0-377200',
artifactName: fileName,
checksums,
mirrorOptions: {
mirror: 'https://github.com/microsoft/vscode-explorer-command/releases/download/',
customDir: 'v5.0.0-377200',
customFilename: fileName
}
});
d(`moving ${artifact} to ${outDir}`);
await fs.copyFileSync(artifact, path.join(outDir, fileName));
}
async function main(outputDir?: string): Promise<void> {
const arch = process.env['VSCODE_ARCH'];
if (!outputDir) {
throw new Error('Required build env not set');
}
await downloadExplorerDll(outputDir, product.quality, arch);
}
if (import.meta.main) {
main(process.argv[2]).catch(err => {
console.error(err);
process.exit(1);
});
}