Skip to content

Commit 42b01a3

Browse files
danilobuergerfacebook-github-bot
authored andcommitted
Use relative installation root instead of absolute to avoid embedding absolute paths in pods project (#33187)
Summary: Use relative installation root instead of absolute to avoid embedding absolute paths in pods project Also removes a leading space from each path. Before: <img width="799" alt="155846827-94c474b7-8a79-45fc-a900-8860a94fb318" src="https://user-images.githubusercontent.com/996231/155847731-de128759-bff5-4d1f-a59a-377298055d85.png"> After: <img width="745" alt="Screenshot 2022-02-26 at 15 58 32" src="https://user-images.githubusercontent.com/996231/155847739-b783debc-a805-4ce7-a88a-33f764dc5985.png"> ## Changelog <!-- Help reviewers and the release process by writing your own changelog entry. For an example, see: https://github.com/facebook/react-native/wiki/Changelog --> [iOS] [Fixed] - Remove absolute paths from pods project Pull Request resolved: #33187 Test Plan: Pod install and view in Xcode FBReactNativeSpec -> Build Phases -> [CP-User] Generate Specs Reviewed By: ShikaSD Differential Revision: D34549541 Pulled By: dmitryrykun fbshipit-source-id: 2926b093fb87f50ef9988e23fce593348f00077d
1 parent a0511a1 commit 42b01a3

File tree

5 files changed

+8
-7
lines changed

5 files changed

+8
-7
lines changed

packages/rn-tester/NativeModuleExample/ScreenshotManager.podspec

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ Pod::Spec.new do |s|
2525
s.source_files = "**/*.{h,m,mm,swift}"
2626
s.requires_arc = true
2727

28-
s.dependency "React"
28+
s.dependency "React-Core"
2929
s.dependency "RCT-Folly", folly_version
3030

3131
# s.dependency "..."

packages/rn-tester/RNTesterPods.xcodeproj/xcshareddata/xcschemes/RNTester.xcscheme

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
LastUpgradeVersion = "1210"
44
version = "1.3">
55
<BuildAction
6-
parallelizeBuildables = "NO"
6+
parallelizeBuildables = "YES"
77
buildImplicitDependencies = "YES">
88
<BuildActionEntries>
99
<BuildActionEntry

packages/rn-tester/RNTesterPods.xcodeproj/xcshareddata/xcschemes/RNTesterIntegrationTests.xcscheme

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
LastUpgradeVersion = "1210"
44
version = "1.3">
55
<BuildAction
6-
parallelizeBuildables = "NO"
6+
parallelizeBuildables = "YES"
77
buildImplicitDependencies = "YES">
88
<BuildActionEntries>
99
<BuildActionEntry

packages/rn-tester/RNTesterPods.xcodeproj/xcshareddata/xcschemes/RNTesterUnitTests.xcscheme

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
LastUpgradeVersion = "1210"
44
version = "1.3">
55
<BuildAction
6-
parallelizeBuildables = "NO"
6+
parallelizeBuildables = "YES"
77
buildImplicitDependencies = "YES">
88
<BuildActionEntries>
99
<BuildActionEntry

scripts/react_native_pods.rb

+4-3
Original file line numberDiff line numberDiff line change
@@ -546,22 +546,23 @@ def use_react_native_codegen!(spec, options={})
546546
library_name = options[:library_name] ||= "#{spec.name.gsub('_','-').split('-').collect(&:capitalize).join}Spec"
547547
Pod::UI.puts "[Codegen] Found #{library_name}"
548548

549+
relative_installation_root = Pod::Config.instance.installation_root.relative_path_from(Pathname.pwd)
549550
output_dir = options[:output_dir] ||= $CODEGEN_OUTPUT_DIR
550551
output_dir_module = "#{output_dir}/#{$CODEGEN_MODULE_DIR}"
551552
output_dir_component = "#{output_dir}/#{$CODEGEN_COMPONENT_DIR}"
552553

553554
codegen_config = {
554555
"modules" => {
555556
:js_srcs_pattern => "Native*.js",
556-
:generated_dir => "#{Pod::Config.instance.installation_root}/#{output_dir_module}/#{library_name}",
557+
:generated_dir => "#{relative_installation_root}/#{output_dir_module}/#{library_name}",
557558
:generated_files => [
558559
"#{library_name}.h",
559560
"#{library_name}-generated.mm"
560561
]
561562
},
562563
"components" => {
563564
:js_srcs_pattern => "*NativeComponent.js",
564-
:generated_dir => "#{Pod::Config.instance.installation_root}/#{output_dir_component}/#{library_name}",
565+
:generated_dir => "#{relative_installation_root}/#{output_dir_component}/#{library_name}",
565566
:generated_files => [
566567
"ComponentDescriptors.h",
567568
"EventEmitters.cpp",
@@ -610,7 +611,7 @@ def use_react_native_codegen!(spec, options={})
610611
spec.script_phase = {
611612
:name => 'Generate Specs',
612613
:input_files => input_files, # This also needs to be relative to Xcode
613-
:output_files => ["${DERIVED_FILE_DIR}/codegen-#{library_name}.log"].concat(generated_files.map { |filename| " ${PODS_TARGET_SRCROOT}/#{filename}"} ),
614+
:output_files => ["${DERIVED_FILE_DIR}/codegen-#{library_name}.log"].concat(generated_files.map { |filename| "${PODS_TARGET_SRCROOT}/#{filename}"} ),
614615
# The final generated files will be created when this script is invoked at Xcode build time.
615616
:script => get_script_phases_no_codegen_discovery(
616617
react_native_path: react_native_path,

0 commit comments

Comments
 (0)