Skip to content

fix(cocoapods): Resolve CocoaPods dependencies defined via :path: entries #10442

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

Merged
merged 5 commits into from
Jun 17, 2025

Conversation

bs-ondem
Copy link
Member

@bs-ondem bs-ondem commented Jun 5, 2025

Check individual commit messages for details.

@bs-ondem bs-ondem changed the title fix(cocoapods): Resolve React Native pods from local path fix(cocoapods): Resolve CocoaPods dependencies defined via :path: entries Jun 17, 2025
Copy link

codecov bot commented Jun 17, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 56.75%. Comparing base (0df84a1) to head (1ba9c6f).
Report is 5 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##               main   #10442   +/-   ##
=========================================
  Coverage     56.75%   56.75%           
  Complexity     1642     1642           
=========================================
  Files           337      337           
  Lines         12480    12480           
  Branches       1177     1177           
=========================================
  Hits           7083     7083           
  Misses         4945     4945           
  Partials        452      452           
Flag Coverage Δ
funTest-non-docker 32.97% <ø> (ø)
test-ubuntu-24.04 41.04% <ø> (ø)
test-windows-2022 41.02% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@bs-ondem bs-ondem marked this pull request as ready for review June 17, 2025 10:33
@bs-ondem bs-ondem requested a review from a team as a code owner June 17, 2025 10:33
nodeModulesParentDir.resolve("node_modules/react-native/scripts/react_native_pods.rb")
if (reactNativePath.isFile) {
val rubyContent = generateSequence(parentFile) { it.parentFile }
.map { it.resolve("node_modules/react-native/scripts/react_native_pods.rb") }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could be combined with the line below, but no need for that.

bs-ondem added 3 commits June 17, 2025 13:48
Writing the patched podspec file in a temp directory broke relative paths
used in some podspecs (e.g. to `package.json`). Storing it alongside the
original podspec file ensures the CocoaPods command `pod ipc spec`
evaluates it with proper path resolution.

Signed-off-by: Onur Demirci <[email protected]>
The previous implementation updated only the `externalSources` in the
lockfile by copying the Lockfile object and replacing it with resolved
paths. However, this shallow update was insufficient because the nested
pod dependencies still referened the original unresolved paths.

This commit reconstructs the entire lockfile structure using resolved
absolute paths for the external sources. This guarantess that all path
references within the lockfile are consistent and correctly resolved.

Signed-off-by: Onur Demirci <[email protected]>
Use the `--silent` flag with `pod ipc spec` to suppress warnings or
status messages. Without this flag, the command output can include
additional text alongside the JSON, making it invalid and unparseable.

Signed-off-by: Onur Demirci <[email protected]>
bs-ondem added 2 commits June 17, 2025 14:13
Replace the upward search for the nearest `node_modules` directory by
traversing up the directory tree and checking for the full path to the
`react_native_pods.rb` script at each level. The previous logic stopped
at the first `node_modules` directory found, which could incorrectly
resolve to a nested one inside another package (e.g. `node_modules/
react-native/node_modules`) leading to a broken path.

Signed-off-by: Onur Demirci <[email protected]>
Support resolving podspec files for pods defined with `:path:` in
`Podfile.lock` by checking the specified directory for the podspec file.
This is commonly used for React Native pods located in `node_modules`
directory.

Signed-off-by: Onur Demirci <[email protected]>
@sschuberth sschuberth enabled auto-merge (rebase) June 17, 2025 12:23
@sschuberth sschuberth disabled auto-merge June 17, 2025 12:55
@sschuberth
Copy link
Member

Merging despite the unrelated test failure(s).

@sschuberth sschuberth merged commit 23a177b into oss-review-toolkit:main Jun 17, 2025
24 of 25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants