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    cxx_exported_headers = subdir_glob(
40        [
41            ("platform/cxx", "*.h"),
42        ],
43        prefix = "react/renderer/textlayoutmanager",
44    ),
45    cxx_headers = subdir_glob(
46        [
47            ("platform/cxx", "**/*.h"),
48        ],
49        prefix = "",
50    ),
51    cxx_srcs = glob(
52        [
53            "platform/cxx/**/*.cpp",
54        ],
55    ),
56    cxx_tests = [":tests"],
57    fbandroid_deps = [
58        react_native_target("jni/react/jni:jni"),
59        react_native_xplat_target("react/renderer/mapbuffer:mapbuffer"),
60    ],
61    fbandroid_exported_headers = subdir_glob(
62        [
63            ("platform/android/react/renderer/textlayoutmanager", "**/*.h"),
64        ],
65        prefix = "react/renderer/textlayoutmanager",
66    ),
67    fbandroid_headers = subdir_glob(
68        [
69            ("platform/android/react/renderer/textlayoutmanager", "**/*.h"),
70        ],
71        prefix = "",
72    ),
73    fbandroid_srcs = glob(
74        [
75            "platform/android/react/renderer/textlayoutmanager/**/*.cpp",
76        ],
77    ),
78    fbobjc_compiler_flags = APPLE_COMPILER_FLAGS,
79    fbobjc_preprocessor_flags = get_preprocessor_flags_for_build_mode() + get_apple_inspector_flags(),
80    force_static = True,
81    ios_deps = [
82    ],
83    ios_exported_headers = subdir_glob(
84        [
85            ("platform/ios", "*.h"),
86        ],
87        prefix = "react/renderer/textlayoutmanager",
88    ),
89    ios_frameworks = [
90        "$SDKROOT/System/Library/Frameworks/CoreGraphics.framework",
91        "$SDKROOT/System/Library/Frameworks/Foundation.framework",
92        "$SDKROOT/System/Library/Frameworks/UIKit.framework",
93    ],
94    ios_headers = subdir_glob(
95        [
96            ("platform/ios", "**/*.h"),
97        ],
98        prefix = "",
99    ),
100    ios_srcs = glob(
101        [
102            "platform/ios/**/*.cpp",
103            "platform/ios/**/*.mm",
104        ],
105    ),
106    labels = [
107        "pfh:ReactNative_CommonInfrastructurePlaceholder",
108        "supermodule:xplat/default/public.react_native.infra",
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        "//xplat/folly:headers_only_do_not_use",
121        "//xplat/folly:memory",
122        "//xplat/folly:molly",
123        YOGA_CXX_TARGET,
124        react_native_xplat_target("react/renderer/attributedstring:attributedstring"),
125        react_native_xplat_target("react/renderer/core:core"),
126        react_native_xplat_target("react/utils:utils"),
127        react_native_xplat_target("react/renderer/debug:debug"),
128        react_native_xplat_target("react/renderer/graphics:graphics"),
129        react_native_xplat_target("react/renderer/uimanager:uimanager"),
130        react_native_xplat_target("react/renderer/mounting:mounting"),
131        react_native_xplat_target("react/renderer/componentregistry:componentregistry"),
132    ],
133)
134
135fb_xplat_cxx_test(
136    name = "tests",
137    srcs = glob(["tests/**/*.cpp"]),
138    headers = glob(["tests/**/*.h"]),
139    compiler_flags = [
140        "-fexceptions",
141        "-frtti",
142        "-std=c++17",
143        "-Wall",
144    ],
145    contacts = ["[email protected]"],
146    platforms = (
147        # `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.
148        # ANDROID,
149        # APPLE,
150        CXX,
151    ),
152    deps = [
153        ":textlayoutmanager",
154        "//xplat/folly:molly",
155        "//xplat/third-party/gmock:gtest",
156    ],
157)
158