2018-03-21 20:11:08 -04:00
|
|
|
package(default_visibility = ["//visibility:public"])
|
|
|
|
|
2018-06-20 19:02:10 -04:00
|
|
|
load("//tools:defaults.bzl", "ng_module", "ts_library")
|
2018-04-16 17:55:47 -04:00
|
|
|
load("//tools/http-server:http_server.bzl", "http_server")
|
2018-03-21 20:11:08 -04:00
|
|
|
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")
|
|
|
|
|
2018-06-20 19:02:10 -04:00
|
|
|
ng_module(
|
2018-03-21 20:11:08 -04:00
|
|
|
name = "todo",
|
|
|
|
srcs = ["index.ts"],
|
2018-06-20 19:02:10 -04:00
|
|
|
tags = ["ivy-only"],
|
2018-03-21 20:11:08 -04:00
|
|
|
deps = [
|
|
|
|
"//packages/common",
|
|
|
|
"//packages/core",
|
2018-06-22 13:38:30 -04:00
|
|
|
"//packages/core/test/bundling/util:reflect_metadata",
|
2018-03-21 20:11:08 -04:00
|
|
|
],
|
|
|
|
)
|
|
|
|
|
|
|
|
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",
|
2018-06-20 19:02:10 -04:00
|
|
|
tags = ["ivy-only"],
|
2018-03-21 20:11:08 -04:00
|
|
|
deps = [
|
|
|
|
":todo",
|
2018-05-21 11:15:19 -04:00
|
|
|
"//packages/common",
|
2018-03-21 20:11:08 -04:00
|
|
|
"//packages/core",
|
2018-06-22 13:38:30 -04:00
|
|
|
"//packages/core/test/bundling/util:reflect_metadata",
|
2018-03-21 20:11:08 -04:00
|
|
|
],
|
|
|
|
)
|
|
|
|
|
|
|
|
ts_library(
|
|
|
|
name = "test_lib",
|
|
|
|
testonly = 1,
|
|
|
|
srcs = glob(["*_spec.ts"]),
|
|
|
|
deps = [
|
|
|
|
"//packages:types",
|
2018-04-06 13:29:22 -04:00
|
|
|
"//packages/core",
|
2018-03-21 20:11:08 -04:00
|
|
|
"//packages/core/testing",
|
2018-07-27 16:49:22 -04:00
|
|
|
"//packages/private/testing",
|
2018-03-21 20:11:08 -04:00
|
|
|
],
|
|
|
|
)
|
|
|
|
|
|
|
|
jasmine_node_test(
|
|
|
|
name = "test",
|
|
|
|
data = [
|
|
|
|
":bundle",
|
|
|
|
":bundle.js",
|
build(ivy): support alternate compilation modes to enable Ivy testing (#24056)
Bazel has a restriction that a single output (eg. a compiled version of
//packages/common) can only be produced by a single rule. This precludes
the Angular repo from having multiple rules that build the same code. And
the complexity of having a single rule produce multiple outputs (eg. an
ngc-compiled version of //packages/common and an Ivy-enabled version) is
too high.
Additionally, the Angular repo has lots of existing tests which could be
executed as-is under Ivy. Such testing is very valuable, and it would be
nice to share not only the code, but the dependency graph / build config
as well.
Thus, this change introduces a --define flag 'compile' with three potential
values. When --define=compile=X is set, the entire build system runs in a
particular mode - the behavior of all existing targets is controlled by
the flag. This allows us to reuse our entire build structure for testing
in a variety of different manners. The flag has three possible settings:
* legacy (the default): the traditional View Engine (ngc) build
* local: runs the prototype ngtsc compiler, which does not rely on global
analysis
* jit: runs ngtsc in a mode which executes tsickle, but excludes the
Angular related transforms, which approximates the behavior of plain
tsc. This allows the main packages such as common to be tested with
the JIT compiler.
Additionally, the ivy_ng_module() rule still exists and runs ngc in a mode
where Ivy-compiled output is produced from global analysis information, as
a stopgap while ngtsc is being developed.
PR Close #24056
2018-05-21 18:48:00 -04:00
|
|
|
":bundle.min.js",
|
2018-03-21 20:11:08 -04:00
|
|
|
":bundle.min_debug.js",
|
|
|
|
],
|
2018-05-31 18:50:02 -04:00
|
|
|
tags = [
|
|
|
|
"ivy-jit",
|
|
|
|
"ivy-local",
|
|
|
|
"ivy-only",
|
|
|
|
],
|
2018-03-21 20:11:08 -04:00
|
|
|
deps = [":test_lib"],
|
|
|
|
)
|
|
|
|
|
|
|
|
js_expected_symbol_test(
|
|
|
|
name = "symbol_test",
|
|
|
|
src = ":bundle.min_debug.js",
|
|
|
|
golden = ":bundle.golden_symbols.json",
|
2018-06-20 19:02:10 -04:00
|
|
|
tags = [
|
|
|
|
"ivy-local",
|
|
|
|
"ivy-only",
|
|
|
|
],
|
2018-03-21 20:11:08 -04:00
|
|
|
)
|
|
|
|
|
|
|
|
genrule(
|
|
|
|
name = "tslib",
|
|
|
|
srcs = [
|
2018-06-25 14:22:23 -04:00
|
|
|
"@angular_deps//:node_modules/tslib/tslib.js",
|
2018-03-21 20:11:08 -04:00
|
|
|
],
|
|
|
|
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",
|
2018-04-06 13:29:22 -04:00
|
|
|
"todo.css",
|
|
|
|
"base.css",
|
2018-03-21 20:11:08 -04:00
|
|
|
],
|
|
|
|
deps = [":todo"],
|
|
|
|
)
|
|
|
|
|
2018-04-16 17:55:47 -04:00
|
|
|
http_server(
|
2018-03-21 20:11:08 -04:00
|
|
|
name = "prodserver",
|
2018-04-16 17:55:47 -04:00
|
|
|
data = [
|
|
|
|
"base.css",
|
2018-03-21 20:11:08 -04:00
|
|
|
"index.html",
|
2018-04-06 13:29:22 -04:00
|
|
|
"todo.css",
|
2018-04-16 17:55:47 -04:00
|
|
|
":bundle.min.js.br",
|
|
|
|
":bundle.min_debug.js",
|
2018-03-21 20:11:08 -04:00
|
|
|
],
|
|
|
|
)
|