1load("//tools/build_defs/oss:rn_defs.bzl", "ANDROID", "APPLE", "FBJNI_TARGET", "get_objc_arc_preprocessor_flags", "get_preprocessor_flags_for_build_mode", "get_static_library_ios_flags", "react_native_dep", "react_native_target", "react_native_xplat_target", "rn_android_library", "rn_xplat_cxx_library", "subdir_glob")
2
3oncall("react_native")
4
5rn_xplat_cxx_library(
6    name = "samples",
7    srcs = glob(
8        ["ReactCommon/**/*.cpp"],
9    ),
10    header_namespace = "",
11    exported_headers = subdir_glob(
12        [
13            ("ReactCommon", "*.h"),
14        ],
15        prefix = "ReactCommon",
16    ),
17    compiler_flags_pedantic = True,
18    fbandroid_deps = [
19        react_native_target("jni/react/jni:jni"),
20        FBJNI_TARGET,
21    ],
22    fbandroid_exported_headers = subdir_glob(
23        [
24            ("platform/android/ReactCommon", "*.h"),
25        ],
26        prefix = "ReactCommon",
27    ),
28    fbandroid_srcs = glob(
29        [
30            "platform/android/**/*.cpp",
31        ],
32    ),
33    fbobjc_compiler_flags = [
34        "-fobjc-arc-exceptions",
35    ],
36    fbobjc_inherited_buck_flags = get_static_library_ios_flags(),
37    fbobjc_preprocessor_flags = get_objc_arc_preprocessor_flags() + get_preprocessor_flags_for_build_mode(),
38    force_static = True,
39    ios_deps = [
40        "//xplat/FBBaseLite:FBBaseLite",
41        "//xplat/js/react-native-github:RCTCxxBridge",
42        "//xplat/js/react-native-github:RCTCxxModule",
43        "//xplat/js/react-native-github:RCTLinking",
44        "//xplat/js/react-native-github:RCTPushNotification",
45        "//xplat/js/react-native-github:ReactInternal",
46    ],
47    ios_exported_headers = subdir_glob(
48        [
49            ("platform/ios/ReactCommon", "*.h"),
50        ],
51        prefix = "ReactCommon",
52    ),
53    ios_frameworks = [
54        "$SDKROOT/System/Library/Frameworks/Foundation.framework",
55    ],
56    ios_srcs = glob(
57        [
58            "platform/ios/**/*.cpp",
59            "platform/ios/**/*.mm",
60        ],
61    ),
62    labels = [
63        "pfh:ReactNative_CommonInfrastructurePlaceholder",
64    ],
65    platforms = (ANDROID, APPLE),
66    preprocessor_flags = [
67        "-DLOG_TAG=\"ReactNative\"",
68        "-DWITH_FBSYSTRACE=1",
69    ],
70    visibility = [
71        "PUBLIC",
72    ],
73    deps = [
74        react_native_xplat_target("cxxreact:module"),
75    ],
76    exported_deps = [
77        "//xplat/jsi:jsi",
78        react_native_xplat_target("react/nativemodule/core:core"),
79    ],
80)
81
82rn_android_library(
83    name = "impl",
84    srcs = glob(["platform/android/*.java"]),
85    autoglob = False,
86    language = "JAVA",
87    required_for_source_only_abi = True,
88    visibility = [
89        "PUBLIC",
90    ],
91    deps = [
92        "//fbandroid/java/com/facebook/debug/log:log",
93        react_native_dep("third-party/java/jsr-305:jsr-305"),
94        react_native_dep("third-party/java/jsr-330:jsr-330"),
95        react_native_target("java/com/facebook/react/bridge:bridge"),
96        react_native_target("java/com/facebook/react/common:common"),
97        react_native_target("java/com/facebook/react/module/annotations:annotations"),
98        ":samples",
99    ],
100    exported_deps = [
101        react_native_target("java/com/facebook/react/turbomodule/core/interfaces:interfaces"),
102    ],
103)
104