Skip to content

Commit 8131b7b

Browse files
jtreanorfacebook-github-bot
authored andcommitted
CocoaPods frameworks compatibility: Step 2 (#25619)
Summary: This is my proposal for fixing `use_frameworks!` compatibility without breaking all `<React/*>` imports I outlined in #25393 (comment). If accepted, it will fix #25349. It builds on the changes I made in #25496 by ensuring each podspec has a unique value for `header_dir` so that framework imports do not conflict. Every podspec which should be included in the `<React/*>` namespace now includes it's headers from `React-Core.podspec`. The following pods can still be imported with `<React/*>` and so should not have breaking changes: `React-ART`,`React-DevSupport`, `React-CoreModules`, `React-RCTActionSheet`, `React-RCTAnimation`, `React-RCTBlob`, `React-RCTImage`, `React-RCTLinking`, `React-RCTNetwork`, `React-RCTPushNotification`, `React-RCTSettings`, `React-RCTText`, `React-RCTSettings`, `React-RCTVibration`, `React-RCTWebSocket` . There are still a few breaking changes which I hope will be acceptable: - `React-Core.podspec` has been moved to the root of the project. Any `Podfile` that references it will need to update the path. - ~~`React-turbomodule-core`'s headers now live under `<turbomodule/*>`~~ Replaced by #25619 (comment). - ~~`React-turbomodulesamples`'s headers now live under `<turbomodulesamples/*>`~~ Replaced by #25619 (comment). - ~~`React-TypeSaferty`'s headers now live under `<TypeSafety/*>`~~ Replaced by #25619 (comment). - ~~`React-jscallinvoker`'s headers now live under `<jscallinvoker/*>`~~ Replaced by #25619 (comment). - Each podspec now uses `s.static_framework = true`. This means that a minimum of CocoaPods 1.5 ([released in April 2018](http://blog.cocoapods.org/CocoaPods-1.5.0/)) is now required. This is needed so that the ` __has_include` conditions can still work when frameworks are enabled. Still to do: - ~~Including `React-turbomodule-core` with `use_frameworks!` enabled causes the C++ import failures we saw in #25349. I'm sure it will be possible to fix this but I need to dig deeper (perhaps a custom modulemap would be needed).~~ Addressed by 3357351. - I haven't got Fabric working yet. I wonder if it would be acceptable to move Fabric out of the `<React/*>` namespace since it is new? � ## Changelog [iOS] [Fixed] - Fixed compatibility with CocoaPods frameworks. Pull Request resolved: #25619 Test Plan: ### FB ``` buck build catalyst ``` ### Sample Project Everything should work exactly as before, where `use_frameworks!` is not in `Podfile`s. I have a branch on my [sample project](https://github.com/jtreanor/react-native-cocoapods-frameworks) here which has `use_frameworks!` in its `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 fix-frameworks-subspecs` 3. `cd ios && pod install` 4. `cd .. && react-native run-ios` The sample app will build and run successfully. To see that it still works without frameworks, remove `use_frameworks!` from the `Podfile` and do steps 3 and 4 again. ### RNTesterPods `RNTesterPodsPods` can now work with or without `use_frameworks!`. 1. Go to the `RNTester` directory and run `pod install`. 2. Run the tests in `RNTesterPods.xcworkspace` to see that everything still works fine. 3. Uncomment the `use_frameworks!` line at the top of `RNTester/Podfile` and run `pod install` again. 4. Run the tests again and see that it still works with frameworks enabled. Reviewed By: PeteTheHeat Differential Revision: D16465247 Pulled By: PeteTheHeat fbshipit-source-id: cad837e9cced06d30cc5b372af1c65c7780b9e7a
1 parent 7244bae commit 8131b7b

File tree

150 files changed

+561
-500
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

150 files changed

+561
-500
lines changed

Libraries/ART/ARTGroup.m

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* LICENSE file in the root directory of this source tree.
66
*/
77

8-
#import "ARTGroup.h"
8+
#import <React/ARTGroup.h>
99

1010
@implementation ARTGroup
1111

Libraries/ART/ARTNode.m

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
* LICENSE file in the root directory of this source tree.
66
*/
77

8-
#import "ARTNode.h"
8+
#import <React/ARTNode.h>
99

10-
#import "ARTContainer.h"
10+
#import <React/ARTContainer.h>
1111

1212
@implementation ARTNode
1313

Libraries/ART/ARTRenderable.m

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* LICENSE file in the root directory of this source tree.
66
*/
77

8-
#import "ARTRenderable.h"
8+
#import <React/ARTRenderable.h>
99

1010
@implementation ARTRenderable
1111

Libraries/ART/ARTShape.m

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* LICENSE file in the root directory of this source tree.
66
*/
77

8-
#import "ARTShape.h"
8+
#import <React/ARTShape.h>
99

1010
@implementation ARTShape
1111

Libraries/ART/ARTSurfaceView.m

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
55
* LICENSE file in the root directory of this source tree.
66
*/
77

8-
#import "ARTSurfaceView.h"
8+
#import <React/ARTSurfaceView.h>
99

1010
#import <React/RCTLog.h>
1111

12-
#import "ARTNode.h"
12+
#import <React/ARTNode.h>
1313

1414
@implementation ARTSurfaceView
1515

Libraries/ART/ARTText.m

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* LICENSE file in the root directory of this source tree.
66
*/
77

8-
#import "ARTText.h"
8+
#import <React/ARTText.h>
99

1010
#import <CoreText/CoreText.h>
1111

Libraries/ART/Brushes/ARTBrush.m

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* LICENSE file in the root directory of this source tree.
66
*/
77

8-
#import "ARTBrush.h"
8+
#import <React/ARTBrush.h>
99

1010
#import <React/RCTDefines.h>
1111

Libraries/ART/Brushes/ARTLinearGradient.m

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* LICENSE file in the root directory of this source tree.
66
*/
77

8-
#import "ARTLinearGradient.h"
8+
#import <React/ARTLinearGradient.h>
99

1010
#import <React/RCTLog.h>
1111

Libraries/ART/Brushes/ARTPattern.m

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* LICENSE file in the root directory of this source tree.
66
*/
77

8-
#import "ARTPattern.h"
8+
#import <React/ARTPattern.h>
99

1010
#import <React/RCTLog.h>
1111

Libraries/ART/Brushes/ARTRadialGradient.m

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* LICENSE file in the root directory of this source tree.
66
*/
77

8-
#import "ARTRadialGradient.h"
8+
#import <React/ARTRadialGradient.h>
99

1010
#import <React/RCTLog.h>
1111

Libraries/ART/Brushes/ARTSolidColor.m

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* LICENSE file in the root directory of this source tree.
66
*/
77

8-
#import "ARTSolidColor.h"
8+
#import <React/ARTSolidColor.h>
99

1010
#import <React/RCTLog.h>
1111

Libraries/ART/RCTConvert+ART.m

+4-4
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@
1010
#import <React/RCTFont.h>
1111
#import <React/RCTLog.h>
1212

13-
#import "ARTLinearGradient.h"
14-
#import "ARTPattern.h"
15-
#import "ARTRadialGradient.h"
16-
#import "ARTSolidColor.h"
13+
#import <React/ARTLinearGradient.h>
14+
#import <React/ARTPattern.h>
15+
#import <React/ARTRadialGradient.h>
16+
#import <React/ARTSolidColor.h>
1717

1818
@implementation RCTConvert (ART)
1919

Libraries/ART/React-ART.podspec

+4-3
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,10 @@ Pod::Spec.new do |s|
2626
s.author = "Facebook, Inc. and its affiliates"
2727
s.platforms = { :ios => "9.0", :tvos => "9.2" }
2828
s.source = source
29-
s.source_files = "**/*.{h,m}"
29+
s.source_files = "**/*.{m}"
3030
s.preserve_paths = "package.json", "LICENSE", "LICENSE-docs"
31-
s.header_dir = "React"
31+
s.header_dir = "ART"
32+
s.static_framework = true
3233

33-
s.dependency "React-Core", version
34+
s.dependency "React-Core/ARTHeaders", version
3435
end

Libraries/ART/ViewManagers/ARTGroupManager.m

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
* LICENSE file in the root directory of this source tree.
66
*/
77

8-
#import "ARTGroupManager.h"
8+
#import <React/ARTGroupManager.h>
99

10-
#import "ARTGroup.h"
10+
#import <React/ARTGroup.h>
1111
#import "RCTConvert+ART.h"
1212

1313
@implementation ARTGroupManager

Libraries/ART/ViewManagers/ARTNodeManager.m

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
* LICENSE file in the root directory of this source tree.
66
*/
77

8-
#import "ARTNodeManager.h"
8+
#import <React/ARTNodeManager.h>
99

10-
#import "ARTNode.h"
10+
#import <React/ARTNode.h>
1111

1212
@implementation ARTNodeManager
1313

Libraries/ART/ViewManagers/ARTRenderableManager.m

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* LICENSE file in the root directory of this source tree.
66
*/
77

8-
#import "ARTRenderableManager.h"
8+
#import <React/ARTRenderableManager.h>
99

1010
#import "RCTConvert+ART.h"
1111

Libraries/ART/ViewManagers/ARTShapeManager.m

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
* LICENSE file in the root directory of this source tree.
66
*/
77

8-
#import "ARTShapeManager.h"
8+
#import <React/ARTShapeManager.h>
99

10-
#import "ARTShape.h"
10+
#import <React/ARTShape.h>
1111
#import "RCTConvert+ART.h"
1212

1313
@implementation ARTShapeManager

Libraries/ART/ViewManagers/ARTSurfaceViewManager.m

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
* LICENSE file in the root directory of this source tree.
66
*/
77

8-
#import "ARTSurfaceViewManager.h"
8+
#import <React/ARTSurfaceViewManager.h>
99

10-
#import "ARTSurfaceView.h"
10+
#import <React/ARTSurfaceView.h>
1111

1212
@implementation ARTSurfaceViewManager
1313

Libraries/ART/ViewManagers/ARTTextManager.m

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
* LICENSE file in the root directory of this source tree.
66
*/
77

8-
#import "ARTTextManager.h"
8+
#import <React/ARTTextManager.h>
99

10-
#import "ARTText.h"
10+
#import <React/ARTText.h>
1111
#import "RCTConvert+ART.h"
1212

1313
@implementation ARTTextManager

Libraries/ActionSheetIOS/RCTActionSheetManager.m

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* LICENSE file in the root directory of this source tree.
66
*/
77

8-
#import "RCTActionSheetManager.h"
8+
#import <React/RCTActionSheetManager.h>
99

1010
#import <React/RCTBridge.h>
1111
#import <React/RCTConvert.h>

Libraries/ActionSheetIOS/React-RCTActionSheet.podspec

+4-3
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,10 @@ Pod::Spec.new do |s|
2727
s.author = "Facebook, Inc. and its affiliates"
2828
s.platforms = { :ios => "9.0", :tvos => "9.2" }
2929
s.source = source
30-
s.source_files = "*.{h,m}"
30+
s.source_files = "*.{m}"
3131
s.preserve_paths = "package.json", "LICENSE", "LICENSE-docs"
32-
s.header_dir = "React"
32+
s.header_dir = "RCTActionSheet"
33+
s.static_framework = true
3334

34-
s.dependency "React-Core", version
35+
s.dependency "React-Core/RCTActionSheetHeaders", version
3536
end

Libraries/Blob/RCTBlobCollector.mm

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
#import "RCTBlobCollector.h"
99

1010
#import <React/RCTBridge+Private.h>
11-
#import "RCTBlobManager.h"
11+
#import <React/RCTBlobManager.h>
1212

1313
namespace facebook {
1414
namespace react {

Libraries/Blob/RCTBlobManager.mm

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* LICENSE file in the root directory of this source tree.
66
*/
77

8-
#import "RCTBlobManager.h"
8+
#import <React/RCTBlobManager.h>
99

1010
#import <mutex>
1111

Libraries/Blob/RCTFileReaderModule.m

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@
66
*/
77

88

9-
#import "RCTFileReaderModule.h"
9+
#import <React/RCTFileReaderModule.h>
1010

1111
#import <React/RCTBridge.h>
1212
#import <React/RCTConvert.h>
1313

14-
#import "RCTBlobManager.h"
14+
#import <React/RCTBlobManager.h>
1515

1616

1717
@implementation RCTFileReaderModule

Libraries/Blob/React-RCTBlob.podspec

+6-3
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,14 @@ Pod::Spec.new do |s|
2626
s.author = "Facebook, Inc. and its affiliates"
2727
s.platforms = { :ios => "9.0", :tvos => "9.2" }
2828
s.source = source
29-
s.source_files = "*.{h,m,mm}"
29+
# RCTBlobCollector.h is not included in the React module as it has C++ code
30+
s.source_files = "*.{m,mm}", "RCTBlobCollector.h"
3031
s.preserve_paths = "package.json", "LICENSE", "LICENSE-docs"
31-
s.header_dir = "React"
32+
s.header_dir = "RCTBlob"
33+
s.static_framework = true
3234

33-
s.dependency "React-Core", version
35+
s.dependency "React-Core/RCTBlobHeaders", version
3436
s.dependency "React-RCTNetwork", version
3537
s.dependency "React-RCTWebSocket", version
38+
s.dependency "React-jsi", version
3639
end

Libraries/FBLazyVector/FBLazyVector.podspec

+1
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,5 @@ Pod::Spec.new do |s|
2828
s.source = source
2929
s.source_files = "**/*.{c,h,m,mm,cpp}"
3030
s.header_dir = "FBLazyVector"
31+
3132
end

Libraries/FBReactNativeSpec/FBReactNativeSpec.podspec

+1
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ Pod::Spec.new do |s|
3232
s.source = source
3333
s.source_files = "**/*.{c,h,m,mm,cpp}"
3434
s.header_dir = "FBReactNativeSpec"
35+
s.static_framework = true
3536

3637
s.pod_target_xcconfig = {
3738
"USE_HEADERMAP" => "YES",

Libraries/Image/RCTAnimatedImage.m

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*/
77

88
#import <ImageIO/ImageIO.h>
9-
#import "RCTAnimatedImage.h"
9+
#import <React/RCTAnimatedImage.h>
1010

1111
@interface RCTGIFCoderFrame : NSObject
1212

Libraries/Image/RCTGIFImageDecoder.m

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@
55
* LICENSE file in the root directory of this source tree.
66
*/
77

8-
#import "RCTGIFImageDecoder.h"
8+
#import <React/RCTGIFImageDecoder.h>
99

1010
#import <ImageIO/ImageIO.h>
1111
#import <QuartzCore/QuartzCore.h>
1212

1313
#import <React/RCTUtils.h>
14-
#import "RCTAnimatedImage.h"
14+
#import <React/RCTAnimatedImage.h>
1515

1616
@implementation RCTGIFImageDecoder
1717

Libraries/Image/RCTImageBlurUtils.m

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* LICENSE file in the root directory of this source tree.
66
*/
77

8-
#import "RCTImageBlurUtils.h"
8+
#import <React/RCTImageBlurUtils.h>
99

1010
UIImage *RCTBlurredImageWithRadius(UIImage *inputImage, CGFloat radius)
1111
{

Libraries/Image/RCTImageCache.m

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* LICENSE file in the root directory of this source tree.
66
*/
77

8-
#import "RCTImageCache.h"
8+
#import <React/RCTImageCache.h>
99

1010
#import <objc/runtime.h>
1111

@@ -16,7 +16,7 @@
1616
#import <React/RCTUtils.h>
1717
#import <React/RCTResizeMode.h>
1818

19-
#import "RCTImageUtils.h"
19+
#import <React/RCTImageUtils.h>
2020

2121
static const NSUInteger RCTMaxCachableDecodedImageSizeInBytes = 2097152; // 2 MB
2222

Libraries/Image/RCTImageEditingManager.m

+4-4
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,17 @@
55
* LICENSE file in the root directory of this source tree.
66
*/
77

8-
#import "RCTImageEditingManager.h"
8+
#import <React/RCTImageEditingManager.h>
99

1010
#import <UIKit/UIKit.h>
1111

1212
#import <React/RCTConvert.h>
1313
#import <React/RCTLog.h>
1414
#import <React/RCTUtils.h>
1515

16-
#import "RCTImageLoader.h"
17-
#import "RCTImageStoreManager.h"
18-
#import "RCTImageUtils.h"
16+
#import <React/RCTImageLoader.h>
17+
#import <React/RCTImageStoreManager.h>
18+
#import <React/RCTImageUtils.h>
1919

2020
@implementation RCTImageEditingManager
2121

Libraries/Image/RCTImageLoader.m

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
#import <React/RCTNetworking.h>
1818
#import <React/RCTUtils.h>
1919

20-
#import "RCTImageCache.h"
21-
#import "RCTImageUtils.h"
20+
#import <React/RCTImageCache.h>
21+
#import <React/RCTImageUtils.h>
2222

2323
static NSInteger RCTImageBytesForImage(UIImage *image)
2424
{

Libraries/Image/RCTImageShadowView.m

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* LICENSE file in the root directory of this source tree.
66
*/
77

8-
#import "RCTImageShadowView.h"
8+
#import <React/RCTImageShadowView.h>
99

1010
#import <React/RCTLog.h>
1111

0 commit comments

Comments
 (0)