Skip to content

Commit 020c11c

Browse files
fkgozalifacebook-github-bot
authored andcommitted
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
1 parent c9694f7 commit 020c11c

6 files changed

Lines changed: 74 additions & 7 deletions

File tree

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,10 @@ RNTester/build
7272

7373
# Libs that shouldn't have Xcode project
7474
/Libraries/FBLazyVector/**/*.xcodeproj
75+
/Libraries/FBReactNativeSpec/**/*.xcodeproj
7576
/Libraries/RCTRequired/**/*.xcodeproj
77+
/React/CoreModules/**/*.xcodeproj
78+
/packages/react-native-codegen/**/*.xcodeproj
7679

7780
# CocoaPods
7881
/template/ios/Pods/

React/Base/RCTVersion.h

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,11 @@
88

99
#import <Foundation/Foundation.h>
1010

11-
extern NSString* const RCTVersionMajor;
12-
extern NSString* const RCTVersionMinor;
13-
extern NSString* const RCTVersionPatch;
14-
extern NSString* const RCTVersionPrerelease;
11+
#import <React/RCTDefines.h>
1512

16-
extern NSDictionary* RCTGetReactNativeVersion(void);
13+
RCT_EXTERN NSString* const RCTVersionMajor;
14+
RCT_EXTERN NSString* const RCTVersionMinor;
15+
RCT_EXTERN NSString* const RCTVersionPatch;
16+
RCT_EXTERN NSString* const RCTVersionPrerelease;
17+
18+
RCT_EXTERN NSDictionary* RCTGetReactNativeVersion(void);

React/CoreModules/BUCK

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
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")
2+
load("//tools/build_defs/oss:rn_defs.bzl", "rn_debug_flags", "rn_apple_library", "subdir_glob")
3+
4+
rn_apple_library(
5+
name = "CoreModulesApple",
6+
srcs = glob(
7+
[
8+
"**/*.m",
9+
"**/*.mm",
10+
],
11+
),
12+
headers = glob(
13+
[
14+
"**/*.h",
15+
],
16+
),
17+
header_namespace = "",
18+
exported_headers = subdir_glob(
19+
[
20+
(
21+
"",
22+
"*.h",
23+
),
24+
],
25+
prefix = "React",
26+
),
27+
compiler_flags = [
28+
"-Wno-error=unguarded-availability-new",
29+
"-Wno-unknown-warning-option",
30+
],
31+
contacts = ["oncall+react_native@xmail.facebook.com"],
32+
exported_linker_flags = [
33+
"-weak_framework",
34+
"UserNotifications",
35+
"-weak_framework",
36+
"WebKit",
37+
],
38+
exported_preprocessor_flags = rn_debug_flags(),
39+
frameworks = [
40+
"Foundation",
41+
"UIKit",
42+
],
43+
labels = ["depslint_never_add"],
44+
lang_compiler_flags = get_fbobjc_enable_exception_lang_compiler_flags_DEPRECATED(),
45+
link_whole = True,
46+
platform_preprocessor_flags = [(
47+
"linux",
48+
["-D PIC_MODIFIER=@PLT"],
49+
)],
50+
preprocessor_flags = OBJC_ARC_PREPROCESSOR_FLAGS + get_debug_preprocessor_flags() + rn_debug_flags(),
51+
visibility = ["PUBLIC"],
52+
exported_deps = [
53+
"fbsource//xplat/js/react-native-github:ReactInternalApple",
54+
"fbsource//xplat/js/react-native-github/Libraries/FBReactNativeSpec:FBReactNativeSpecApple",
55+
],
56+
)
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99

1010
#import <UIKit/UIKit.h>
1111

12-
#import "RCTUtils.h"
13-
#import "RCTVersion.h"
12+
#import <React/RCTUtils.h>
13+
#import <React/RCTVersion.h>
1414

1515
static NSString *interfaceIdiom(UIUserInterfaceIdiom idiom) {
1616
switch(idiom) {

tools/build_defs/oss/rn_defs.bzl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,12 @@ def react_native_dep(path):
100100
def react_native_xplat_dep(path):
101101
return "//ReactCommon/" + path
102102

103+
def rn_debug_flags():
104+
return []
105+
106+
def rn_feature_flags():
107+
return []
108+
103109
# React property preprocessor
104110
def rn_android_library(name, deps = [], plugins = [], *args, **kwargs):
105111
if react_native_target(

0 commit comments

Comments
 (0)