Skip to content

Commit

Permalink
XcodeBuilder: Add symlinks in framework
Browse files Browse the repository at this point in the history
  • Loading branch information
kabiroberai committed Nov 15, 2023
1 parent fa11679 commit a0caf18
Showing 1 changed file with 22 additions and 9 deletions.
31 changes: 22 additions & 9 deletions src/builder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -267,15 +267,28 @@ export async function build(mode: BuildMode, config: Config = {}): Promise<strin
throw new Error(`xcodebuild exited with status ${result.status}`);
}

await rename(
path.join(binaryDir, `${product}.framework`, "Versions", "A", product),
path.join(binaryDir, `${product}.framework`, "Versions", "A", `${product}.node`)
);

await forceSymlink(
path.join(`${product}.framework`, "Versions", "A", `${product}.node`),
path.join(binaryDir, `${product}.node`)
);
const originalBinary = path.join(binaryDir, `${product}.framework`, "Versions", "A", product);
await Promise.all([
rename(
originalBinary,
// the realpath must end with .node for it to be considered a native module.
path.join(binaryDir, `${product}.framework`, "Versions", "A", `${product}.node`)
),
forceSymlink(
`${product}.node`,
// fixes symlinks that point to the binary without the .node ext
originalBinary
),
// convenience
forceSymlink(
path.join("Versions", "Current", `${product}.node`),
path.join(binaryDir, `${product}.framework`, `${product}.node`)
),
forceSymlink(
path.join(`${product}.framework`, `${product}.node`),
path.join(binaryDir, `${product}.node`)
),
]);
} else {
const swiftPM = typeof config.builder === "object" ? config.builder : {};
const swiftPMFlags = getFlags(swiftPM, "settings");
Expand Down

0 comments on commit a0caf18

Please sign in to comment.