Skip to content
TypeScript

fix(desktop): skip cached monitor compiler check (#9184)

Julius Marminge7a8df3338f91
diff --git a/docs/internals/scripts.md b/docs/internals/scripts.md
index af21f003776..7dd2e30a4b3 100644
--- a/docs/internals/scripts.md
+++ b/docs/internals/scripts.md
@@ -144,6 +144,8 @@ rustup target add aarch64-pc-windows-msvc
Windows supplies `tar.exe`; it is checked when `--wsl-prebuild` makes the artifact include the WSL
runtime. NSIS is downloaded by electron-builder and does not need a separate installation.
+When `T3CODE_DESKTOP_REUSE_RESOURCE_MONITOR=true` points the build at an existing resource monitor,
+the artifact script skips the Rust and Visual Studio checks because it does not compile the monitor.
Unsigned local builds need no Azure credentials. Builds using `--signed` additionally require the
Azure Trusted Signing configuration described below.
diff --git a/scripts/build-desktop-artifact.test.ts b/scripts/build-desktop-artifact.test.ts
index 6cf1006d658..d2ca3c601bf 100644
--- a/scripts/build-desktop-artifact.test.ts
+++ b/scripts/build-desktop-artifact.test.ts
@@ -930,6 +930,48 @@ it.layer(NodeServices.layer)("build-desktop-artifact", (it) => {
),
);
+ it.effect("does not require MSVC when reusing a prebuilt Windows resource monitor", () =>
+ Effect.scoped(
+ Effect.gen(function* () {
+ const fs = yield* FileSystem.FileSystem;
+ const path = yield* Path.Path;
+ const tempDir = yield* fs.makeTempDirectoryScoped({ prefix: "t3-windows-preflight-" });
+ const pythonPath = path.join(tempDir, "python.exe");
+ yield* fs.writeFileString(pythonPath, "python");
+ const commands: string[] = [];
+ const spawner = Layer.succeed(
+ ChildProcessSpawner.ChildProcessSpawner,
+ ChildProcessSpawner.make((command) => {
+ const childProcess = command as unknown as { readonly command: string };
+ commands.push(childProcess.command);
+ return Effect.succeed(mockProcess(childProcess.command === "powershell.exe" ? 1 : 0));
+ }),
+ );
+
+ yield* preflightWindowsDesktopBuild({
+ arch: "x64",
+ bundlesWslRuntime: true,
+ }).pipe(
+ Effect.provide(
+ Layer.merge(
+ spawner,
+ ConfigProvider.layer(
+ ConfigProvider.fromEnv({
+ env: {
+ npm_config_python: pythonPath,
+ T3CODE_DESKTOP_REUSE_RESOURCE_MONITOR: "true",
+ },
+ }),
+ ),
+ ),
+ ),
+ );
+
+ assert.notInclude(commands, "powershell.exe");
+ }),
+ ),
+ );
+
it.effect("rejects a PATH-discovered Python executable that is not Python 3", () =>
Effect.scoped(
Effect.gen(function* () {
diff --git a/scripts/build-desktop-artifact.ts b/scripts/build-desktop-artifact.ts
index 0860c55c29d..9e6f1457c42 100644
--- a/scripts/build-desktop-artifact.ts
+++ b/scripts/build-desktop-artifact.ts
@@ -1730,16 +1730,18 @@ export const preflightWindowsDesktopBuild = Effect.fn("preflightWindowsDesktopBu
rustTargetIsInstalled(rustTarget),
]).pipe(Effect.map(([cargo, target]) => cargo && target)),
python: Effect.succeed(python !== undefined),
- msvc: desktopBuildProbeSucceeds(
- ChildProcess.make("powershell.exe", [
- "-NoLogo",
- "-NoProfile",
- "-NonInteractive",
- "-Command",
- windowsVswherePrerequisiteScript(input.arch),
- ]),
- "Visual Studio Build Tools",
- ),
+ msvc: reuseResourceMonitor
+ ? Effect.succeed(true)
+ : desktopBuildProbeSucceeds(
+ ChildProcess.make("powershell.exe", [
+ "-NoLogo",
+ "-NoProfile",
+ "-NonInteractive",
+ "-Command",
+ windowsVswherePrerequisiteScript(input.arch),
+ ]),
+ "Visual Studio Build Tools",
+ ),
tar: input.bundlesWslRuntime
? desktopBuildProbeSucceeds(ChildProcess.make("tar.exe", ["--version"]), "tar")
: Effect.succeed(true),