1load(
2    "//tools/build_defs/oss:rn_defs.bzl",
3    "ANDROID",
4    "APPLE",
5    "CXX",
6    "fb_xplat_cxx_test",
7    "get_apple_compiler_flags",
8    "get_apple_inspector_flags",
9    "get_preprocessor_flags_for_build_mode",
10    "react_native_xplat_target",
11    "rn_xplat_cxx_library",
12    "subdir_glob",
13)
14
15APPLE_COMPILER_FLAGS = get_apple_compiler_flags()
16
17rn_xplat_cxx_library(
18    name = "templateprocessor",
19    srcs = glob(
20        ["**/*.cpp"],
21        exclude = glob(["tests/**/*.cpp"]),
22    ),
23    headers = glob(
24        ["**/*.h"],
25        exclude = glob(["tests/**/*.h"]),
26    ),
27    header_namespace = "",
28    exported_headers = subdir_glob(
29        [
30            ("", "*.h"),
31        ],
32        prefix = "react/renderer/templateprocessor",
33    ),
34    compiler_flags_pedantic = True,
35    fbobjc_compiler_flags = APPLE_COMPILER_FLAGS,
36    fbobjc_preprocessor_flags = get_preprocessor_flags_for_build_mode() + get_apple_inspector_flags(),
37    force_static = True,
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        "//third-party/glog:glog",
51        "//xplat/fbsystrace:fbsystrace",
52        "//xplat/folly:dynamic",
53        "//xplat/folly:json",
54        "//xplat/jsi:JSIDynamic",
55        "//xplat/jsi:jsi",
56        react_native_xplat_target("react/renderer/core:core"),
57        react_native_xplat_target("react/renderer/uimanager:uimanager"),
58        react_native_xplat_target("react/renderer/componentregistry:componentregistry"),
59        react_native_xplat_target("react/renderer/debug:debug"),
60        react_native_xplat_target("react/config:config"),
61        react_native_xplat_target("react/utils:utils"),
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        ":templateprocessor",
79        "//xplat/third-party/gmock:gtest",
80        react_native_xplat_target("react/config:config"),
81        react_native_xplat_target("react/renderer/components/image:image"),
82        react_native_xplat_target("react/renderer/components/root:root"),
83        react_native_xplat_target("react/renderer/components/scrollview:scrollview"),
84        react_native_xplat_target("react/renderer/components/view:view"),
85        "//xplat/js/react-native-github:generated_components-rncore",
86    ],
87)
88