Skip to content

Commit f661037

Browse files
chrfalchclaude
andcommitted
fix(cocoapods): harden prebuilt-deps header search paths and artifact handling
- rndependencies.rb: the previous "||= [] << path" only added the deps header search path when HEADER_SEARCH_PATHS was unset — with an existing value the path was silently dropped. Normalize string values and always append. Also point the search path at the pod-local flattened Headers/ (single header home) instead of the artifact root. - ReactNativeDependencies.podspec: prepare_command exited 0 when XCFRAMEWORK_PATH/HEADERS_PATH resolved empty, producing a silent no-link pod; fail closed with exit 1. - reactNativeDependencies.js: an artifact without a version marker logged "we are going to use it anyway" but then fell through to rmSync + re-download, destroying locally staged deps builds; honor the message and use it as-is. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1 parent 562985d commit f661037

3 files changed

Lines changed: 18 additions & 3 deletions

File tree

packages/react-native/scripts/cocoapods/rndependencies.rb

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,19 @@ def add_rn_third_party_dependencies(s)
4949

5050
current_pod_target_xcconfig["HEADER_SEARCH_PATHS"] = header_search_paths
5151
else
52+
# Prebuilt-deps mode: this pod SELF-SERVES the third-party headers from its
53+
# own xcframework (incl. SocketRocket - sole supplier in this mode). See
54+
# scripts/cocoapods/__docs__/prebuilt-deps.md for the full contract.
5255
s.dependency "ReactNativeDependencies"
53-
current_pod_target_xcconfig["HEADER_SEARCH_PATHS"] ||= [] << "$(PODS_ROOT)/ReactNativeDependencies"
56+
57+
header_search_paths = current_pod_target_xcconfig["HEADER_SEARCH_PATHS"] || []
58+
if header_search_paths.is_a?(String)
59+
header_search_paths = header_search_paths.split(" ")
60+
end
61+
# Artifact headers are flattened into the pod-local Headers/ by the podspec
62+
# prepare_command (see __docs__/prebuilt-deps.md).
63+
header_search_paths << "$(PODS_ROOT)/ReactNativeDependencies/Headers"
64+
current_pod_target_xcconfig["HEADER_SEARCH_PATHS"] = header_search_paths
5465
end
5566

5667
s.pod_target_xcconfig = current_pod_target_xcconfig

packages/react-native/scripts/ios-prebuild/reactNativeDependencies.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,10 @@ function checkExistingVersion(
161161
dependencyLog(
162162
`React Native Dependencies found on disk at: ${artifactsPath}.\nNo version file has been found. We are going to use it anyway, but there might be some unexpected behaviors.`,
163163
);
164+
// Honor the message above: an artifact without a version marker is a
165+
// locally-staged one (e.g. a freshly composed deps build) — falling
166+
// through here rmSync'd it and re-downloaded. Use it as-is.
167+
return true;
164168
}
165169
} else {
166170
dependencyLog('React Native Dependencies not found on disk');

packages/react-native/third-party-podspecs/ReactNativeDependencies.podspec

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,13 @@ Pod::Spec.new do |spec|
5353
# Check if XCFRAMEWORK_PATH is empty
5454
if [ -z "$XCFRAMEWORK_PATH" ]; then
5555
echo "ERROR: XCFRAMEWORK_PATH is empty."
56-
exit 0
56+
exit 1
5757
fi
5858
5959
# Check if HEADERS_PATH is empty
6060
if [ -z "$HEADERS_PATH" ]; then
6161
echo "ERROR: HEADERS_PATH is empty."
62-
exit 0
62+
exit 1
6363
fi
6464
6565
cp -R "$HEADERS_PATH/." Headers

0 commit comments

Comments
 (0)