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_xplat_target",
12    "rn_xplat_cxx_library",
13    "subdir_glob",
14)
15
16APPLE_COMPILER_FLAGS = get_apple_compiler_flags()
17
18rn_xplat_cxx_library(
19    name = "androidtextinput",
20    srcs = glob(
21        ["androidtextinput/**/*.cpp"],
22        exclude = glob(["tests/**/*.cpp"]),
23    ),
24    headers = glob(
25        ["androidtextinput/**/*.h"],
26        exclude = glob(["tests/**/*.h"]),
27    ),
28    header_namespace = "",
29    exported_headers = subdir_glob(
30        [
31            ("", "*.h"),
32            ("androidtextinput/react/renderer/components/androidtextinput", "*.h"),
33        ],
34        prefix = "react/renderer/components/androidtextinput",
35    ),
36    cxx_tests = [":tests"],
37    fbandroid_deps = [
38        react_native_xplat_target("react/renderer/mapbuffer:mapbuffer"),
39    ],
40    fbobjc_compiler_flags = APPLE_COMPILER_FLAGS,
41    fbobjc_preprocessor_flags = get_preprocessor_flags_for_build_mode() + get_apple_inspector_flags(),
42    force_static = True,
43    labels = [
44        "pfh:ReactNative_CommonInfrastructurePlaceholder",
45        "supermodule:xplat/default/public.react_native.infra",
46    ],
47    platforms = (ANDROID, APPLE, CXX),
48    preprocessor_flags = [
49        "-DLOG_TAG=\"ReactNative\"",
50        "-DWITH_FBSYSTRACE=1",
51    ],
52    visibility = ["PUBLIC"],
53    deps = [
54        "//third-party/glog:glog",
55        "//xplat/fbsystrace:fbsystrace",
56        "//xplat/folly:container_evicting_cache_map",
57        "//xplat/folly:headers_only_do_not_use",
58        "//xplat/folly:memory",
59        "//xplat/folly:molly",
60        YOGA_CXX_TARGET,
61        react_native_xplat_target("react/debug:debug"),
62        react_native_xplat_target("react/renderer/attributedstring:attributedstring"),
63        react_native_xplat_target("react/renderer/core:core"),
64        react_native_xplat_target("react/renderer/debug:debug"),
65        react_native_xplat_target("react/renderer/graphics:graphics"),
66        react_native_xplat_target("react/renderer/textlayoutmanager:textlayoutmanager"),
67        react_native_xplat_target("react/renderer/components/text:text"),
68        react_native_xplat_target("react/renderer/components/view:view"),
69        react_native_xplat_target("react/renderer/components/image:image"),
70        react_native_xplat_target("react/renderer/uimanager:uimanager"),
71        react_native_xplat_target("react/renderer/componentregistry:componentregistry"),
72        react_native_xplat_target("react/renderer/imagemanager:imagemanager"),
73        react_native_xplat_target("react/utils:utils"),
74    ],
75)
76
77fb_xplat_cxx_test(
78    name = "tests",
79    srcs = glob(["tests/**/*.cpp"]),
80    headers = glob(["tests/**/*.h"]),
81    compiler_flags = [
82        "-fexceptions",
83        "-frtti",
84        "-std=c++17",
85        "-Wall",
86    ],
87    contacts = ["[email protected]"],
88    platforms = (
89        # `Apple` and `Android` flavors are disabled because the module depends on `textlayoutmanager` which requires real an Emulator/Simulator to run.
90        #  At the same time, the code of tests does not rely on the simulator capabilities and it would be wasteful to add `fbandroid_use_instrumentation_test = True`.
91        # (Beware of this option though.)
92        # ANDROID,
93        # APPLE,
94        CXX
95    ),
96    deps = [
97        ":androidtextinput",
98        "//xplat/folly:molly",
99        "//xplat/third-party/gmock:gtest",
100    ],
101)
102