Skip to content

Commit 78190b4

Browse files
generatedunixname89002005232357meta-codesync[bot]
authored andcommitted
Revert D100830088: Fix REACT_NATIVE_PATH resolution when Pods/ is a symlink
Differential Revision: D100830088 Original commit changeset: b92e83e8491b Original Phabricator Diff: D100830088 fbshipit-source-id: 24a9929017fd6c5ea312584303cc5a63e91b2e58
1 parent cf94430 commit 78190b4

4 files changed

Lines changed: 8 additions & 35 deletions

File tree

packages/react-native/scripts/codegen/generate-artifacts-executor/generateReactCodegenPodspec.js

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -82,16 +82,10 @@ function codegenScripts(appPath /*: string */, baseOutputPath /*: string */) {
8282
baseOutputPath,
8383
REACT_NATIVE_PACKAGE_ROOT_FOLDER,
8484
);
85-
// Use PODFILE_DIR (set by react_native_post_install) to locate the Podfile
86-
// directory. PODS_ROOT/.. does not work when Pods/ is a symlink.
8785
return `<<-SCRIPT
88-
if [ -n "$PODFILE_DIR" ]; then
89-
RCT_SCRIPT_POD_INSTALLATION_ROOT="$PODFILE_DIR"
90-
else
91-
pushd "$PODS_ROOT/../" > /dev/null
92-
RCT_SCRIPT_POD_INSTALLATION_ROOT=$(pwd)
93-
popd >/dev/null
94-
fi
86+
pushd "$PODS_ROOT/../" > /dev/null
87+
RCT_SCRIPT_POD_INSTALLATION_ROOT=$(pwd)
88+
popd >/dev/null
9589
9690
export RCT_SCRIPT_RN_DIR="$RCT_SCRIPT_POD_INSTALLATION_ROOT/${relativeReactNativeRootFolder}"
9791
export RCT_SCRIPT_APP_PATH="$RCT_SCRIPT_POD_INSTALLATION_ROOT/${relativeAppPath.length === 0 ? '.' : relativeAppPath}"

packages/react-native/scripts/react_native_pods.rb

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -531,16 +531,7 @@ def react_native_post_install(
531531
ReactNativePodsUtils.fix_library_search_paths(installer)
532532
ReactNativePodsUtils.update_search_paths(installer)
533533
ReactNativePodsUtils.set_build_setting(installer, build_setting: "USE_HERMES", value: use_hermes())
534-
# Compute REACT_NATIVE_PATH relative to PODS_ROOT using real (physical)
535-
# paths, so the relative traversal is correct even when Pods/ is a symlink.
536-
pods_dir_real = Pathname.new(Pod::Config.instance.sandbox_root.to_s).realpath
537-
rn_absolute = File.expand_path(react_native_path, Pod::Config.instance.installation_root.to_s)
538-
rn_real = Pathname.new(rn_absolute).realpath
539-
rn_relative_to_pods = rn_real.relative_path_from(pods_dir_real)
540-
ReactNativePodsUtils.set_build_setting(installer, build_setting: "REACT_NATIVE_PATH", value: File.join("${PODS_ROOT}", rn_relative_to_pods.to_s))
541-
# Store the Podfile directory as a build setting so that shell scripts can
542-
# locate it without relying on PODS_ROOT/.. (breaks when Pods/ is a symlink).
543-
ReactNativePodsUtils.set_build_setting(installer, build_setting: "PODFILE_DIR", value: Pod::Config.instance.installation_root.to_s)
534+
ReactNativePodsUtils.set_build_setting(installer, build_setting: "REACT_NATIVE_PATH", value: File.join("${PODS_ROOT}", "..", react_native_path))
544535
ReactNativePodsUtils.set_build_setting(installer, build_setting: "SWIFT_ACTIVE_COMPILATION_CONDITIONS", value: ['$(inherited)', 'DEBUG'], config_name: "Debug")
545536

546537
if (ENV['RCT_REMOVE_LEGACY_ARCH'] == '1')

packages/react-native/scripts/react_native_pods_utils/script_phases.rb

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,9 @@ def get_script_phases_no_codegen_discovery(options)
3535

3636
def get_script_template(react_native_path, export_vars={})
3737
template =<<~EOS
38-
# Use PODFILE_DIR (set by react_native_post_install) to locate the
39-
# Podfile directory. PODS_ROOT/.. does not work when Pods/ is a symlink.
40-
if [ -n "$PODFILE_DIR" ]; then
41-
RCT_SCRIPT_POD_INSTALLATION_ROOT="$PODFILE_DIR"
42-
else
43-
pushd "$PODS_ROOT/../" > /dev/null
44-
RCT_SCRIPT_POD_INSTALLATION_ROOT=$(pwd)
45-
popd >/dev/null
46-
fi
38+
pushd "$PODS_ROOT/../" > /dev/null
39+
RCT_SCRIPT_POD_INSTALLATION_ROOT=$(pwd)
40+
popd >/dev/null
4741
<% export_vars.each do |(varname, value)| %>
4842
export <%= varname -%>=<%= value -%>
4943
<% end %>

packages/react-native/scripts/xcode/with-environment.sh

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,7 @@ NODE_BINARY=$(command -v node || echo "")
1717
export NODE_BINARY
1818

1919
# Override the default with the global environment
20-
# Use PODFILE_DIR (set by react_native_post_install) to locate .xcode.env.
21-
# PODS_ROOT/.. does not work when Pods/ is a symlink.
22-
if [ -n "$PODFILE_DIR" ]; then
23-
ENV_PATH="$PODFILE_DIR/.xcode.env"
24-
else
25-
ENV_PATH="$PODS_ROOT/../.xcode.env"
26-
fi
20+
ENV_PATH="$PODS_ROOT/../.xcode.env"
2721
if [ -f "$ENV_PATH" ]; then
2822
source "$ENV_PATH"
2923
fi

0 commit comments

Comments
 (0)