iOS Buck: Create CoreModules sub-target

Summary: Right now the entire RN core code lives inside one giant internal Buck target. This makes it hard to refactor the infra and to roll out TurboModules. For now, create a baseline for how RN core dir can be structured.

Reviewed By: PeteTheHeat

Differential Revision: D16001260

fbshipit-source-id: bba947e2fb75576a2e1f3f4c816575f1157dcb03
This commit is contained in:
Kevin Gozali 2019-07-01 15:12:56 -07:00 committed by Facebook Github Bot
parent c9694f75ce
commit 020c11cc7b
6 changed files with 74 additions and 7 deletions

3
.gitignore vendored
View File

@ -72,7 +72,10 @@ RNTester/build
# Libs that shouldn't have Xcode project
/Libraries/FBLazyVector/**/*.xcodeproj
/Libraries/FBReactNativeSpec/**/*.xcodeproj
/Libraries/RCTRequired/**/*.xcodeproj
/React/CoreModules/**/*.xcodeproj
/packages/react-native-codegen/**/*.xcodeproj
# CocoaPods
/template/ios/Pods/

View File

@ -8,9 +8,11 @@
#import <Foundation/Foundation.h>
extern NSString* const RCTVersionMajor;
extern NSString* const RCTVersionMinor;
extern NSString* const RCTVersionPatch;
extern NSString* const RCTVersionPrerelease;
#import <React/RCTDefines.h>
extern NSDictionary* RCTGetReactNativeVersion(void);
RCT_EXTERN NSString* const RCTVersionMajor;
RCT_EXTERN NSString* const RCTVersionMinor;
RCT_EXTERN NSString* const RCTVersionPatch;
RCT_EXTERN NSString* const RCTVersionPrerelease;
RCT_EXTERN NSDictionary* RCTGetReactNativeVersion(void);

56
React/CoreModules/BUCK Normal file
View File

@ -0,0 +1,56 @@
load("@fbsource//tools/build_defs/apple:flag_defs.bzl", "OBJC_ARC_PREPROCESSOR_FLAGS", "get_debug_preprocessor_flags", "get_fbobjc_enable_exception_lang_compiler_flags_DEPRECATED")
load("//tools/build_defs/oss:rn_defs.bzl", "rn_debug_flags", "rn_apple_library", "subdir_glob")
rn_apple_library(
name = "CoreModulesApple",
srcs = glob(
[
"**/*.m",
"**/*.mm",
],
),
headers = glob(
[
"**/*.h",
],
),
header_namespace = "",
exported_headers = subdir_glob(
[
(
"",
"*.h",
),
],
prefix = "React",
),
compiler_flags = [
"-Wno-error=unguarded-availability-new",
"-Wno-unknown-warning-option",
],
contacts = ["oncall+react_native@xmail.facebook.com"],
exported_linker_flags = [
"-weak_framework",
"UserNotifications",
"-weak_framework",
"WebKit",
],
exported_preprocessor_flags = rn_debug_flags(),
frameworks = [
"Foundation",
"UIKit",
],
labels = ["depslint_never_add"],
lang_compiler_flags = get_fbobjc_enable_exception_lang_compiler_flags_DEPRECATED(),
link_whole = True,
platform_preprocessor_flags = [(
"linux",
["-D PIC_MODIFIER=@PLT"],
)],
preprocessor_flags = OBJC_ARC_PREPROCESSOR_FLAGS + get_debug_preprocessor_flags() + rn_debug_flags(),
visibility = ["PUBLIC"],
exported_deps = [
"fbsource//xplat/js/react-native-github:ReactInternalApple",
"fbsource//xplat/js/react-native-github/Libraries/FBReactNativeSpec:FBReactNativeSpecApple",
],
)

View File

@ -9,8 +9,8 @@
#import <UIKit/UIKit.h>
#import "RCTUtils.h"
#import "RCTVersion.h"
#import <React/RCTUtils.h>
#import <React/RCTVersion.h>
static NSString *interfaceIdiom(UIUserInterfaceIdiom idiom) {
switch(idiom) {

View File

@ -100,6 +100,12 @@ def react_native_dep(path):
def react_native_xplat_dep(path):
return "//ReactCommon/" + path
def rn_debug_flags():
return []
def rn_feature_flags():
return []
# React property preprocessor
def rn_android_library(name, deps = [], plugins = [], *args, **kwargs):
if react_native_target(