Include CSSLayout.h consistently with other project includes

Summary:
Include CSSLayout headers in the same way as other project headers, ie `#import <CSSLayout/CSSLayout.h>` becomes `#import "CSSLayout.h"`. CSSLayout is not a framework or system dependency, so shouldn't (AFAIK) be included with angle brackets. Doing so breaks framework builds, such as when RN is used as a pod in a swift project.

In combination with https://github.com/facebook/css-layout/pull/217 this fixes https://github.com/facebook/react-native/issues/9014 (specifically swift cocoapods projects). There is then no need for a separate CSSLayout pod subspec.

Tests run on the RN project in isolation (with changes inside `CSSLayout` itself also applied) and against a dummy swift project with RN included as a pod.

NB: This effectively reverts https://github.com/facebook/react-native/pull/9015 and may break non-swift cocoapods projects unless https://github.com/facebook/css-layout/pull/217 is merged and synced first.

Update: As discussed with alloy and emilsjolander, wrap these imports in a preprocess
Closes https://github.com/facebook/react-native/pull/9544

Differential Revision: D3821791

Pulled By: javache

fbshipit-source-id: d27ac8be9ce560d03479b43d3db740cd196c24da
This commit is contained in:
rh389 2016-09-06 09:12:42 -07:00 committed by Facebook Github Bot 2
parent 4647b62f4d
commit 6e216d2034
5 changed files with 25 additions and 7 deletions

View File

@ -9,7 +9,13 @@
#import "RCTTextManager.h" #import "RCTTextManager.h"
//Internally we reference a separate library. See https://github.com/facebook/react-native/pull/9544
#if __has_include(<CSSLayout/CSSLayout.h>)
#import <CSSLayout/CSSLayout.h> #import <CSSLayout/CSSLayout.h>
#else
#import "CSSLayout.h"
#endif
#import "RCTAccessibilityManager.h" #import "RCTAccessibilityManager.h"
#import "RCTAssert.h" #import "RCTAssert.h"
#import "RCTConvert.h" #import "RCTConvert.h"

View File

@ -29,9 +29,8 @@ Pod::Spec.new do |s|
s.preserve_paths = "cli.js", "Libraries/**/*.js", "lint", "linter.js", "node_modules", "package.json", "packager", "PATENTS", "react-native-cli" s.preserve_paths = "cli.js", "Libraries/**/*.js", "lint", "linter.js", "node_modules", "package.json", "packager", "PATENTS", "react-native-cli"
s.subspec 'Core' do |ss| s.subspec 'Core' do |ss|
ss.dependency 'React/CSSLayout'
ss.source_files = "React/**/*.{c,h,m,mm,S}" ss.source_files = "React/**/*.{c,h,m,mm,S}"
ss.exclude_files = "**/__tests__/*", "IntegrationTests/*", "React/CSSLayout/*" ss.exclude_files = "**/__tests__/*", "IntegrationTests/*"
ss.frameworks = "JavaScriptCore" ss.frameworks = "JavaScriptCore"
ss.libraries = "stdc++" ss.libraries = "stdc++"
ss.pod_target_xcconfig = { "CLANG_CXX_LANGUAGE_STANDARD" => "c++14" } ss.pod_target_xcconfig = { "CLANG_CXX_LANGUAGE_STANDARD" => "c++14" }
@ -43,11 +42,6 @@ Pod::Spec.new do |s|
ss.preserve_paths = "Libraries/ART/**/*.js" ss.preserve_paths = "Libraries/ART/**/*.js"
end end
s.subspec 'CSSLayout' do |ss|
ss.source_files = "React/CSSLayout/**/*.{c,h}"
ss.header_mappings_dir = "React"
end
s.subspec 'RCTActionSheet' do |ss| s.subspec 'RCTActionSheet' do |ss|
ss.dependency 'React/Core' ss.dependency 'React/Core'
ss.source_files = "Libraries/ActionSheetIOS/*.{h,m}" ss.source_files = "Libraries/ActionSheetIOS/*.{h,m}"

View File

@ -10,7 +10,13 @@
#import <QuartzCore/QuartzCore.h> #import <QuartzCore/QuartzCore.h>
#import <UIKit/UIKit.h> #import <UIKit/UIKit.h>
//Internally we reference a separate library. See https://github.com/facebook/react-native/pull/9544
#if __has_include(<CSSLayout/CSSLayout.h>)
#import <CSSLayout/CSSLayout.h> #import <CSSLayout/CSSLayout.h>
#else
#import "CSSLayout.h"
#endif
#import "RCTAnimationType.h" #import "RCTAnimationType.h"
#import "RCTBorderStyle.h" #import "RCTBorderStyle.h"
#import "RCTTextDecorationLineType.h" #import "RCTTextDecorationLineType.h"

View File

@ -11,7 +11,13 @@
#import <AVFoundation/AVFoundation.h> #import <AVFoundation/AVFoundation.h>
//Internally we reference a separate library. See https://github.com/facebook/react-native/pull/9544
#if __has_include(<CSSLayout/CSSLayout.h>)
#import <CSSLayout/CSSLayout.h> #import <CSSLayout/CSSLayout.h>
#else
#import "CSSLayout.h"
#endif
#import "RCTAccessibilityManager.h" #import "RCTAccessibilityManager.h"
#import "RCTAnimationType.h" #import "RCTAnimationType.h"
#import "RCTAssert.h" #import "RCTAssert.h"

View File

@ -9,7 +9,13 @@
#import <UIKit/UIKit.h> #import <UIKit/UIKit.h>
//Internally we reference a separate library. See https://github.com/facebook/react-native/pull/9544
#if __has_include(<CSSLayout/CSSLayout.h>)
#import <CSSLayout/CSSLayout.h> #import <CSSLayout/CSSLayout.h>
#else
#import "CSSLayout.h"
#endif
#import "RCTComponent.h" #import "RCTComponent.h"
#import "RCTRootView.h" #import "RCTRootView.h"