angular-cn/packages/core/test/bundling/todo/BUILD.bazel

92 lines
2.2 KiB
Python
Raw Normal View History

package(default_visibility = ["//visibility:public"])
load("//tools:defaults.bzl", "ts_library", "ivy_ng_module")
load("//tools/symbol-extractor:index.bzl", "js_expected_symbol_test")
load("//packages/bazel/src:ng_rollup_bundle.bzl", "ng_rollup_bundle")
load("@build_bazel_rules_nodejs//:defs.bzl", "jasmine_node_test")
load("@build_bazel_rules_typescript//:defs.bzl", "ts_devserver")
ivy_ng_module(
name = "todo",
srcs = ["index.ts"],
deps = [
"//packages/common",
"//packages/core",
],
)
ng_rollup_bundle(
name = "bundle",
# TODO(alexeagle): This is inconsistent.
# We try to teach users to always have their workspace at the start of a
# path, to disambiguate from other workspaces.
# Here, the rule implementation is looking in an execroot where the layout
# has an "external" directory for external dependencies.
# This should probably start with "angular/" and let the rule deal with it.
entry_point = "packages/core/test/bundling/todo/index.js",
deps = [
":todo",
"//packages/core",
],
)
ts_library(
name = "test_lib",
testonly = 1,
srcs = glob(["*_spec.ts"]),
deps = [
"//packages:types",
"//packages/core/testing",
],
)
jasmine_node_test(
name = "test",
data = [
":bundle",
":bundle.js",
":bundle.min.js.brotli",
":bundle.min_debug.js",
],
deps = [":test_lib"],
)
js_expected_symbol_test(
name = "symbol_test",
src = ":bundle.min_debug.js",
golden = ":bundle.golden_symbols.json",
)
genrule(
name = "tslib",
srcs = [
"//:node_modules/tslib/tslib.js",
],
outs = [
"tslib.js",
],
cmd = "cp $< $@",
)
ts_devserver(
name = "devserver",
entry_module = "angular/packages/core/test/bundling/todo/index",
serving_path = "/bundle.min.js",
static_files = [
"index.html",
":tslib",
],
deps = [":todo"],
)
# Even though this is `ts_devserver` rule, we are using it as simple static server
# This is mostly broken for `ibazel`, use `:devserver` instead.
ts_devserver(
name = "prodserver",
static_files = [
":bundle.min_debug.js",
":bundle.min.js",
"index.html",
],
)