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    compiler_flags_pedantic = True,
36    fbandroid_deps = [
37        react_native_xplat_target("react/renderer/mapbuffer:mapbuffer"),
38    ],
39    fbobjc_compiler_flags = APPLE_COMPILER_FLAGS,
40    fbobjc_preprocessor_flags = get_preprocessor_flags_for_build_mode() + get_apple_inspector_flags(),
41    force_static = True,
42    labels = [
43        "pfh:ReactNative_CommonInfrastructurePlaceholder",
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:dynamic",
57        YOGA_CXX_TARGET,
58        react_native_xplat_target("react/renderer/debug:debug"),
59        react_native_xplat_target("react/renderer/core:core"),
60        react_native_xplat_target("react/renderer/graphics:graphics"),
61        react_native_xplat_target("react/renderer/components/view:view"),
62    ],
63)
64
65fb_xplat_cxx_test(
66    name = "tests",
67    srcs = glob(["tests/**/*.cpp"]),
68    headers = glob(["tests/**/*.h"]),
69    compiler_flags = [
70        "-fexceptions",
71        "-frtti",
72        "-std=c++17",
73        "-Wall",
74    ],
75    contacts = ["[email protected]"],
76    platforms = (ANDROID, APPLE, CXX),
77    deps = [
78        ":scrollview",
79        "//xplat/third-party/gmock:gtest",
80    ],
81)
82