Skip to content

Commit

Permalink
Relative path support for app_path added
Browse files Browse the repository at this point in the history
Summary:
Changelog: [Internal] This diff add support of relative paths in `app_path` argument of `use_react_native` function.

Ruby's `relative_path_from` function requires both paths to be either relative or absolute. I added `realpath()` call that converts any path to absolute.

Reviewed By: ShikaSD

Differential Revision: D33311728

fbshipit-source-id: 393a7b4f0eb26831f4d9f4cec8ec180b41cad580
  • Loading branch information
Dmitry Rykun authored and facebook-github-bot committed Mar 10, 2022
1 parent b347c39 commit 325be42
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions scripts/react_native_pods.rb
Expand Up @@ -416,7 +416,7 @@ def get_react_codegen_script_phases(options={})
end

# We need to convert paths to relative path from installation_root for the script phase for CI.
relative_app_root = Pathname.new(app_path).relative_path_from(Pod::Config.instance.installation_root)
relative_app_root = Pathname.new(app_path).realpath().relative_path_from(Pod::Config.instance.installation_root)

config_file_dir = options[:config_file_dir] ||= ''
relative_config_file_dir = ''
Expand All @@ -440,7 +440,7 @@ def get_react_codegen_script_phases(options={})
library_dir = File.join(app_path, library['jsSrcsDir'])
file_list.concat (`find #{library_dir} -type f \\( -name "Native*.js" -or -name "*NativeComponent.js" \\)`.split("\n").sort)
end
input_files = file_list.map { |filename| "${PODS_ROOT}/../#{Pathname.new(filename).relative_path_from(Pod::Config.instance.installation_root)}" }
input_files = file_list.map { |filename| "${PODS_ROOT}/../#{Pathname.new(filename).realpath().relative_path_from(Pod::Config.instance.installation_root)}" }

# Add a script phase to trigger generate artifact.
# Some code is duplicated so that it's easier to delete the old way and switch over to this once it's stabilized.
Expand Down

0 comments on commit 325be42

Please sign in to comment.