-
Notifications
You must be signed in to change notification settings - Fork 7
Apple link without cocoapods #351
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
06b03e4 to
7a4eacc
Compare
fc32743 to
6dc2cfb
Compare
|
Tests on MacOS passing on this PR is currently blocked by #353. |
|
That's weird 🙄 Running the app through the CLI instead of XCode doesn't seem to fail validating the app 🤷♂️ |
|
@cursor can you help review this? |
|
Now I have a complete picture. Let me provide a comprehensive code review. Code Review: Apple link without cocoapodsOverviewThis PR implements a significant change to how Node-API frameworks are linked for Apple platforms. Instead of relying on CocoaPods to manage framework dependencies directly, it modifies the Xcode project to include a custom build phase that handles copying, renaming, and code signing of frameworks during the build process. Strengths1. Good Architecture Design
2. Comprehensive Platform Support
3. Robust Framework Handling
4. Good Error Handling
5. Test Coverage Potential Issues & Suggestions1. Hardcoded Paths in Build Phase Script target.createBuildPhase(xcode.PBXShellScriptBuildPhase, {
name: BUILD_PHASE_NAME,
shellScript: [
"set -e",
`'${process.execPath}' '${CLI_PATH}' link --apple '${fromPath}'`,
].join("\n"),
});This embeds absolute paths (
This could cause build failures. Consider using 2. Missing "files": [
"logo.svg",
"bin",
"dist",
"!dist/**/*.test.d.ts",
"!dist/**/*.test.d.ts.map",
"cpp",
"android",
"!android/.cxx",
"!android/build",
"apple",
"include",
"babel-plugin.js",
"scripts/patch-hermes.rb",
"weak-node-api/**",
"!weak-node-api/build/",
"*.js",
"*.podspec"
],The 3. Potential Race Condition with at_exit do
system(PATCH_XCODE_PROJECT_COMMAND) or raise "Failed to patch the Xcode project"
endThe 4. TODO Comments
5. Type Declaration for xmldom 6. Signing Logic signingIdentity:
signingRequired !== "NO" && signingAllowed !== "NO"
? signingIdentity
: undefined,The logic checks that both Minor Suggestions
assert(
framework,
`Failed to find a framework slice matching: ${JSON.stringify(expectedSlice)}`,
);Consider listing available slices in the error message to help debugging.
SummaryThis is a well-structured PR that addresses the issues with CocoaPods-based framework linking. The code quality is high, with good type safety, error handling, and separation of concerns. The main concern is the hardcoded absolute paths in the build phase script which could cause portability issues across different development environments. Recommendation: This PR is ready to merge after addressing the hardcoded paths issue or documenting the limitation. The approach is sound and improves the framework linking workflow significantly. |


Fixes #262 and #213 by modifying the Xcode project after it has been generated by CocoaPods.
Merging this PR will:
patch-xcode-projectcommand to the host CLI: When called, it will modify the main Xcode app target to include a build phase which calls into the CLI withlink --appleargs.patch-xcode-projectcommand. Since users can run this commend themselves or we could drive it from a SPM project, I don't consider this a dependency on CocoaPods as such.bundle, based on environment variables provided by Xcode.
Because the frameworks are no longer explicitly referenced by targets we also don't have the issue of the dynamic libraries being loaded at startup time. Which means faster boot times and less concern about the order of operations as they'll be loaded when required by the app.