1load(
2    "//tools/build_defs/oss:rn_defs.bzl",
3    "ANDROID",
4    "APPLE",
5    "CXX",
6    "YOGA_CXX_TARGET",
7    "fb_xplat_cxx_test",
8    "get_apple_compiler_flags",
9    "get_apple_inspector_flags",
10    "get_preprocessor_flags_for_build_mode",
11    "react_native_target",
12    "react_native_xplat_target",
13    "rn_xplat_cxx_library",
14    "subdir_glob",
15)
16
17APPLE_COMPILER_FLAGS = get_apple_compiler_flags()
18
19rn_xplat_cxx_library(
20    name = "textlayoutmanager",
21    srcs = glob(
22        [
23            "*.cpp",
24        ],
25    ),
26    headers = subdir_glob(
27        [
28            ("", "*.h"),
29        ],
30        prefix = "",
31    ),
32    header_namespace = "",
33    exported_headers = subdir_glob(
34        [
35            ("", "*.h"),
36        ],
37        prefix = "react/renderer/textlayoutmanager",
38    ),
39    compiler_flags_pedantic = True,
40    cxx_exported_headers = subdir_glob(
41        [
42            ("platform/cxx", "*.h"),
43        ],
44        prefix = "react/renderer/textlayoutmanager",
45    ),
46    cxx_headers = subdir_glob(
47        [
48            ("platform/cxx", "**/*.h"),
49        ],
50        prefix = "",
51    ),
52    cxx_srcs = glob(
53        [
54            "platform/cxx/**/*.cpp",
55        ],
56    ),
57    cxx_tests = [":tests"],
58    fbandroid_deps = [
59        react_native_target("jni/react/jni:jni"),
60        react_native_xplat_target("react/renderer/mapbuffer:mapbuffer"),
61    ],
62    fbandroid_exported_headers = subdir_glob(
63        [
64            ("platform/android/react/renderer/textlayoutmanager", "**/*.h"),
65        ],
66        prefix = "react/renderer/textlayoutmanager",
67    ),
68    fbandroid_headers = subdir_glob(
69        [
70            ("platform/android/react/renderer/textlayoutmanager", "**/*.h"),
71        ],
72        prefix = "",
73    ),
74    fbandroid_srcs = glob(
75        [
76            "platform/android/react/renderer/textlayoutmanager/**/*.cpp",
77        ],
78    ),
79    fbobjc_compiler_flags = APPLE_COMPILER_FLAGS,
80    fbobjc_preprocessor_flags = get_preprocessor_flags_for_build_mode() + get_apple_inspector_flags(),
81    force_static = True,
82    ios_deps = [
83    ],
84    ios_exported_headers = subdir_glob(
85        [
86            ("platform/ios", "*.h"),
87        ],
88        prefix = "react/renderer/textlayoutmanager",
89    ),
90    ios_frameworks = [
91        "$SDKROOT/System/Library/Frameworks/CoreGraphics.framework",
92        "$SDKROOT/System/Library/Frameworks/Foundation.framework",
93        "$SDKROOT/System/Library/Frameworks/UIKit.framework",
94    ],
95    ios_headers = subdir_glob(
96        [
97            ("platform/ios", "**/*.h"),
98        ],
99        prefix = "",
100    ),
101    ios_srcs = glob(
102        [
103            "platform/ios/**/*.cpp",
104            "platform/ios/**/*.mm",
105        ],
106    ),
107    labels = [
108        "pfh:ReactNative_CommonInfrastructurePlaceholder",
109    ],
110    macosx_tests_override = [],
111    platforms = (ANDROID, APPLE, CXX),
112    preprocessor_flags = [
113        "-DLOG_TAG=\"ReactNative\"",
114        "-DWITH_FBSYSTRACE=1",
115    ],
116    visibility = ["PUBLIC"],
117    deps = [
118        "//third-party/glog:glog",
119        "//xplat/fbsystrace:fbsystrace",
120        YOGA_CXX_TARGET,
121        react_native_xplat_target("react/renderer/attributedstring:attributedstring"),
122        react_native_xplat_target("react/renderer/core:core"),
123        react_native_xplat_target("react/utils:utils"),
124        react_native_xplat_target("react/renderer/debug:debug"),
125        react_native_xplat_target("react/renderer/graphics:graphics"),
126        react_native_xplat_target("react/renderer/uimanager:uimanager"),
127        react_native_xplat_target("react/renderer/mounting:mounting"),
128        react_native_xplat_target("react/renderer/componentregistry:componentregistry"),
129    ],
130)
131
132fb_xplat_cxx_test(
133    name = "tests",
134    srcs = glob(["tests/**/*.cpp"]),
135    headers = glob(["tests/**/*.h"]),
136    compiler_flags = [
137        "-fexceptions",
138        "-frtti",
139        "-std=c++17",
140        "-Wall",
141    ],
142    contacts = ["[email protected]"],
143    platforms = (
144        # `Apple` and `Android` flavors are disabled because the module (built with those flavors) requires Emulator/Simulator (which is expensive and slow). At the same time, we don't really have tests here.
145        # ANDROID,
146        # APPLE,
147        CXX,
148    ),
149    deps = [
150        ":textlayoutmanager",
151        "//xplat/third-party/gmock:gtest",
152    ],
153)
154