Skip to content

Commit

Permalink
CocoaPods frameworks compatibility: Step 1 (facebook#25496)
Browse files Browse the repository at this point in the history
Summary:
This is the first step towards fixing facebook#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 facebook#25393 as suggested by fkgozali in facebook#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.

[iOS] [Fixed] - Updated podspecs for improved compatibility with different install types.
Pull Request resolved: facebook#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 TMomemt committed Aug 2, 2019
1 parent eec4dc6 commit 1f66f33
Show file tree
Hide file tree
Showing 10 changed files with 71 additions and 35 deletions.
74 changes: 48 additions & 26 deletions RNTester/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,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-cxxreact (1000.0.0):
Expand Down Expand Up @@ -90,23 +107,25 @@ PODS:
- React-fishhook (= 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-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-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 @@ -208,30 +227,33 @@ SPEC CHECKSUMS:
DoubleConversion: 5805e889d232975c086db112ece9ed034df7a0b2
Folly: 30e7936e1c45c08d884aa59369ed951a8e68cf51
glog: 1f3da668190260b06b429bb211bfbee5cd790c28
React: e7b61c9123f89c4cd9becea2122af02568be6e13
React-ART: 3dba78ec04b585a82456d1df4bda7a08dbc83a8d
React-Core: d1c3aa4b1c5c57bf839de3c83396b59c1efbf1ba
React-cxxreact: 5f2b678adbe8ff5256801603e1b496e481bc2430
React-DevSupport: 9bde3ce4f7707d9487759101ea3188f4f07c9003
React-fishhook: a9a43c2c84ab2519809810bcdd363e2774007c69
React-jsi: cdf32eb002ff3e243364a1abb71925e0e93003db
React-jsiexecutor: 6e53c44a5371297f0c9cc39780f12cb3efba3b81
React-jsinspector: 2f42a591151e828d0422cbd3b609eedcb920d58e
React-RCTActionSheet: 4ad4bfac1ba9ec020edf278362855448d607cafd
React-RCTAnimation: f050e9fbe85e5616f74cea7a2557bdfb6be73cee
React-RCTBlob: 9f907aab3417a43bbda84aef76f88ee528e877d4
React-RCTCameraRoll: 288b1007d8e540771b917f89d7d99118a3477ee1
React-RCTImage: 4234a754ebdb922416f5f77cff121c680fd3ccbe
React-RCTLinking: 3a52500942cc73999df19f541b7bda5887c3c43d
React-RCTNetwork: 2042d2648e1160770ac0e5068bb5b648c03296a5
React-RCTPushNotification: 3cfbf863d0597b5da80a15c9a9285a0ad89b23ba
React-RCTSettings: 8099c9d904c0fbe46c463de8791478b5bc72809e
React-RCTText: c4a643a08fce4727316366fea5ad17fa14f72f54
React-RCTVibration: c5933466242187bffe55fa5496f841e04db66c8a
React-RCTWebSocket: 233c66a6394de3816ee46861bbe0dba9f83e45a0
React-turbomodule-core: 7ae77c38b85f6f81be40c0c3dc456d3a5fda4797
React-turbomodule-samples: 483f2c80e81b89197737828405a0ac27c77f58b5
yoga: 56698cdff46e3dbb7aa71fd2fd7dc0ce650dc0fb
RCTRequired: 33f3b89d2d82ef01c02b9b4f8146c43762e509d8
React: 7c652b87c228731c51ab5764de68b6c17e6342be
React-ART: 28f8815acbbc4816cec14866b59911a83eb780ed
React-Core: b85f6553c4b2a31e7d71234c28b51bb928a00cbd
React-CoreModules: 04ea22808b22232b251d462f3309ab1150e3b7dd
React-cxxreact: 7c4242192149ce0205b53efaa03e3bf86ba4337c
React-DevSupport: f34768e3aad3e59ee9800c752a78bc6cb24d0f75
React-jscallinvoker: e730f2eca4cb27830af459c0a9af00ac6691bf4c
React-jsi: 98d1f9d8a79d2720ba6a44c2d928a77f315b7e4f
React-jsiexecutor: c0ab8c80a6e88380d63f583690a50d4a723b47b5
React-jsinspector: ea0a218071a11c3687cef2480580180caa6a64c0
React-RCTActionSheet: caf6532394bdbbe0fc0ec2363c84f26bcfcdd36a
React-RCTAnimation: b324c6eb699637c735650c6180e13d003eeb0e56
React-RCTBlob: 069290c8db758bb1d77523a06d117dd668b6cef3
React-RCTImage: 012d845d919177e2726743ad06052dda66592760
React-RCTLinking: c6fe7b82bed97ce72203b2ce2f4aac87b1e2647f
React-RCTNetwork: 2a2b22a17cd965de53ba21c5ca392d0da84ef322
React-RCTPushNotification: 13729b4a2b63b191f42ba7230a69f462f3b5a7f9
React-RCTSettings: e36d7f7d566b80d4363176c2f76cc5eccfdd0ae1
React-RCTTest: 59213db38d80ff3bf4ff068d6127688687c3d349
React-RCTText: 469ec754592c92fc639825e558908c2f0e783e2c
React-RCTVibration: ade3c169b54f3bc16c9a9918e17e48ef66aee6ba
React-RCTWebSocket: cb5317e9a4adc37191660f819fb21d63433584ef
React-turbomodule-core: 5cce62fb65bd0b19f249bc1c4c54b82b3cf9a749
React-turbomodule-samples: ef5c144b510530cb108d4bdb8615dc3943a802fd
React-TypeSafety: 1de5a1034398108f4ca866b68489734f8dbb4c44
yoga: b72aa5b3708cc93c5897f8297122d6eba1331e07

PODFILE CHECKSUM: bb578b8286c0068879a41ac092c9690cc3ede523

Expand Down
13 changes: 13 additions & 0 deletions React/React-Core.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,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 @@ -33,7 +33,7 @@ Pod::Spec.new do |s|
s.source_files = "**/*.{cpp,h}"
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 1f66f33

Please sign in to comment.