Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions scripts/build-desktop-artifact.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -986,6 +986,20 @@ it.layer(NodeServices.layer)("build-desktop-artifact", (it) => {
assert.deepStrictEqual(result.unpackedFiles, ["node_modules/native/addon.node"]);
assert.isBelow(result.fileCount, WINDOWS_PACKAGED_PAYLOAD_FILE_LIMIT);
assert.deepStrictEqual(secondAsar, firstAsar);

const compileCacheDir = path.join(fixture.packagedAppDir, "resources/server-compile-cache");
yield* fs.makeDirectory(compileCacheDir, { recursive: true });
for (const name of ["manifest.json", "0016a2bb", "0736d3e0"]) {
yield* fs.writeFileString(path.join(compileCacheDir, name), "cache");
}
const withCache = yield* validateWindowsPackagedPayload({
stageDistDir: fixture.stageDistDir,
appExecutableName: fixture.appExecutableName,
targetArch: "x64",
appVersion: WINDOWS_PAYLOAD_FIXTURE_VERSION,
fileLimit: result.fileCount,
});
assert.equal(withCache.fileCount, result.fileCount);
}),
).pipe(Effect.provideService(HostProcess.Platform, "linux")),
);
Expand Down
9 changes: 6 additions & 3 deletions scripts/build-desktop-artifact.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1062,8 +1062,10 @@ export function resolveWindowsServerAsarIgnoreGlobs(arch: typeof BuildArch.Type)
];
}

// Fork: 110, not upstream's 80. Fork natives add 15 files and a native Windows build adds the server compile cache.
export const WINDOWS_PACKAGED_PAYLOAD_FILE_LIMIT = 110;
// Fork: 95, not upstream's 80, for 15 fork natives. Upstream cross-builds Windows without the
// server compile cache, which grows with every server chunk, so the count leaves it out.
export const WINDOWS_PACKAGED_PAYLOAD_FILE_LIMIT = 95;
const WINDOWS_PAYLOAD_UNCOUNTED_DIR = "resources/server-compile-cache";
export const WINDOWS_SERVER_RESOURCE_SOURCE_DIR = "apps/desktop/prod-resources/windows-server";
export const WINDOWS_SERVER_EXTRA_RESOURCES = [
{
Expand Down Expand Up @@ -3204,6 +3206,7 @@ function collectUnpackedAsarFiles(
const countPayloadFiles = Effect.fn("desktopArtifact.countPayloadFiles")(function* (root: string) {
const fs = yield* FileSystem.FileSystem;
const path = yield* Path.Path;
const uncounted = path.join(root, ...WINDOWS_PAYLOAD_UNCOUNTED_DIR.split("/"));
const pendingDirectories = [root];
let count = 0;

Expand All @@ -3215,7 +3218,7 @@ const countPayloadFiles = Effect.fn("desktopArtifact.countPayloadFiles")(functio
const entryPath = path.join(directory, entry);
const stat = yield* fs.stat(entryPath);
if (stat.type === "Directory") {
pendingDirectories.push(entryPath);
if (entryPath !== uncounted) pendingDirectories.push(entryPath);
} else if (stat.type === "File") {
count += 1;
}
Expand Down