Skip to content

Commit

Permalink
Include CSSLayout.h consistently with other project includes
Browse files Browse the repository at this point in the history
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 facebook/yoga#217 this fixes #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 #9015 and may break non-swift cocoapods projects unless facebook/yoga#217 is merged and synced first.

Update: As discussed with alloy and emilsjolander, wrap these imports in a preprocess
Closes #9544

Differential Revision: D3821791

Pulled By: javache

fbshipit-source-id: d27ac8be9ce560d03479b43d3db740cd196c24da
  • Loading branch information
robhogan authored and Facebook Github Bot 2 committed Sep 6, 2016
1 parent 4647b62 commit 6e216d2
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 7 deletions.
6 changes: 6 additions & 0 deletions Libraries/Text/RCTTextManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,13 @@

#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>
#else
#import "CSSLayout.h"
#endif

#import "RCTAccessibilityManager.h"
#import "RCTAssert.h"
#import "RCTConvert.h"
Expand Down
8 changes: 1 addition & 7 deletions React.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -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.subspec 'Core' do |ss|
ss.dependency 'React/CSSLayout'
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.libraries = "stdc++"
ss.pod_target_xcconfig = { "CLANG_CXX_LANGUAGE_STANDARD" => "c++14" }
Expand All @@ -43,11 +42,6 @@ Pod::Spec.new do |s|
ss.preserve_paths = "Libraries/ART/**/*.js"
end

s.subspec 'CSSLayout' do |ss|
ss.source_files = "React/CSSLayout/**/*.{c,h}"
ss.header_mappings_dir = "React"
end

s.subspec 'RCTActionSheet' do |ss|
ss.dependency 'React/Core'
ss.source_files = "Libraries/ActionSheetIOS/*.{h,m}"
Expand Down
6 changes: 6 additions & 0 deletions React/Base/RCTConvert.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,13 @@
#import <QuartzCore/QuartzCore.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>
#else
#import "CSSLayout.h"
#endif

#import "RCTAnimationType.h"
#import "RCTBorderStyle.h"
#import "RCTTextDecorationLineType.h"
Expand Down
6 changes: 6 additions & 0 deletions React/Modules/RCTUIManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,13 @@

#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>
#else
#import "CSSLayout.h"
#endif

#import "RCTAccessibilityManager.h"
#import "RCTAnimationType.h"
#import "RCTAssert.h"
Expand Down
6 changes: 6 additions & 0 deletions React/Views/RCTShadowView.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,13 @@

#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>
#else
#import "CSSLayout.h"
#endif

#import "RCTComponent.h"
#import "RCTRootView.h"

Expand Down

0 comments on commit 6e216d2

Please sign in to comment.