1load(
2    "//tools/build_defs/oss:rn_defs.bzl",
3    "ANDROID",
4    "fb_xplat_cxx_test",
5    "get_apple_compiler_flags",
6    "get_apple_inspector_flags",
7    "get_preprocessor_flags_for_build_mode",
8    "react_native_xplat_target",
9    "rn_xplat_cxx_library",
10    "subdir_glob",
11)
12
13APPLE_COMPILER_FLAGS = get_apple_compiler_flags()
14
15rn_xplat_cxx_library(
16    name = "mapbuffer",
17    srcs = glob(
18        ["**/*.cpp"],
19        exclude = glob(["tests/**/*.cpp"]),
20    ),
21    headers = glob(
22        ["**/*.h"],
23        exclude = glob(["tests/**/*.h"]),
24    ),
25    header_namespace = "",
26    exported_headers = subdir_glob(
27        [
28            ("", "*.h"),
29        ],
30        prefix = "react/renderer/mapbuffer",
31    ),
32    fbobjc_compiler_flags = APPLE_COMPILER_FLAGS,
33    fbobjc_preprocessor_flags = get_preprocessor_flags_for_build_mode() + get_apple_inspector_flags(),
34    force_static = True,
35    labels = [
36        "pfh:ReactNative_CommonInfrastructurePlaceholder",
37        "supermodule:xplat/default/public.react_native.infra",
38    ],
39    macosx_tests_override = [],
40    platforms = ANDROID,
41    preprocessor_flags = [
42        "-DLOG_TAG=\"ReactNative\"",
43        "-DWITH_FBSYSTRACE=1",
44    ],
45    tests = [":tests"],
46    visibility = ["PUBLIC"],
47    deps = [
48        "//third-party/glog:glog",
49        "//xplat/fbsystrace:fbsystrace",
50        "//xplat/folly:headers_only_do_not_use",
51        "//xplat/folly:memory",
52        react_native_xplat_target("react/debug:debug"),
53    ],
54)
55
56fb_xplat_cxx_test(
57    name = "tests",
58    srcs = glob(["tests/**/*.cpp"]),
59    headers = glob(["tests/**/*.h"]),
60    compiler_flags = [
61        "-fexceptions",
62        "-frtti",
63        "-std=c++17",
64        "-Wall",
65    ],
66    contacts = ["[email protected]"],
67    platforms = ANDROID,
68    deps = [
69        "//xplat/folly:molly",
70        "//xplat/third-party/gmock:gtest",
71        react_native_xplat_target("react/debug:debug"),
72        react_native_xplat_target("react/renderer/mapbuffer:mapbuffer"),
73    ],
74)
75