Skip to content

Commit

Permalink
CocoaPods frameworks compatibility: Step 1 (#25496)
Browse files Browse the repository at this point in the history
Summary:
This is the first step towards fixing #25349. These are the changes to the podspec to correctly update dependencies and build config that will cause any breaking change for users or libraries.

I am breaking these changes out from #25393 as suggested by fkgozali in #25393 (comment).

These are the changes:

- Made C++ headers in `React-Core` private by default so that ObjC files can import the module without failures.
- Reduced the number of `yoga` headers that are exposed for the same reason as above. As far as I can see this doesn't cause issues but we can find another solution if it does.
- Adding some missing dependencies to fix undefined symbols errors.
- Added `DoubleConversion` to `HEADER_SEARCH_PATHS` where it was missing.

## Changelog

[iOS] [Fixed] - Updated podspecs for improved compatibility with different install types.
Pull Request resolved: #25496

Test Plan:
Everything should work exactly as before. I have a branch on my [sample project](https://github.com/jtreanor/react-native-cocoapods-frameworks) here which points at this branch to show that it is still working `Podfile` to demonstrate this is fixed.

You can see that it works with these steps:

1. `git clone [email protected]:jtreanor/react-native-cocoapods-frameworks.git`
2. `git checkout podspec-updates`
3. `cd ios && pod install`
4. `cd .. && react-native run-ios`

The sample app will build and run successfully.

Reviewed By: mmmulani

Differential Revision: D16167346

Pulled By: fkgozali

fbshipit-source-id: 1917b2f8779cb172362a457fb3fce686c55056d3
  • Loading branch information
jtreanor authored and facebook-github-bot committed Jul 10, 2019
1 parent 27009c1 commit 6ef9106
Show file tree
Hide file tree
Showing 10 changed files with 52 additions and 19 deletions.
39 changes: 29 additions & 10 deletions RNTester/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,24 @@ PODS:
- React-Core (= 1000.0.0)
- React-Core (1000.0.0):
- Folly (= 2018.10.22.00)
- glog
- React-Core/Default (= 1000.0.0)
- React-cxxreact (= 1000.0.0)
- React-jsi (= 1000.0.0)
- React-jsiexecutor (= 1000.0.0)
- yoga (= 1000.0.0.React)
- React-Core/CxxBridge (1000.0.0):
- Folly (= 2018.10.22.00)
- glog
- React-cxxreact (= 1000.0.0)
- React-jsi (= 1000.0.0)
- React-jsiexecutor (= 1000.0.0)
- yoga (= 1000.0.0.React)
- React-Core/Default (1000.0.0):
- Folly (= 2018.10.22.00)
- glog
- React-cxxreact (= 1000.0.0)
- React-jsi (= 1000.0.0)
- React-jsiexecutor (= 1000.0.0)
- yoga (= 1000.0.0.React)
- React-CoreModules (1000.0.0):
Expand Down Expand Up @@ -102,25 +119,27 @@ PODS:
- React-Core (= 1000.0.0)
- React-turbomodule-core (1000.0.0):
- Folly (= 2018.10.22.00)
- React-Core (= 1000.0.0)
- React-Core/CxxBridge (= 1000.0.0)
- React-cxxreact (= 1000.0.0)
- React-jscallinvoker (= 1000.0.0)
- React-jsi (= 1000.0.0)
- React-turbomodule-core/core-ios (= 1000.0.0)
- React-turbomodule-core/core-ios (1000.0.0):
- Folly (= 2018.10.22.00)
- React-Core (= 1000.0.0)
- React-Core/CxxBridge (= 1000.0.0)
- React-cxxreact (= 1000.0.0)
- React-jscallinvoker (= 1000.0.0)
- React-jsi (= 1000.0.0)
- React-turbomodule-samples (1000.0.0):
- DoubleConversion
- Folly (= 2018.10.22.00)
- React-Core (= 1000.0.0)
- React-cxxreact (= 1000.0.0)
- React-jsi (= 1000.0.0)
- React-turbomodule-core (= 1000.0.0)
- React-turbomodule-samples/samples-ios (= 1000.0.0)
- React-turbomodule-samples/samples-ios (1000.0.0):
- DoubleConversion
- Folly (= 2018.10.22.00)
- React-Core (= 1000.0.0)
- React-cxxreact (= 1000.0.0)
Expand Down Expand Up @@ -247,13 +266,13 @@ SPEC CHECKSUMS:
RCTRequired: 33f3b89d2d82ef01c02b9b4f8146c43762e509d8
React: 7c652b87c228731c51ab5764de68b6c17e6342be
React-ART: 28f8815acbbc4816cec14866b59911a83eb780ed
React-Core: 26b00da6b066d0d426a558d13c76240038aa7dc5
React-Core: b85f6553c4b2a31e7d71234c28b51bb928a00cbd
React-CoreModules: 04ea22808b22232b251d462f3309ab1150e3b7dd
React-cxxreact: 7e670bad16eb78fa889573d931c12bb1003a3598
React-cxxreact: 7c4242192149ce0205b53efaa03e3bf86ba4337c
React-DevSupport: f34768e3aad3e59ee9800c752a78bc6cb24d0f75
React-jscallinvoker: a477dfe11b3ebe31ee9575057ebfb57a963db636
React-jsi: 93638e9b97e1373ae1d8c40f0571c0a2814ef900
React-jsiexecutor: ee776181a1ba315dbae9500c4dba5cb94ea3c5d2
React-jscallinvoker: e730f2eca4cb27830af459c0a9af00ac6691bf4c
React-jsi: 98d1f9d8a79d2720ba6a44c2d928a77f315b7e4f
React-jsiexecutor: c0ab8c80a6e88380d63f583690a50d4a723b47b5
React-jsinspector: ea0a218071a11c3687cef2480580180caa6a64c0
React-RCTActionSheet: caf6532394bdbbe0fc0ec2363c84f26bcfcdd36a
React-RCTAnimation: b324c6eb699637c735650c6180e13d003eeb0e56
Expand All @@ -267,10 +286,10 @@ SPEC CHECKSUMS:
React-RCTText: 469ec754592c92fc639825e558908c2f0e783e2c
React-RCTVibration: ade3c169b54f3bc16c9a9918e17e48ef66aee6ba
React-RCTWebSocket: cb5317e9a4adc37191660f819fb21d63433584ef
React-turbomodule-core: 0a6e91fe8e28bbf119fe31132ecb27a4f42ea551
React-turbomodule-samples: b28927d482d6fcfc3cbe2fd25f304799d2ff9bb7
React-turbomodule-core: 5cce62fb65bd0b19f249bc1c4c54b82b3cf9a749
React-turbomodule-samples: ef5c144b510530cb108d4bdb8615dc3943a802fd
React-TypeSafety: 1de5a1034398108f4ca866b68489734f8dbb4c44
yoga: 542cb34fe3bca476487e08eb516dd640ea996a65
yoga: b72aa5b3708cc93c5897f8297122d6eba1331e07

PODFILE CHECKSUM: bdc86d3bfde60c2637cfa8c4ed81afeaa2aaf6a3

Expand Down
13 changes: 13 additions & 0 deletions React/React-Core.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,27 @@ Pod::Spec.new do |s|
"Views/RCTRefreshControl*",
"Views/RCTSlider*",
"Views/RCTSwitch*",
s.private_header_files = "Cxx*/*.h"
s.compiler_flags = folly_compiler_flags + ' ' + boost_compiler_flags
s.header_dir = "React"
s.framework = "JavaScriptCore"
s.library = "stdc++"
s.pod_target_xcconfig = { "HEADER_SEARCH_PATHS" => "\"$(PODS_TARGET_SRCROOT)/ReactCommon\" \"$(PODS_ROOT)/boost-for-react-native\" \"$(PODS_ROOT)/DoubleConversion\" \"$(PODS_ROOT)/Folly\"" }
s.default_subspec = "Default"

s.subspec "Default" do |ss|
# no-op
end

s.subspec "CxxBridge" do |ss|
# Make the C++ headers visible if they are needed
ss.public_header_files = "**/*.{h}"
end

s.dependency "Folly", folly_version
s.dependency "React-cxxreact", version
s.dependency "React-jsi", version
s.dependency "React-jsiexecutor", version
s.dependency "yoga", "#{version}.React"
s.dependency "glog"
end
2 changes: 1 addition & 1 deletion React/React-RCTFabric.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ Pod::Spec.new do |s|
s.xcconfig = { "HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/boost-for-react-native\" \"$(PODS_ROOT)/glog\" \"$(PODS_ROOT)/Folly\"",
"OTHER_CFLAGS" => "$(inherited) -DRN_FABRIC_ENABLED" + " " + folly_flags }

s.dependency "React-Core", version
s.dependency "React-Core/CxxBridge", version
s.dependency "React-Fabric", version
s.dependency "React-RCTImage", version
s.dependency "Folly/Fabric", folly_version
Expand Down
2 changes: 1 addition & 1 deletion ReactCommon/cxxreact/React-cxxreact.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ Pod::Spec.new do |s|
s.source_files = "*.{cpp,h}"
s.exclude_files = "SampleCxxModule.*"
s.compiler_flags = folly_compiler_flags + ' ' + boost_compiler_flags
s.pod_target_xcconfig = { "HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/boost-for-react-native\" \"$(PODS_ROOT)/Folly\"" }
s.pod_target_xcconfig = { "HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/boost-for-react-native\" \"$(PODS_ROOT)/Folly\" \"$(PODS_ROOT)/DoubleConversion\"" }
s.header_dir = "cxxreact"

s.dependency "boost-for-react-native", "1.63.0"
Expand Down
2 changes: 1 addition & 1 deletion ReactCommon/jscallinvoker/React-jscallinvoker.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ Pod::Spec.new do |s|
s.source_files = "jsireact/*.{cpp,h}"
s.compiler_flags = folly_compiler_flags + ' ' + boost_compiler_flags
s.header_dir = "jsireact"
s.pod_target_xcconfig = { "HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/boost-for-react-native\" \"$(PODS_ROOT)/Folly\"" }
s.pod_target_xcconfig = { "HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/boost-for-react-native\" \"$(PODS_ROOT)/Folly\" \"$(PODS_ROOT)/DoubleConversion\"" }

s.dependency "React-cxxreact", version
s.dependency "Folly", folly_version
Expand Down
2 changes: 1 addition & 1 deletion ReactCommon/jsi/React-jsi.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ Pod::Spec.new do |s|
s.exclude_files = "**/test/*"
s.framework = "JavaScriptCore"
s.compiler_flags = folly_compiler_flags + ' ' + boost_compiler_flags
s.pod_target_xcconfig = { "HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/boost-for-react-native\" \"$(PODS_ROOT)/Folly\"" }
s.pod_target_xcconfig = { "HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/boost-for-react-native\" \"$(PODS_ROOT)/Folly\" \"$(PODS_ROOT)/DoubleConversion\"" }
s.header_dir = "jsi"
s.default_subspec = "Default"

Expand Down
2 changes: 1 addition & 1 deletion ReactCommon/jsiexecutor/React-jsiexecutor.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Pod::Spec.new do |s|
s.source = source
s.source_files = "jsireact/*.{cpp,h}"
s.compiler_flags = folly_compiler_flags + ' ' + boost_compiler_flags
s.pod_target_xcconfig = { "HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/boost-for-react-native\" \"$(PODS_ROOT)/Folly\"" }
s.pod_target_xcconfig = { "HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/boost-for-react-native\" \"$(PODS_ROOT)/Folly\" \"$(PODS_ROOT)/DoubleConversion\"" }
s.header_dir = "jsireact"

s.dependency "React-cxxreact", version
Expand Down
4 changes: 2 additions & 2 deletions ReactCommon/turbomodule/core/React-turbomodule-core.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ Pod::Spec.new do |s|
s.source = source
s.source_files = "*.{cpp,h}"
s.compiler_flags = folly_compiler_flags + ' ' + boost_compiler_flags
s.pod_target_xcconfig = { "HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/boost-for-react-native\" \"$(PODS_ROOT)/Folly\"" }
s.header_dir = "jsireact"
s.pod_target_xcconfig = { "HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/boost-for-react-native\" \"$(PODS_ROOT)/Folly\" \"$(PODS_ROOT)/DoubleConversion\"" }
s.xcconfig = { "OTHER_CFLAGS" => "$(inherited) -DRN_TURBO_MODULE_ENABLED" }

s.dependency "React-Core", version
s.dependency "React-Core/CxxBridge", version
s.dependency "React-cxxreact", version
s.dependency "React-jsi", version
s.dependency "Folly", folly_version
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,16 @@ Pod::Spec.new do |s|
s.source = source
s.source_files = "*.{cpp,h}"
s.compiler_flags = folly_compiler_flags + ' ' + boost_compiler_flags
s.pod_target_xcconfig = { "HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/boost-for-react-native\" \"$(PODS_ROOT)/Folly\"" }
s.header_dir = "jsireact"
s.pod_target_xcconfig = { "HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/boost-for-react-native\" \"$(PODS_ROOT)/Folly\" \"$(PODS_ROOT)/DoubleConversion\"" }
s.xcconfig = { "OTHER_CFLAGS" => "$(inherited) -DRN_TURBO_MODULE_ENABLED" }

s.dependency "React-Core", version
s.dependency "React-cxxreact", version
s.dependency "React-jsi", version
s.dependency "React-turbomodule-core", version
s.dependency "Folly", folly_version
s.dependency "DoubleConversion"

s.subspec "samples-ios" do |ss|
ss.source_files = "platform/ios/*.{mm,cpp,h}"
Expand Down
2 changes: 1 addition & 1 deletion ReactCommon/yoga/yoga.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ Pod::Spec.new do |spec|
source_files = File.join('ReactCommon/yoga', source_files) if ENV['INSTALL_YOGA_WITHOUT_PATH_OPTION']
spec.source_files = source_files

header_files = 'yoga/{Yoga,YGEnums,YGMacros,YGValue,YGStyle,CompactValue,YGFloatOptional,Yoga-internal,YGNode,YGConfig,YGLayout,YGMarker}.h'
header_files = 'yoga/{Yoga,YGEnums,YGMacros,YGValue}.h'
header_files = File.join('ReactCommon/yoga', header_files) if ENV['INSTALL_YOGA_WITHOUT_PATH_OPTION']
spec.public_header_files = header_files
end

0 comments on commit 6ef9106

Please sign in to comment.