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