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    compiler_flags_pedantic = True,
37    cxx_tests = [":tests"],
38    fbandroid_deps = [
39        react_native_xplat_target("react/renderer/mapbuffer:mapbuffer"),
40    ],
41    fbobjc_compiler_flags = APPLE_COMPILER_FLAGS,
42    fbobjc_preprocessor_flags = get_preprocessor_flags_for_build_mode() + get_apple_inspector_flags(),
43    force_static = True,
44    labels = [
45        "pfh:ReactNative_CommonInfrastructurePlaceholder",
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:dynamic",
57        YOGA_CXX_TARGET,
58        react_native_xplat_target("react/debug:debug"),
59        react_native_xplat_target("react/renderer/attributedstring:attributedstring"),
60        react_native_xplat_target("react/renderer/core:core"),
61        react_native_xplat_target("react/renderer/debug:debug"),
62        react_native_xplat_target("react/renderer/graphics:graphics"),
63        react_native_xplat_target("react/renderer/textlayoutmanager:textlayoutmanager"),
64        react_native_xplat_target("react/renderer/components/text:text"),
65        react_native_xplat_target("react/renderer/components/view:view"),
66        react_native_xplat_target("react/renderer/components/image:image"),
67        react_native_xplat_target("react/renderer/uimanager:uimanager"),
68        react_native_xplat_target("react/renderer/componentregistry:componentregistry"),
69        react_native_xplat_target("react/renderer/imagemanager:imagemanager"),
70        react_native_xplat_target("react/utils:utils"),
71    ],
72)
73
74fb_xplat_cxx_test(
75    name = "tests",
76    srcs = glob(["tests/**/*.cpp"]),
77    headers = glob(["tests/**/*.h"]),
78    compiler_flags = [
79        "-fexceptions",
80        "-frtti",
81        "-std=c++17",
82        "-Wall",
83    ],
84    contacts = ["[email protected]"],
85    platforms = (
86        # `Apple` and `Android` flavors are disabled because the module depends on `textlayoutmanager` which requires real an Emulator/Simulator to run.
87        #  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`.
88        # (Beware of this option though.)
89        # ANDROID,
90        # APPLE,
91        CXX
92    ),
93    deps = [
94        ":androidtextinput",
95        "//xplat/third-party/gmock:gtest",
96    ],
97)
98