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 = "view",
20    srcs = glob(
21        ["**/*.cpp"],
22        exclude = glob(["tests/**/*.cpp"]),
23    ),
24    headers = glob(
25        ["**/*.h"],
26        exclude = glob(["tests/**/*.h"]),
27    ),
28    header_namespace = "",
29    exported_headers = subdir_glob(
30        [
31            ("", "*.h"),
32            ("accessibility", "*.h"),
33            ("root", "*.h"),
34            ("yoga", "*.h"),
35        ],
36        prefix = "react/renderer/components/view",
37    ),
38    fbobjc_compiler_flags = APPLE_COMPILER_FLAGS,
39    fbobjc_preprocessor_flags = get_preprocessor_flags_for_build_mode() + get_apple_inspector_flags(),
40    force_static = True,
41    labels = [
42        "pfh:ReactNative_CommonInfrastructurePlaceholder",
43        "supermodule:xplat/default/public.react_native.infra",
44    ],
45    macosx_tests_override = [],
46    platforms = (ANDROID, APPLE, CXX),
47    preprocessor_flags = [
48        "-DLOG_TAG=\"ReactNative\"",
49        "-DWITH_FBSYSTRACE=1",
50    ],
51    tests = [":tests"],
52    visibility = ["PUBLIC"],
53    deps = [
54        "//third-party/glog:glog",
55        "//xplat/fbsystrace:fbsystrace",
56        "//xplat/folly:headers_only_do_not_use",
57        "//xplat/folly:memory",
58        "//xplat/folly:molly",
59        YOGA_CXX_TARGET,
60        react_native_xplat_target("react/debug:debug"),
61        react_native_xplat_target("react/renderer/core:core"),
62        react_native_xplat_target("react/renderer/debug:debug"),
63        react_native_xplat_target("react/renderer/graphics:graphics"),
64        react_native_xplat_target("react/config:config"),
65        react_native_xplat_target("logger:logger"),
66    ],
67)
68
69fb_xplat_cxx_test(
70    name = "tests",
71    srcs = glob(["tests/**/*.cpp"]),
72    headers = glob(["tests/**/*.h"]),
73    compiler_flags = [
74        "-fexceptions",
75        "-frtti",
76        "-std=c++17",
77        "-Wall",
78    ],
79    contacts = ["[email protected]"],
80    platforms = (ANDROID, APPLE, CXX),
81    deps = [
82        "//xplat/third-party/gmock:gtest",
83        react_native_xplat_target("react/renderer/element:element"),
84        react_native_xplat_target("react/renderer/components/root:root"),
85        react_native_xplat_target("react/renderer/components/view:view"),
86    ],
87)
88