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 = "scrollview",
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        ],
33        prefix = "react/renderer/components/scrollview",
34    ),
35    fbandroid_deps = [
36        react_native_xplat_target("react/renderer/mapbuffer:mapbuffer"),
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/renderer/debug:debug"),
61        react_native_xplat_target("react/renderer/core:core"),
62        react_native_xplat_target("react/renderer/graphics:graphics"),
63        react_native_xplat_target("react/renderer/components/view:view"),
64    ],
65)
66
67fb_xplat_cxx_test(
68    name = "tests",
69    srcs = glob(["tests/**/*.cpp"]),
70    headers = glob(["tests/**/*.h"]),
71    compiler_flags = [
72        "-fexceptions",
73        "-frtti",
74        "-std=c++17",
75        "-Wall",
76    ],
77    contacts = ["[email protected]"],
78    platforms = (ANDROID, APPLE, CXX),
79    deps = [
80        ":scrollview",
81        "//xplat/folly:molly",
82        "//xplat/third-party/gmock:gtest",
83    ],
84)
85