Skip to content

Commit 36b8413

Browse files
fix(desktop): require tar for Windows Cua packaging
1 parent 192813e commit 36b8413

2 files changed

Lines changed: 25 additions & 20 deletions

File tree

‎scripts/build-desktop-artifact.test.ts‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1434,13 +1434,13 @@ it.layer(NodeServices.layer)("build-desktop-artifact", (it) => {
14341434
const fails =
14351435
childProcess.command === "rustc" ||
14361436
childProcess.command === "powershell.exe" ||
1437+
childProcess.command === "tar.exe" ||
14371438
childProcess.command === pythonPath;
14381439
return Effect.succeed(mockProcess(fails ? 1 : 0));
14391440
}),
14401441
);
14411442
const error = yield* preflightWindowsDesktopBuild({
14421443
arch: "x64",
1443-
bundlesWslRuntime: true,
14441444
}).pipe(
14451445
Effect.provide(
14461446
Layer.merge(
@@ -1454,7 +1454,7 @@ it.layer(NodeServices.layer)("build-desktop-artifact", (it) => {
14541454
);
14551455

14561456
assert.instanceOf(error, WindowsDesktopBuildPrerequisitesMissingError);
1457-
assert.deepStrictEqual(error.missing, ["rust", "python", "msvc"]);
1457+
assert.deepStrictEqual(error.missing, ["rust", "python", "msvc", "tar"]);
14581458
assert.equal(error.rustTarget, "x86_64-pc-windows-msvc");
14591459
assert.include(error.message, "Visual Studio Build Tools components");
14601460
}),
@@ -1481,7 +1481,6 @@ it.layer(NodeServices.layer)("build-desktop-artifact", (it) => {
14811481

14821482
yield* preflightWindowsDesktopBuild({
14831483
arch: "x64",
1484-
bundlesWslRuntime: true,
14851484
}).pipe(
14861485
Effect.provide(
14871486
Layer.merge(
@@ -1529,7 +1528,6 @@ it.layer(NodeServices.layer)("build-desktop-artifact", (it) => {
15291528
);
15301529
const error = yield* preflightWindowsDesktopBuild({
15311530
arch: "x64",
1532-
bundlesWslRuntime: false,
15331531
}).pipe(
15341532
Effect.provide(
15351533
Layer.merge(

‎scripts/build-desktop-artifact.ts‎

Lines changed: 23 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -417,7 +417,10 @@ const WINDOWS_DESKTOP_BUILD_PREREQUISITES = [
417417
id: "msvc",
418418
description: "Visual Studio Build Tools with C++, Windows SDK, and Spectre libraries",
419419
},
420-
{ id: "tar", description: "tar to inspect the bundled WSL runtime archive" },
420+
{
421+
id: "tar",
422+
description: "tar.exe to extract Cua Driver and inspect the bundled WSL runtime archive",
423+
},
421424
] as const;
422425

423426
export class WindowsDesktopBuildPrerequisitesMissingError extends Schema.TaggedError<WindowsDesktopBuildPrerequisitesMissingError>()(
@@ -1926,7 +1929,7 @@ function windowsVswherePrerequisiteScript(arch: typeof BuildArch.Type): string {
19261929
}
19271930

19281931
export const preflightWindowsDesktopBuild = Effect.fn("preflightWindowsDesktopBuild")(
1929-
function* (input: { readonly arch: typeof BuildArch.Type; readonly bundlesWslRuntime: boolean }) {
1932+
function* (input: { readonly arch: typeof BuildArch.Type }) {
19301933
const rustTarget = resolveResourceMonitorRustTargets("win", input.arch)[0]!;
19311934
const reuseResourceMonitor = yield* Config.Boolean(
19321935
"T3CODE_DESKTOP_REUSE_RESOURCE_MONITOR",
@@ -1953,9 +1956,7 @@ export const preflightWindowsDesktopBuild = Effect.fn("preflightWindowsDesktopBu
19531956
]),
19541957
"Visual Studio Build Tools",
19551958
),
1956-
tar: input.bundlesWslRuntime
1957-
? desktopBuildProbeSucceeds(ChildProcess.make("tar.exe", ["--version"]), "tar")
1958-
: Effect.succeed(true),
1959+
tar: desktopBuildProbeSucceeds(ChildProcess.make("tar.exe", ["--version"]), "tar"),
19591960
},
19601961
{ concurrency: "unbounded" },
19611962
);
@@ -2453,7 +2454,12 @@ export const stageCuaDriverExecutable = Effect.fn("stageCuaDriverExecutable")(fu
24532454
const command =
24542455
release.format === "zip" && hostPlatform !== "win32"
24552456
? ChildProcess.make("unzip", ["-q", archivePath, "-d", extracted])
2456-
: ChildProcess.make("tar", ["-xf", archivePath, "-C", extracted]);
2457+
: ChildProcess.make(hostPlatform === "win32" ? "tar.exe" : "tar", [
2458+
"-xf",
2459+
archivePath,
2460+
"-C",
2461+
extracted,
2462+
]);
24572463
yield* runCommand(command, { label: "extract Cua Driver", verbose: input.verbose });
24582464
const requiredFiles = [
24592465
release.executable,
@@ -3492,13 +3498,18 @@ export const validateWindowsPackagedPayload = Effect.fn(
34923498
);
34933499
}
34943500

3501+
const hostPlatform = yield* HostProcess.Platform;
34953502
const listing = yield* spawnAndCollectOutput(
3496-
ChildProcess.make("tar", ["-tzf", WSL_RUNTIME_ARCHIVE_NAME], {
3497-
cwd: resourcesDir,
3498-
stdin: "ignore",
3499-
stdout: "pipe",
3500-
stderr: "pipe",
3501-
}),
3503+
ChildProcess.make(
3504+
hostPlatform === "win32" ? "tar.exe" : "tar",
3505+
["-tzf", WSL_RUNTIME_ARCHIVE_NAME],
3506+
{
3507+
cwd: resourcesDir,
3508+
stdin: "ignore",
3509+
stdout: "pipe",
3510+
stderr: "pipe",
3511+
},
3512+
),
35023513
).pipe(Effect.mapError(invalidWslRuntime));
35033514
if (listing.exitCode !== 0) {
35043515
return yield* invalidWslRuntime(
@@ -3587,10 +3598,6 @@ const buildDesktopArtifact = Effect.fn("buildDesktopArtifact")(function* (
35873598
if (hostPlatform === "win32" && options.platform === "win") {
35883599
yield* preflightWindowsDesktopBuild({
35893600
arch: options.arch,
3590-
bundlesWslRuntime: bundlesWslRuntime({
3591-
platform: options.platform,
3592-
runtimeArchivePath: options.wslRuntime,
3593-
}),
35943601
});
35953602
}
35963603
const workspaceConfig = yield* readWorkspaceConfig();

0 commit comments

Comments
 (0)