2018-03-21 20:11:08 -04:00
|
|
|
package(default_visibility = ["//visibility:public"])
|
|
|
|
|
2018-09-11 21:11:32 -04:00
|
|
|
load("//tools:defaults.bzl", "jasmine_node_test", "ng_module", "ng_rollup_bundle", "ts_library")
|
2018-03-21 20:11:08 -04:00
|
|
|
load("//tools/symbol-extractor:index.bzl", "js_expected_symbol_test")
|
2019-02-21 17:05:31 -05:00
|
|
|
load("@build_bazel_rules_nodejs//:defs.bzl", "http_server")
|
2019-02-08 17:01:51 -05:00
|
|
|
load("@npm_bazel_typescript//:defs.bzl", "ts_devserver")
|
2018-03-21 20:11:08 -04:00
|
|
|
|
2018-06-20 19:02:10 -04:00
|
|
|
ng_module(
|
2018-03-21 20:11:08 -04:00
|
|
|
name = "todo",
|
|
|
|
srcs = ["index.ts"],
|
2018-10-25 23:47:28 -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-10-25 23:47:28 -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",
|
2019-02-13 19:31:29 -05:00
|
|
|
"@ngdeps//rxjs",
|
2018-03-21 20:11:08 -04:00
|
|
|
],
|
|
|
|
)
|
|
|
|
|
|
|
|
ts_library(
|
|
|
|
name = "test_lib",
|
2018-10-16 02:24:22 -04:00
|
|
|
testonly = True,
|
2018-03-21 20:11:08 -04:00
|
|
|
srcs = glob(["*_spec.ts"]),
|
2018-10-25 23:47:28 -04:00
|
|
|
tags = [
|
|
|
|
"ivy-only",
|
|
|
|
],
|
2018-03-21 20:11:08 -04:00
|
|
|
deps = [
|
|
|
|
"//packages:types",
|
2018-10-24 19:02:25 -04:00
|
|
|
"//packages/compiler",
|
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-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 = [
|
2018-10-24 13:04:06 -04:00
|
|
|
"ivy-aot",
|
2018-06-20 19:02:10 -04:00
|
|
|
"ivy-only",
|
|
|
|
],
|
2018-03-21 20:11:08 -04:00
|
|
|
)
|
|
|
|
|
|
|
|
genrule(
|
|
|
|
name = "tslib",
|
|
|
|
srcs = [
|
2018-10-04 16:14:14 -04:00
|
|
|
"@ngdeps//node_modules/tslib:tslib.js",
|
2018-03-21 20:11:08 -04:00
|
|
|
],
|
|
|
|
outs = [
|
|
|
|
"tslib.js",
|
|
|
|
],
|
|
|
|
cmd = "cp $< $@",
|
2018-10-25 23:47:28 -04:00
|
|
|
tags = [
|
|
|
|
"ivy-only",
|
|
|
|
],
|
2018-03-21 20:11:08 -04:00
|
|
|
)
|
|
|
|
|
|
|
|
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
|
|
|
],
|
2018-10-25 23:47:28 -04:00
|
|
|
tags = [
|
|
|
|
"ivy-only",
|
|
|
|
],
|
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
|
|
|
],
|
2018-10-25 23:47:28 -04:00
|
|
|
tags = [
|
|
|
|
"ivy-only",
|
|
|
|
],
|
2018-03-21 20:11:08 -04:00
|
|
|
)
|