Skip to content

Commit

Permalink
Fix podspec setup for 3rd parties when using dynamic linking (#37275)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: #37275

When enabling `USE_FRAMEWORKS=dynamic`, we need to explicitly defines all the dependencies used by the pods.

This change add those missing dependencies.

## Changelog:
[iOS][Added] - Add explicit dependencies for 3rd parties libraries

Reviewed By: NickGerleman

Differential Revision: D45523646

fbshipit-source-id: 228a7e0ae98ea262af4d58b7dc855f944ebed463
  • Loading branch information
cipolleschi authored and facebook-github-bot committed May 9, 2023
1 parent 44af6ca commit c027f0a
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,19 @@ Pod::Spec.new do |s|
s.dependency "RCTRequired"
s.dependency "RCTTypeSafety"
s.dependency "ReactCommon/turbomodule/core"
s.dependency "React-RCTNetwork"
s.dependency "React-RCTImage"
s.dependency "React-NativeModulesApple"
s.dependency "React-CoreModules"

if ENV['USE_HERMES'] == nil || ENV['USE_HERMES'] == "1"
s.dependency "React-hermes"
else
s.dependency "React-jsc"
end

if is_new_arch_enabled
s.dependency "React-Fabric"
s.dependency "React-RCTFabric"
s.dependency "React-graphics"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -544,13 +544,15 @@ def get_podspec_no_fabric_no_script
[
"\"$(PODS_ROOT)/boost\"",
"\"$(PODS_ROOT)/RCT-Folly\"",
"\"$(PODS_ROOT)/DoubleConversion\"",
"\"${PODS_ROOT}/Headers/Public/React-Codegen/react/renderer/components\"",
"\"$(PODS_ROOT)/Headers/Private/React-Fabric\"",
"\"$(PODS_ROOT)/Headers/Private/React-RCTFabric\"",
"\"$(PODS_ROOT)/Headers/Private/Yoga\"",
].join(' ')
},
'dependencies': {
"DoubleConversion": [],
"FBReactNativeSpec": [],
"RCT-Folly": [],
"RCTRequired": [],
Expand All @@ -563,7 +565,7 @@ def get_podspec_no_fabric_no_script
"ReactCommon/turbomodule/core": [],
"hermes-engine": [],
"React-NativeModulesApple": [],
"glog": []
"glog": [],
}
}
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,13 +137,17 @@ def test_installModulesDependencies_whenNewArchEnabledAndNewArchAndNoSearchPaths
[
{ :dependency_name => "React-Core" },
{ :dependency_name => "RCT-Folly", "version"=>"2021.07.22.00" },
{ :dependency_name => "glog" },
{ :dependency_name => "React-RCTFabric" },
{ :dependency_name => "React-Codegen" },
{ :dependency_name => "RCTRequired" },
{ :dependency_name => "RCTTypeSafety" },
{ :dependency_name => "ReactCommon/turbomodule/bridging" },
{ :dependency_name => "ReactCommon/turbomodule/core" },
{ :dependency_name => "React-NativeModulesApple" },
{ :dependency_name => "Yoga" },
{ :dependency_name => "React-Fabric" },
{ :dependency_name => "React-graphics" },
{ :dependency_name => "hermes-engine" }
])
end
Expand All @@ -169,6 +173,7 @@ def test_installModulesDependencies_whenNewArchDisabledAndSearchPathsAndCompiler
[
{ :dependency_name => "React-Core" },
{ :dependency_name => "RCT-Folly", "version"=>"2021.07.22.00" },
{ :dependency_name => "glog" }
]
)
end
Expand Down
4 changes: 3 additions & 1 deletion packages/react-native/scripts/cocoapods/codegen_utils.rb
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ def get_react_codegen_spec(package_json_file, folly_version: '2021.07.22.00', fa
header_search_paths = [
"\"$(PODS_ROOT)/boost\"",
"\"$(PODS_ROOT)/RCT-Folly\"",
"\"$(PODS_ROOT)/DoubleConversion\"",
"\"${PODS_ROOT}/Headers/Public/React-Codegen/react/renderer/components\"",
"\"$(PODS_ROOT)/Headers/Private/React-Fabric\"",
"\"$(PODS_ROOT)/Headers/Private/React-RCTFabric\"",
Expand Down Expand Up @@ -129,8 +130,9 @@ def get_react_codegen_spec(package_json_file, folly_version: '2021.07.22.00', fa
"React-jsi": [],
"ReactCommon/turbomodule/bridging": [],
"ReactCommon/turbomodule/core": [],
"React-NativeModulesApple": [],
"React-NativeModulesApple": [],
"glog": [],
"DoubleConversion": [],
}
}

Expand Down
4 changes: 4 additions & 0 deletions packages/react-native/scripts/cocoapods/new_architecture.rb
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ def self.install_modules_dependencies(spec, new_arch_enabled, folly_version)

spec.dependency "React-Core"
spec.dependency "RCT-Folly", '2021.07.22.00'
spec.dependency "glog"

if new_arch_enabled
current_config["OTHER_CPLUSPLUSFLAGS"] = @@new_arch_cpp_flags
Expand All @@ -119,6 +120,9 @@ def self.install_modules_dependencies(spec, new_arch_enabled, folly_version)
spec.dependency "ReactCommon/turbomodule/bridging"
spec.dependency "ReactCommon/turbomodule/core"
spec.dependency "React-NativeModulesApple"
spec.dependency "Yoga"
spec.dependency "React-Fabric"
spec.dependency "React-graphics"

if ENV["USE_HERMES"] == nil || ENV["USE_HERMES"] == "1"
spec.dependency "hermes-engine"
Expand Down

0 comments on commit c027f0a

Please sign in to comment.