Skip to content

Commit

Permalink
[Headers] Add an umbrella header for the library
Browse files Browse the repository at this point in the history
The umbrella header allows projects that link React Native using CocoaPods to import it in standard fashion: `#import <React/React.h>`. Only some headers are included based on what I've found to be useful.

Generated with `scripts/generate-umbrella-header.sh`, which is a script that scans the Base and Executors directories for all headers and also includes some handpicked Views headers as well.
  • Loading branch information
ide committed May 8, 2015
1 parent 4bec3fe commit 2b01eca
Show file tree
Hide file tree
Showing 3 changed files with 100 additions and 0 deletions.
49 changes: 49 additions & 0 deletions React/React.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/**
* Copyright (c) 2015-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/

#import <React/React/Base/RCTAssert.h>
#import <React/React/Base/RCTBridge.h>
#import <React/React/Base/RCTBridgeModule.h>
#import <React/React/Base/RCTCache.h>
#import <React/React/Base/RCTConvert.h>
#import <React/React/Base/RCTDefines.h>
#import <React/React/Base/RCTDevMenu.h>
#import <React/React/Base/RCTEventDispatcher.h>
#import <React/React/Base/RCTFrameUpdate.h>
#import <React/React/Base/RCTInvalidating.h>
#import <React/React/Base/RCTJavaScriptExecutor.h>
#import <React/React/Base/RCTJavaScriptLoader.h>
#import <React/React/Base/RCTJSMethodRegistrar.h>
#import <React/React/Base/RCTKeyCommands.h>
#import <React/React/Base/RCTLog.h>
#import <React/React/Base/RCTProfile.h>
#import <React/React/Base/RCTRedBox.h>
#import <React/React/Base/RCTRootView.h>
#import <React/React/Base/RCTSparseArray.h>
#import <React/React/Base/RCTTouchHandler.h>
#import <React/React/Base/RCTUtils.h>

#import <React/React/Executors/RCTContextExecutor.h>
#import <React/React/Executors/RCTWebViewExecutor.h>

#import <React/React/Modules/RCTExceptionsManager.h>
#import <React/React/Modules/RCTUIManager.h>

#import <React/React/Views/RCTAnimationType.h>
#import <React/React/Views/RCTAutoInsetsProtocol.h>
#import <React/React/Views/RCTConvert+CoreLocation.h>
#import <React/React/Views/RCTConvert+MapKit.h>
#import <React/React/Views/RCTPointerEvents.h>
#import <React/React/Views/RCTScrollableProtocol.h>
#import <React/React/Views/RCTShadowView.h>
#import <React/React/Views/RCTView.h>
#import <React/React/Views/RCTViewControllerProtocol.h>
#import <React/React/Views/RCTViewManager.h>
#import <React/React/Views/RCTViewNodeProtocol.h>
#import <React/React/Views/UIView+React.h>
2 changes: 2 additions & 0 deletions React/React.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@
58114A4F1AAE93D500E7D092 /* RCTAsyncLocalStorage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTAsyncLocalStorage.h; sourceTree = "<group>"; };
58C571BF1AA56C1900CDF9C8 /* RCTDatePickerManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTDatePickerManager.m; sourceTree = "<group>"; };
58C571C01AA56C1900CDF9C8 /* RCTDatePickerManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTDatePickerManager.h; sourceTree = "<group>"; };
78BEE2481ABABC2E00F44561 /* React.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = React.h; sourceTree = "<group>"; };
830213F31A654E0800B993E6 /* RCTBridgeModule.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RCTBridgeModule.h; sourceTree = "<group>"; };
830A229C1A66C68A008503DA /* RCTRootView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTRootView.h; sourceTree = "<group>"; };
830A229D1A66C68A008503DA /* RCTRootView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTRootView.m; sourceTree = "<group>"; };
Expand Down Expand Up @@ -368,6 +369,7 @@
83CBBA2F1A601D0F00E9B192 /* React */ = {
isa = PBXGroup;
children = (
78BEE2481ABABC2E00F44561 /* React.h */,
83CBBA491A601E3B00E9B192 /* Base */,
134FCB381A6E7F0800051CC8 /* Executors */,
13B07FC41A68125100A75B9A /* Layout */,
Expand Down
49 changes: 49 additions & 0 deletions scripts/generate-umbrella-header.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#!/bin/bash

set -e

SCRIPTS=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
ROOT=$(dirname $SCRIPTS)

LIBRARY_NAME="React"
UMBRELLA_HEADER_PATH="${ROOT}/React/${LIBRARY_NAME}.h"

cd $ROOT

LIBRARY_HEADERS="\
$(find React/Base -name "*.h")
$(find React/Executors -name "*.h")
React/Modules/RCTExceptionsManager.h
React/Modules/RCTUIManager.h
React/Views/RCTAnimationType.h
React/Views/RCTAutoInsetsProtocol.h
React/Views/RCTConvert+CoreLocation.h
React/Views/RCTConvert+MapKit.h
React/Views/RCTPointerEvents.h
React/Views/RCTScrollableProtocol.h
React/Views/RCTShadowView.h
React/Views/RCTView.h
React/Views/RCTViewControllerProtocol.h
React/Views/RCTViewManager.h
React/Views/RCTViewNodeProtocol.h
React/Views/UIView+React.h\
"

echo \
"/**
* Copyright (c) 2015-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
$(
echo "${LIBRARY_HEADERS}" |
awk -v lib="${LIBRARY_NAME}" '{if (NF) print "#import <"lib"/"$0">"; else print;}'
)\
" > "${UMBRELLA_HEADER_PATH}"

0 comments on commit 2b01eca

Please sign in to comment.