2017-12-06 09:56:49 -05:00
|
|
|
package(default_visibility = ["//visibility:public"])
|
2017-06-02 12:43:52 -04:00
|
|
|
|
2018-02-13 14:26:06 -05:00
|
|
|
load("//tools:defaults.bzl", "ng_module", "ng_package")
|
2017-07-21 17:20:34 -04:00
|
|
|
|
|
|
|
ng_module(
|
2017-12-06 09:56:49 -05:00
|
|
|
name = "core",
|
|
|
|
srcs = glob(
|
|
|
|
[
|
|
|
|
"*.ts",
|
|
|
|
"src/**/*.ts",
|
|
|
|
],
|
2018-05-03 13:40:31 -04:00
|
|
|
exclude = ["src/ivy_switch.ts"],
|
|
|
|
) + [
|
|
|
|
":ivy_switch",
|
|
|
|
],
|
2017-12-06 09:56:49 -05:00
|
|
|
module_name = "@angular/core",
|
|
|
|
deps = [
|
2017-12-01 17:23:03 -05:00
|
|
|
"//packages:types",
|
2018-05-09 11:35:25 -04:00
|
|
|
"//packages/compiler",
|
2017-12-06 09:56:49 -05:00
|
|
|
"@rxjs",
|
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
|
|
|
"@rxjs//operators",
|
2017-12-06 09:56:49 -05:00
|
|
|
],
|
|
|
|
)
|
2018-02-13 14:26:06 -05:00
|
|
|
|
|
|
|
ng_package(
|
|
|
|
name = "npm_package",
|
2018-03-13 14:00:53 -04:00
|
|
|
srcs = glob(["**/*.externs.js"]) + [
|
|
|
|
"package.json",
|
|
|
|
"//packages/core/testing:package.json",
|
|
|
|
],
|
2018-02-13 14:26:06 -05:00
|
|
|
entry_point = "packages/core/index.js",
|
2018-06-05 14:38:46 -04:00
|
|
|
tags = [
|
|
|
|
"ivy-jit",
|
|
|
|
"ivy-local",
|
|
|
|
"release-with-framework",
|
|
|
|
],
|
2018-02-13 14:26:06 -05:00
|
|
|
deps = [
|
|
|
|
":core",
|
|
|
|
"//packages/core/testing",
|
|
|
|
],
|
|
|
|
)
|
2018-05-03 13:40:31 -04:00
|
|
|
|
|
|
|
## Controls if Ivy is enabled. (Temporary target until we permanently switch over to Ivy)
|
|
|
|
##
|
|
|
|
## This file generates `src/ivy_switch.ts` file which reexports symbols for `ViewEngine` or `Ivy.`
|
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
|
|
|
## - append `--define=compile=legacy` (default) to `bazel` command to reexport `./ivy_switch_legacy`
|
|
|
|
## and use `ViewEngine`
|
|
|
|
## - append `--define=compile=jit` to `bazel` command to rexport `./ivy_switch_jit` and use `Ivy`
|
|
|
|
## - append `--define=compile=local` to `bazel` command to rexport `./ivy_switch_jit` and use `Ivy`
|
|
|
|
## in the local analysis mode. (run as part of `ngtsc`)
|
2018-05-03 13:40:31 -04:00
|
|
|
##
|
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
|
|
|
## NOTE: `--define=compile=jit` works with any `bazel` command or target across the repo.
|
2018-05-03 13:40:31 -04:00
|
|
|
##
|
|
|
|
## See: `//tools/bazel.rc` where `--define=ivy=false` is defined as default.
|
|
|
|
## See: `./src/ivy_switch.ts` for more details.
|
|
|
|
genrule(
|
|
|
|
name = "ivy_switch",
|
|
|
|
outs = ["src/ivy_switch.ts"],
|
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
|
|
|
cmd = "echo export '*' from \"'./ivy_switch_$(compile)';\" > $@",
|
2018-05-03 13:40:31 -04:00
|
|
|
)
|