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