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    compiler_flags_pedantic = True,
35    fbandroid_deps = [
36        react_native_xplat_target("react/renderer/mapbuffer:mapbuffer"),
37    ],
38    fbobjc_compiler_flags = APPLE_COMPILER_FLAGS,
39    fbobjc_preprocessor_flags = get_preprocessor_flags_for_build_mode() + get_apple_inspector_flags(),
40    force_static = True,
41    labels = [
42        "pfh:ReactNative_CommonInfrastructurePlaceholder",
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:conv",
56        "//xplat/folly:hash",
57        react_native_xplat_target("react/debug:debug"),
58        react_native_xplat_target("react/renderer/debug:debug"),
59        react_native_xplat_target("react/renderer/core:core"),
60        react_native_xplat_target("react/renderer/graphics:graphics"),
61        react_native_xplat_target("react/renderer/mounting:mounting"),
62        react_native_xplat_target("react/utils:utils"),
63    ],
64)
65
66fb_xplat_cxx_test(
67    name = "tests",
68    srcs = glob(["tests/**/*.cpp"]),
69    headers = glob(["tests/**/*.h"]),
70    compiler_flags = [
71        "-fexceptions",
72        "-frtti",
73        "-std=c++17",
74        "-Wall",
75    ],
76    contacts = ["[email protected]"],
77    fbandroid_use_instrumentation_test = True,
78    platforms = (ANDROID, APPLE, CXX),
79    deps = [
80        ":attributedstring",
81        "//xplat/third-party/gmock:gtest",
82    ],
83)
84