package(default_visibility = ["//visibility:public"])

load("//tools:defaults.bzl", "ng_module", "ng_rollup_bundle")
load("//packages/bazel:index.bzl", "protractor_web_test")
load("@build_bazel_rules_typescript//:defs.bzl", "ts_devserver")

ng_module(
    name = "largetable_lib",
    srcs = glob(
        [
            "**/*.ts",
        ],
        exclude = ["protractor.on-prepare.ts"],
    ),
    tags = ["ivy-only"],
    deps = [
        "//modules/benchmarks/src:util_lib",
        "//modules/benchmarks/src/largetable:util_lib",
        "//packages:types",
        "//packages/common",
        "//packages/core",
        "@ngdeps//reflect-metadata",
    ],
)

ng_rollup_bundle(
    name = "bundle",
    entry_point = "modules/benchmarks/src/largetable/render3/index.js",
    tags = ["ivy-only"],
    deps = [
        ":largetable_lib",
    ],
)

genrule(
    name = "favicon",
    srcs = ["//modules/benchmarks:favicon"],
    outs = ["favicon.ico"],
    cmd = "cp $< $@",
)

ts_devserver(
    name = "devserver",
    static_files = [
        ":bundle.min_debug.js",
        ":bundle.min.js",
        "index.html",
        ":favicon",
    ],
    tags = ["ivy-only"],
)

protractor_web_test(
    name = "perf",
    configuration = "//:protractor-perf.conf.js",
    data = [
        "//packages/bazel/src/protractor/utils",
        "//packages/benchpress",
        "@ngdeps//node-uuid",
        "@ngdeps//protractor",
        "@ngdeps//reflect-metadata",
        "@ngdeps//yargs",
    ],
    on_prepare = ":protractor.on_prepare.js",
    server = ":devserver",
    tags = ["ivy-only"],
    deps = [
        "//modules/benchmarks/src/largetable:perf_lib",
    ],
)
