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