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