1load("@fbsource//tools/build_defs/apple:flag_defs.bzl", "get_preprocessor_flags_for_build_mode")
2load(
3    "//tools/build_defs/oss:rn_defs.bzl",
4    "ANDROID",
5    "APPLE",
6    "CXX",
7    "fb_xplat_cxx_test",
8    "get_apple_compiler_flags",
9    "get_apple_inspector_flags",
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 = "timeline",
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/timeline",
33    ),
34    compiler_flags_pedantic = True,
35    fbobjc_compiler_flags = APPLE_COMPILER_FLAGS,
36    fbobjc_labels = [],
37    fbobjc_preprocessor_flags = get_preprocessor_flags_for_build_mode() + get_apple_inspector_flags(),
38    force_static = True,
39    macosx_tests_override = [],
40    platforms = (ANDROID, APPLE, CXX),
41    preprocessor_flags = [
42        "-DLOG_TAG=\"ReactNative\"",
43        "-DWITH_FBSYSTRACE=1",
44    ],
45    tests = [":tests"],
46    visibility = ["PUBLIC"],
47    deps = [
48        "//third-party/glog:glog",
49        "//xplat/fbsystrace:fbsystrace",
50        react_native_xplat_target("react/utils:utils"),
51        react_native_xplat_target("react/renderer/debug:debug"),
52        react_native_xplat_target("react/renderer/core:core"),
53        react_native_xplat_target("react/renderer/components/root:root"),
54        react_native_xplat_target("react/renderer/mounting:mounting"),
55        react_native_xplat_target("react/renderer/uimanager:uimanager"),
56    ],
57)
58
59fb_xplat_cxx_test(
60    name = "tests",
61    srcs = glob(["tests/**/*.cpp"]),
62    headers = glob(["tests/**/*.h"]),
63    compiler_flags = [
64        "-fexceptions",
65        "-frtti",
66        "-std=c++17",
67        "-Wall",
68    ],
69    contacts = ["[email protected]"],
70    platforms = (ANDROID, APPLE, CXX),
71    deps = [
72        ":timeline",
73        "//xplat/third-party/gmock:gtest",
74    ],
75)
76