Commit Graph

608 Commits

Author SHA1 Message Date
Paul Gschwendtner fc78c64e8d build: update bazel to v1.1.0 (#33813)
Updates Bazel to the latest stable version. Bazel 1.1.0
supposedly fixes a permission bug in Windows. Hence we
should try to update and see if that fixes the bug.

It's generally good to be up to date. See potential bug
fix commit:
618e5a28f7.

PR Close #33813
2019-11-14 10:49:44 -08:00
Greg Magolan 9a68f23dd2 build: ts_web_test & ts_web_test_suite deprecated in favor of karma_web_test & karma_web_test_suite (#33802)
This is a breaking change in nodejs rules 0.40.0 as part of the API review & cleanup for the 1.0 release. Their APIs are identical as ts_web_test was just karma_web_test without the config_file attribute.

PR Close #33802
2019-11-13 13:33:38 -08:00
Greg Magolan 78912093f8 build: update to rules_nodejs 0.40.0 (#33802)
This release includes nodejs cross-platform RBE fix in https://github.com/bazelbuild/rules_nodejs/pull/1320 and adds `args` to terser_minified in https://github.com/bazelbuild/rules_nodejs/pull/1317. These changes are needed to land a few outstanding PRs.

* build: fixes for cross-platform RBE #33708
* build: update zone.js to use the new rollup_bundle #33329

fix: fix

PR Close #33802
2019-11-13 13:33:38 -08:00
Joey Perrott 1d563a7acd build: set up all packages to publish via wombot proxy (#33747)
PR Close #33747
2019-11-13 11:34:33 -08:00
Greg Magolan cf598f71fd build: fix ng_package & ng_rollup_bundle windows issues (#33607)
Fixes ng_package and ng_rollup_bundle rollup issue on Windows where .js file was resolved by bazel resolved instead of .mjs file as there is no sandbox.

Fixes https://github.com/angular/angular/issues/32603 by passing globals and external through templated rollup config as Windows CLI argument limit can be easily exceeded. Also fixes this for ng_rollup_bundle.

PR Close #33607
2019-11-06 19:56:57 +00:00
Greg Magolan 1c22e464b2 build: remove deps on legacy nodejs rules rollup_bundle internals (#33201) (#33607)
The legacy nodejs rules rollup_bundle is now deprecated and will be removed in the nodejs rules 1.0 release due in mid-November. This PR brings in the rules_nodejs internal API deps that ng_rollup_bundle, ng_package and ls_rollup_bundle depend on into this repo to break the dependency. In the future these rules should switch to use the new rollup_bundle via a macro as done in https://github.com/angular/angular/pull/33329 but this is not possible right now due to the complication of having esm5 re-rooted ts_library dependencies.

The es6 sources now have .mjs extensions so they no longer need to be re-rooted to `{package}.es6`. This eliminates the need for the collect_es6_sources() function.

Note: repo has been updated to the newest working version of rollup which is 1.25.2. There is some regression in 1.26.0 which causes the following bundling failure:

```
ERROR: /Users/greg/google/angular/packages/localize/BUILD.bazel:20:1: Optimizing JavaScript packages/localize/localize.umd.min.js [terser] failed (Exit 1) terser.sh failed: error executing command bazel-out/host/bin/external/npm/terser/bin/terser.sh bazel-out/darwin-fastbuild/bin/packages/localize/localize.umd.js --output bazel-out/darwin-fastbuild/bin/packages/localize/localize.umd.min.js ... (remaining 5 argument(s) skipped)

Use --sandbox_debug to see verbose messages from the sandbox
Parse error at packages/localize/localize.umd.js:491,4
    export * from './src/constants';
    ^
ERROR: Export statement may only appear at top level
    at js_error (/private/var/tmp/_bazel_greg/5e8f8a9cd1c6fbc1afd11e37ee1fe2e5/sandbox/darwin-sandbox/79/execroot/angular/bazel-out/host/bin/external/npm/terser/bin/terser.sh.runfiles/npm/node_modules/terser/lib/parse.js:357:11)
    at Dn.visit (/private/var/tmp/_bazel_greg/5e8f8a9cd1c6fbc1afd11e37ee1fe2e5/sandbox/darwin-sandbox/79/execroot/angular/bazel-out/host/bin/external/npm/terser/bin/terser.sh.runfiles/npm/node_modules/terser/lib/scope.js:347:13)
    at Dn._visit (/private/var/tmp/_bazel_greg/5e8f8a9cd1c6fbc1afd11e37ee1fe2e5/sandbox/darwin-sandbox/79/execroot/angular/bazel-out/host/bin/external/npm/terser/bin/terser.sh.runfiles/npm/node_modules/terser/lib/ast.js:1207:24)
    at AST_Export._walk (/private/var/tmp/_bazel_greg/5e8f8a9cd1c6fbc1afd11e37ee1fe2e5/sandbox/darwin-sandbox/79/execroot/angular/bazel-out/host/bin/external/npm/terser/bin/terser.sh.runfiles/npm/node_modules/terser/lib/ast.js:718:17)
    at walk_body (/private/var/tmp/_bazel_greg/5e8f8a9cd1c6fbc1afd11e37ee1fe2e5/sandbox/darwin-sandbox/79/execroot/angular/bazel-out/host/bin/external/npm/terser/bin/terser.sh.runfiles/npm/node_modules/terser/lib/ast.js:168:17)
    at AST_Function.call (/private/var/tmp/_bazel_greg/5e8f8a9cd1c6fbc1afd11e37ee1fe2e5/sandbox/darwin-sandbox/79/execroot/angular/bazel-out/host/bin/external/npm/terser/bin/terser.sh.runfiles/npm/node_modules/terser/lib/ast.js:430:13)
    at descend (/private/var/tmp/_bazel_greg/5e8f8a9cd1c6fbc1afd11e37ee1fe2e5/sandbox/darwin-sandbox/79/execroot/angular/bazel-out/host/bin/external/npm/terser/bin/terser.sh.runfiles/npm/node_modules/terser/lib/ast.js:1208:21)
    at Dn.visit (/private/var/tmp/_bazel_greg/5e8f8a9cd1c6fbc1afd11e37ee1fe2e5/sandbox/darwin-sandbox/79/execroot/angular/bazel-out/host/bin/external/npm/terser/bin/terser.sh.runfiles/npm/node_modules/terser/lib/scope.js:256:13)
    at Dn._visit (/private/var/tmp/_bazel_greg/5e8f8a9cd1c6fbc1afd11e37ee1fe2e5/sandbox/darwin-sandbox/79/execroot/angular/bazel-out/host/bin/external/npm/terser/bin/terser.sh.runfiles/npm/node_modules/terser/lib/ast.js:1207:24)
    at AST_Function._walk (/private/var/tmp/_bazel_greg/5e8f8a9cd1c6fbc1afd11e37ee1fe2e5/sandbox/darwin-sandbox/79/execroot/angular/bazel-out/host/bin/external/npm/terser/bin/terser.sh.runfiles/npm/node_modules/terser/lib/ast.js:424:24)
[Function]
Target //packages/localize:npm_package failed to build
Use --verbose_failures to see the command lines of failed build steps.
ERROR: /Users/greg/google/angular/packages/localize/BUILD.bazel:20:1 Optimizing JavaScript packages/localize/localize.umd.min.js [terser] failed (Exit 1) terser.sh failed: error executing command bazel-out/host/bin/external/npm/terser/bin/terser.sh bazel-out/darwin-fastbuild/bin/packages/localize/localize.umd.js --output bazel-out/darwin-fastbuild/bin/packages/localize/localize.umd.min.js ... (remaining 5 argument(s) skipped)
```

Will leave that for another day.

Terser also updated to 4.3.3. Updating to 4.3.4 (https://github.com/terser/terser/blob/master/CHANGELOG.md) turns comments preservation on by default which increases the size of the //packages/core/test/bundling/todo:bundle.min.js in CI. After bazelbuild/rules_nodejs#1317 terser can be updated to the latest as passing —comments /a^/ to args can turn off all comments for the //packages/core/test/bundling/todo:bundle.min.js size test.

PR Close #33201

PR Close #33607
2019-11-06 19:56:57 +00:00
Greg Magolan 3de72e4124 revert: build: remove deps on legacy nodejs rules rollup_bundle internals (#33201) (#33604)
This reverts commit 0addaab270.

PR Close #33604
2019-11-05 22:48:33 +00:00
Greg Magolan 0addaab270 build: remove deps on legacy nodejs rules rollup_bundle internals (#33201)
The legacy nodejs rules rollup_bundle is now deprecated and will be removed in the nodejs rules 1.0 release due in mid-November. This PR brings in the rules_nodejs internal API deps that ng_rollup_bundle, ng_package and ls_rollup_bundle depend on into this repo to break the dependency. In the future these rules should switch to use the new rollup_bundle via a macro as done in https://github.com/angular/angular/pull/33329 but this is not possible right now due to the complication of having esm5 re-rooted ts_library dependencies.

The es6 sources now have .mjs extensions so they no longer need to be re-rooted to `{package}.es6`. This eliminates the need for the collect_es6_sources() function.

Note: repo has been updated to the newest working version of rollup which is 1.25.2. There is some regression in 1.26.0 which causes the following bundling failure:

```
ERROR: /Users/greg/google/angular/packages/localize/BUILD.bazel:20:1: Optimizing JavaScript packages/localize/localize.umd.min.js [terser] failed (Exit 1) terser.sh failed: error executing command bazel-out/host/bin/external/npm/terser/bin/terser.sh bazel-out/darwin-fastbuild/bin/packages/localize/localize.umd.js --output bazel-out/darwin-fastbuild/bin/packages/localize/localize.umd.min.js ... (remaining 5 argument(s) skipped)

Use --sandbox_debug to see verbose messages from the sandbox
Parse error at packages/localize/localize.umd.js:491,4
    export * from './src/constants';
    ^
ERROR: Export statement may only appear at top level
    at js_error (/private/var/tmp/_bazel_greg/5e8f8a9cd1c6fbc1afd11e37ee1fe2e5/sandbox/darwin-sandbox/79/execroot/angular/bazel-out/host/bin/external/npm/terser/bin/terser.sh.runfiles/npm/node_modules/terser/lib/parse.js:357:11)
    at Dn.visit (/private/var/tmp/_bazel_greg/5e8f8a9cd1c6fbc1afd11e37ee1fe2e5/sandbox/darwin-sandbox/79/execroot/angular/bazel-out/host/bin/external/npm/terser/bin/terser.sh.runfiles/npm/node_modules/terser/lib/scope.js:347:13)
    at Dn._visit (/private/var/tmp/_bazel_greg/5e8f8a9cd1c6fbc1afd11e37ee1fe2e5/sandbox/darwin-sandbox/79/execroot/angular/bazel-out/host/bin/external/npm/terser/bin/terser.sh.runfiles/npm/node_modules/terser/lib/ast.js:1207:24)
    at AST_Export._walk (/private/var/tmp/_bazel_greg/5e8f8a9cd1c6fbc1afd11e37ee1fe2e5/sandbox/darwin-sandbox/79/execroot/angular/bazel-out/host/bin/external/npm/terser/bin/terser.sh.runfiles/npm/node_modules/terser/lib/ast.js:718:17)
    at walk_body (/private/var/tmp/_bazel_greg/5e8f8a9cd1c6fbc1afd11e37ee1fe2e5/sandbox/darwin-sandbox/79/execroot/angular/bazel-out/host/bin/external/npm/terser/bin/terser.sh.runfiles/npm/node_modules/terser/lib/ast.js:168:17)
    at AST_Function.call (/private/var/tmp/_bazel_greg/5e8f8a9cd1c6fbc1afd11e37ee1fe2e5/sandbox/darwin-sandbox/79/execroot/angular/bazel-out/host/bin/external/npm/terser/bin/terser.sh.runfiles/npm/node_modules/terser/lib/ast.js:430:13)
    at descend (/private/var/tmp/_bazel_greg/5e8f8a9cd1c6fbc1afd11e37ee1fe2e5/sandbox/darwin-sandbox/79/execroot/angular/bazel-out/host/bin/external/npm/terser/bin/terser.sh.runfiles/npm/node_modules/terser/lib/ast.js:1208:21)
    at Dn.visit (/private/var/tmp/_bazel_greg/5e8f8a9cd1c6fbc1afd11e37ee1fe2e5/sandbox/darwin-sandbox/79/execroot/angular/bazel-out/host/bin/external/npm/terser/bin/terser.sh.runfiles/npm/node_modules/terser/lib/scope.js:256:13)
    at Dn._visit (/private/var/tmp/_bazel_greg/5e8f8a9cd1c6fbc1afd11e37ee1fe2e5/sandbox/darwin-sandbox/79/execroot/angular/bazel-out/host/bin/external/npm/terser/bin/terser.sh.runfiles/npm/node_modules/terser/lib/ast.js:1207:24)
    at AST_Function._walk (/private/var/tmp/_bazel_greg/5e8f8a9cd1c6fbc1afd11e37ee1fe2e5/sandbox/darwin-sandbox/79/execroot/angular/bazel-out/host/bin/external/npm/terser/bin/terser.sh.runfiles/npm/node_modules/terser/lib/ast.js:424:24)
[Function]
Target //packages/localize:npm_package failed to build
Use --verbose_failures to see the command lines of failed build steps.
ERROR: /Users/greg/google/angular/packages/localize/BUILD.bazel:20:1 Optimizing JavaScript packages/localize/localize.umd.min.js [terser] failed (Exit 1) terser.sh failed: error executing command bazel-out/host/bin/external/npm/terser/bin/terser.sh bazel-out/darwin-fastbuild/bin/packages/localize/localize.umd.js --output bazel-out/darwin-fastbuild/bin/packages/localize/localize.umd.min.js ... (remaining 5 argument(s) skipped)
```

Will leave that for another day.

Terser also updated to 4.3.3. Updating to 4.3.4 (https://github.com/terser/terser/blob/master/CHANGELOG.md) turns comments preservation on by default which increases the size of the //packages/core/test/bundling/todo:bundle.min.js in CI. After bazelbuild/rules_nodejs#1317 terser can be updated to the latest as passing —comments /a^/ to args can turn off all comments for the //packages/core/test/bundling/todo:bundle.min.js size test.

PR Close #33201
2019-11-05 20:55:54 +00:00
Greg Magolan 540d104b17 feat(bazel): update @bazel/schematics to Bazel 1.0.0 (#33476)
Not updating to Bazel 1.1.0 yet due to a docker permissions CI issue that was observed on the angular repo that is unresolved. See https://github.com/angular/angular/pull/33367#issuecomment-547643246.

PR Close #33476
2019-10-29 16:22:41 -07:00
Greg Magolan 7193e151d7 build: update to @bazel/bazel 1.0.0 (#33476)
Also removes `build:remote --spawn_strategy=remote` from .bazelrc. It seems that with Bazel 1.0.0 setting `--incompatible_list_based_execution_strategy_selection=false` no longer works around the issue with npm_package that it did when it was added. The error that was originally observed has returned after updating to Bazel 1.0.0:

```
ERROR: /home/circleci/ng/packages/angular_devkit/build_optimizer/BUILD:66:1: Assembling npm package packages/angular_devkit/build_optimizer/npm_package failed: No usable spawn strategy found for spawn with mnemonic Action. Your --spawn_strategy, --genrule_strategy or --strategy flags are probably too strict. Visit https://github.com/bazelbuild/bazel/issues/7480 for migration advice
```

This commit removes both `—incompatible_list_based_execution_strategy_selection=false` as well as `build:remote --spawn_strategy=remote` which means that Bazel will do the default behavior of picking the first available strategy from the default list, which is `remote,worker,sandboxed,local`. See https://github.com/bazelbuild/bazel/issues/7480 for more details.

Not updating to Bazel 1.1.0 yet due to a docker permissions CI issue that was observed on the angular repo that is unresolved. See https://github.com/angular/angular/pull/33367#issuecomment-547643246.

PR Close #33476
2019-10-29 16:22:41 -07:00
Greg Magolan 5ed6abe3df build: update to nodejs rules 0.39.1 (#33458)
Pre-req for updating repo, integration & @bazel/schematics to Bazel 1.0.0 as this release brings in a fix for ts_library on Windows with Bazel 1.0.0+. See https://github.com/bazelbuild/rules_nodejs/issues/1307.

PR Close #33458
2019-10-29 14:36:33 -07:00
Greg Magolan bf913cc39b feat(bazel): update bazel-schematics to use Ivy and new rollup_bundle (#33435)
Note: the @angular/bazel schematic now appends the package.json "script" field with 'ngcc --properties es2015 browser module main'. If there is an existing script field with ngcc then the schematic modifies it in place removing `--first-only` and `--create-ivy-entry-points`.

ViewEngine sources under node_modules need to be updated in-place for Bazel as it does not know how to use the `__ivy__` entry points that are created by the non-bazel `ngcc` command that is added to "scripts" :`ngcc --properties es2015 browser module main --first-only --create-ivy-entry-points`.

PR Close #33435
2019-10-29 14:04:21 -07:00
Greg Magolan eb0d8c09e3 build: temporarily set `build --define=enable_legacy_rollup_rule=1` in bazelrc (#33426)
Temporary define while angular depends on the legacy rollup_bundle rule. This will be removed after https://github.com/angular/angular/pull/33201 lands.

PR Close #33426
2019-10-28 10:13:36 -07:00
Greg Magolan d8d8b8915c build: update to nodejs rules 0.39.0 (#33426)
This release brings in some important fixes. In particular the 2 segment linker fix for the new rollup_bundle and the strict peerDeps requirement will be important for angular users that opt in to bazel. See https://github.com/bazelbuild/rules_nodejs/releases/tag/0.39.0 for more details.

PR Close #33426
2019-10-28 10:13:36 -07:00
Greg Magolan 4ee354da99 build: switch to @build_bazel_rules_nodejs//:index.bzl load point (#33433)
The defs.bzl load point will be removed for the rules_nodejs 1.0 release.

PR Close #33433
2019-10-28 10:10:48 -07:00
Greg Magolan e4e8dbdee0 revert: build: update to @bazel/bazel 1.0.0 (#33367) (#33407)
This reverts commit 348615be62.

PR Close #33407
2019-10-25 10:24:58 -07:00
Greg Magolan 348615be62 build: update to @bazel/bazel 1.0.0 (#33367)
Also removes `build:remote --spawn_strategy=remote` from .bazelrc. It seems that with Bazel 1.0.0 setting `--incompatible_list_based_execution_strategy_selection=false` no longer works around the issue with npm_package that it did when it was added. The error that was originally observed has returned after updating to Bazel 1.0.0:

```
ERROR: /home/circleci/ng/packages/angular_devkit/build_optimizer/BUILD:66:1: Assembling npm package packages/angular_devkit/build_optimizer/npm_package failed: No usable spawn strategy found for spawn with mnemonic Action. Your --spawn_strategy, --genrule_strategy or --strategy flags are probably too strict. Visit https://github.com/bazelbuild/bazel/issues/7480 for migration advice
```

This commit removes both `—incompatible_list_based_execution_strategy_selection=false` as well as `build:remote --spawn_strategy=remote` which means that Bazel will do the default behavior of picking the first available strategy from the default list, which is `remote,worker,sandboxed,local`. See https://github.com/bazelbuild/bazel/issues/7480 for more details.

PR Close #33367
2019-10-25 09:22:13 -07:00
Greg Magolan 25ed82db23 refactor(bazel): add missing comment about JS providers to ng_module.bzl (#33332)
PR Close #33332
2019-10-24 10:18:04 -07:00
Greg Magolan 8bc5fb2ab6 fix(bazel): remove deprecated ng_setup_workspace() function (#33330)
This should be removed before for 9.0.0 rc

BREAKING CHANGE:
@angular/bazel ng_setup_workspace() is no longer needed and has been removed.
We assume you will fetch rules_nodejs in your WORKSPACE file, and no other dependencies remain here.
Simply remove any calls to this function and the corresponding load statement.

PR Close #33330
2019-10-23 10:01:10 -07:00
Alex Rickabaugh d4db746898 feat(ivy): give shim generation its own compiler options (#33256)
As a hack to get the Ivy compiler ngtsc off the ground, the existing
'allowEmptyCodegenFiles' option was used to control generation of ngfactory
and ngsummary shims during compilation. This option was selected since it's
enabled in google3 but never enabled in external projects.

As ngtsc is now mature and the role shims play in compilation is now better
understood across the ecosystem, this commit introduces two new compiler
options to control shim generation:

* generateNgFactoryShims controls the generation of .ngfactory shims.
* generateNgSummaryShims controls the generation of .ngsummary shims.

The 'allowEmptyCodegenFiles' option is still honored if either of the above
flags are not set explicitly.

PR Close #33256
2019-10-21 11:24:26 -04:00
Keen Yee Liau f0366843ea fix(bazel): Remove angular devkit and restore ngc postinstall (#32946)
This commit removes `@angular-devkit/build-angular` from package.json
for a project that opts into Bazel. This is because the package adds a
dependency on node-sass, which is rejected by Bazel due to its absense.

This commit also appends to `scripts.postinstall` if it already exists.
This is needed because `ng new` in CLI v9 now automatically adds a
postinstall step for `ngcc`.

PR Close #32946
2019-10-18 13:15:16 -04:00
Igor Minar 86e1e6c082 feat: typescript 3.6 support (#32946)
BREAKING CHANGE: typescript 3.4 and 3.5 are no longer supported, please update to typescript 3.6

Fixes #32380

PR Close #32946
2019-10-18 13:15:16 -04:00
Kara Erickson 86104b82b8 refactor(core): rename ngInjectableDef to ɵprov (#33151)
Injectable defs are not considered public API, so the property
that contains them should be prefixed with Angular's marker
for "private" ('ɵ') to discourage apps from relying on def
APIs directly.

This commit adds the prefix and shortens the name from
ngInjectableDef to "prov" (for "provider", since injector defs
are known as "inj"). This is because property names cannot
be minified by Uglify without turning on property mangling
(which most apps have turned off) and are thus size-sensitive.

PR Close #33151
2019-10-16 16:36:19 -04:00
Greg Magolan 0004896ff9 build: update to nodejs rules 0.38.3 (#33073)
All providers now loaded from "@build_bazel_rules_nodejs//:providers.bzl".

PR Close #33073
2019-10-14 20:25:57 +00:00
Greg Magolan 5e694e519b build: update to nodejs rules 0.38.2 (#33073)
Some changes in rules_nodejs providers folded into @angular/bazel package:
* `NodeModuleSources` renamed to `NpmPackageInfo` and now loaded from `//internal/common:npm_package_info.bzl`
* `collect_node_modules_aspect` renamed to `node_modules_aspect`
* new JS provider `JSNamedModuleInfo` now available and ng_module provides it using the `js_named_module_info` factory function
* sources_aspect has also been removed so the use of the `node_sources` legacy provider has been replaced with `JSNamedModuleInfo`.

PR Close #33073
2019-10-14 20:25:57 +00:00
Alex Rickabaugh ed711418f1 style(bazel): fix 2 unformatted .bzl files 2019-10-08 10:45:48 -07:00
Alex Eagle c653a16b57 build: load build_bazel_rules_nodejs through external (#33041)
PR Close #33041
2019-10-08 10:24:41 -07:00
Greg Magolan 64823f561c build: add history-server to @angular/bazel schematics (#32889)
The history_server rule is not longer shipped with rules_nodejs as it has been replaced by auto-generated rule `load("@npm//history-server:index.bzl", "history_server")` which requires the user to add history-server to their package.json.

PR Close #32889
2019-10-08 09:27:11 -07:00
Greg Magolan e1d07b2fd2 build: add JSEcmaScripModuleInfo provider to ng_module (#32889)
PR Close #32889
2019-10-08 09:27:11 -07:00
Alex Eagle cdfbda3d3b build: add missing http-server dep to bazel example (#32889)
Also update rules_nodejs 0.38.0->0.38.1

PR Close #32889
2019-10-08 09:27:11 -07:00
Alex Eagle f783244ad1 build: update to rules_nodejs 0.38 (#32889)
PR Close #32889
2019-10-08 09:27:11 -07:00
George Kalpakas 75fd407bbd build: avoid error in `build-packages-dist.sh` (#32923)
Not sure why it works on other people's environments, but after
217db9b21 I started getting the following error when running
`scripts/build-packages-dist.sh` (on Windows):

```
ERROR: C:/.../angular/packages/bazel/docs/BUILD.bazel:3:1: Generating Skylark documentation dir for docs (3 files) failed (Exit 1)
Traceback (most recent call last):
  File "c:\...\temp\Bazel.runfiles_u_l5te\runfiles\io_bazel_skydoc\skydoc\main.py", line 335, in <module>
    main(sys.argv)
  File "c:\...\temp\Bazel.runfiles_u_l5te\runfiles\io_bazel_skydoc\skydoc\main.py", line 303, in main
    load_symbols = load_sym_extractor.extract(bzl_file)
  File "c:\...\temp\Bazel.runfiles_u_l5te\runfiles\io_bazel_skydoc\skydoc\load_extractor.py", line 110, in extract
    load_symbols = self._extract_loads(bzl_file)
  File "c:\...\temp\Bazel.runfiles_u_l5te\runfiles\io_bazel_skydoc\skydoc\load_extractor.py", line 38, in _extract_loads
    tree = ast.parse(f.read(), bzl_file)
  File "C:\...\.windows-build-tools\python27\lib\ast.py", line 37, in parse
    return compile(source, filename, mode, PyCF_ONLY_AST)
  File "packages/bazel/src/ng_package/ng_package.bzl", line 39
    print("[ng_package.bzl]", *args)
                              ^
SyntaxError: invalid syntax
```

It seems expected, because `print` is not a function, so
`print(foo, *args)` is interpreted as printing a tuple (where `*args` is
invalid syntax). Not sure why it doesn't break on other people's
machines :/

This change makes the verbose logs a little less pretty, but that
shouldn't be a big issue (given that it is an opt-in feature and it can
always be overwritten locally, if necessary).

PR Close #32923
2019-10-04 08:27:21 -07:00
Paul Gschwendtner 954b8e53a2 refactor(bazel): ng_module action description should include compile mode (#32955)
Similarly to `ts_library` compilation actions, the `ng_module` compile action should include
the current compile mode in the action description. This makes it consistent with `ts_library`
targets and also avoids confusion when both output flavors are requested.

Currently when both output flavors are requested (e.g. in the `ng_package` rule), both
devmode and prodmode compilations have the same action name. This is confusing and
looks like the given target is built *twice* due to a bug (which is obviously not the case though)

PR Close #32955
2019-10-02 13:21:40 -07:00
Greg Magolan c1346462db build: update to nodejs rules 0.37.1 (#32151)
This release includes a ts_config runfiles fix so also cleaning up the one line work-around from #31943.

This also updates to upstream rules_webtesting browser repositories load("@io_bazel_rules_webtesting//web/versioned:browsers-0.3.2.bzl", "browser_repositories") to fix a breaking change in the chromedriver distro. This bumps up the version of chromium to the version here: https://github.com/bazelbuild/rules_webtesting/blob/master/web/versioned/browsers-0.3.2.bzl

PR Close #32151
2019-09-25 11:29:12 -07:00
Jason Bedard df1c456347 fix(bazel): ng_package(data) should support non-text files (#32721)
PR Close #32721
2019-09-17 15:58:42 -07:00
Paul Gschwendtner 217db9b216 feat(bazel): support ts_library targets as entry-points for ng_package (#32610)
Within an Angular package, it can happen that there are
entry-points which do not contain features that belong into
an `@NgModule` or need metadata files to be generated.

For example: the `cdk`, `cdk/testing` and `cdk/coercion`
entry-points. Besides other entry-points in the `cdk`
package, those entry-points do not need metadata to
be generated and no not use the `ng_module` rule.

Currently the "ng_package" rule properly picks up such
entry-points and builds bundles, does downleveling etc.
The only thing it misses is that no `package.json` files
are generated for the entry-point. This means that consumers
will not be able to use these entry-points built with "ts_library"
(except accessing the individual bundlings explicitly).

The "ng_package" rule should follow the full APF specification
for such entry-points. Partially building bundles and doing the
downleveling is confusing and a breaking issue.

The motifivation of supporting this (besides making the
rule behavior consistent; the incomplete output is not
acceptable), is that using the "ng_module" rule does
not make sense to be used for non-Angular entry-points.

Especially since it depends on Angular packages to
be specified as Bazel action inputs just to compile
vanilla TypeScript with `@angular/compiler-cli`.

PR Close #32610
2019-09-13 13:23:55 -07:00
Greg Magolan 9448828b0d refactor(bazel): remove @angular/bazel protractor rule now provided by @bazel/protractor (#32485)
BREAKING CHANGE:
Angular bazel users using protractor_web_test_suite from @angular/bazel npm package should now switch to the @bazel/protractor npm package.

This should impact very few users and the user's that are impacted have a very easy upgrade path to switch to fetching the protractor_web_test_suite rule via the @bazel/protractor npm package.

PR Close #32485
2019-09-10 15:19:31 -04:00
Alan Agius 350ea47def feat(bazel): update to the latest `@microsoft/api-extractor` (#32185)
PR Close #32185
2019-08-30 13:55:32 -04:00
Miško Hevery 64770571b2 perf: don't create holey arrays (#32155)
Don't use `Array` constructor with the size value (ex. `new Array(5)`) - this will create a `HOLEY_ELEMENTS` array (even if this array is filled in later on!);

https://v8.dev/blog/elements-kinds
https://stackoverflow.com/questions/32054170/how-to-resize-an-array

PR Close #32155
2019-08-21 08:27:43 -07:00
Alex Rickabaugh ec4381dd40 feat: make the Ivy compiler the default for ngc (#32219)
This commit switches the default value of the enableIvy flag to true.
Applications that run ngc will now by default receive an Ivy build!

This does not affect the way Bazel builds in the Angular repo work, since
those are still switched based on the value of the --define=compile flag.
Additionally, projects using @angular/bazel still use View Engine builds
by default.

Since most of the Angular repo tests are still written against View Engine
(particularly because we still publish VE packages to NPM), this switch
also requires lots of `enableIvy: false` flags in tsconfigs throughout the
repo.

Congrats to the team for reaching this milestone!

PR Close #32219
2019-08-20 16:41:08 -07:00
Alex Rickabaugh 2b64031ddc refactor(ivy): remove the tsc passthrough option (#32219)
This option makes ngc behave as tsc, and was originally implemented before
ngtsc existed. It was designed so we could build JIT-only versions of
Angular packages to begin testing Ivy early, and is not used at all in our
current setup.

PR Close #32219
2019-08-20 16:41:08 -07:00
Alan Agius 5da5ca5c23 fix(bazel): pin `@microsoft/api-extractor` (#32187)
The API of `@microsoft/api-extractor` changed in a minor version which is causes an error when using dts flattening downstream.

API wil be updated on master https://github.com/angular/angular/pull/32185

PR Close #32187
2019-08-19 15:42:44 -07:00
Filipe Silva 431ddb9a45 test(bazel): use cross-platform file read of golden file (#31266)
PR Close #31266
2019-08-19 13:32:13 -07:00
Alan Agius 7b9414565e style: fix inline comment typo (#32090)
PR Close #32090
2019-08-12 07:06:00 -07:00
Alan c198a27a3c test: update golden files (#32069)
PR Close #32069
2019-08-09 14:15:25 -07:00
Alan 4f37487b1c fix(bazel): disable treeshaking when generating FESM and UMD bundles (#32069)
There has been a regression where enabling rollup treeshaking causes errors during runtime because it will drop const access which will always evaluate to true or false. However, such `const` in `@angular/core` cannot be dropped because their value is changed when NGCC is run on `@angular/core`

VE
```
const SWITCH_IVY_ENABLED__POST_R3__ = true;
const SWITCH_IVY_ENABLED__PRE_R3__ = false;
const ivyEnabled = SWITCH_IVY_ENABLED__PRE_R3__;
```

Ivy (After NGCC)
```
const SWITCH_IVY_ENABLED__POST_R3__ = true;
const SWITCH_IVY_ENABLED__PRE_R3__ = false;
const ivyEnabled = SWITCH_IVY_ENABLED__POST_R3__;
```

FESM2015
```
load(path) {
	/** @type {?} */
	const legacyOfflineMode = this._compiler instanceof Compiler;
	return legacyOfflineMode ? this.loadFactory(path) : this.loadAndCompile(path);
}
```

ESM2015
```
 load(path) {
	/** @type {?} */
	const legacyOfflineMode = !ivyEnabled && this._compiler instanceof Compiler;
	return legacyOfflineMode ? this.loadFactory(path) : this.loadAndCompile(path);
}
```

From the above we can see that `ivyEnabled ` is being treeshaken away when generating the FESM bundle which is causing runtime errors such as `Cannot find module './lazy/lazy.module.ngfactory'` since in Ivy we will always load the factories.

PR Close #32069
2019-08-09 14:15:25 -07:00
Greg Magolan 5f0d5e9ccf build: update to nodejs rules 0.34.0 and bazel 0.28.1 (#31824)
nodejs rules 0.34.0 now includes protractor_web_test_suite rule (via new @bazel/protractor rule) so we switch to that location for that rule in this PR so that /packages/bazel/src/protractor can be removed in a future PR

this PR also brings in node toolchain support which was released in nodejs rules 0.33.0. this is a prerequisite for RBE for mac & windows users

bazel schematics also updated with the same. @bazel/bazel 0.28.1 npm package includes transitive dep on hide-bazel-files so we're able to remove an explicit dep on that as well.

PR Close #31824
2019-07-26 15:01:25 -07:00
Igor Minar 6ece7db37a build: TypeScript 3.5 upgrade (#31615)
https://github.com/Microsoft/TypeScript/wiki/Breaking-Changes#typescript-35

PR Close #31615
2019-07-25 17:05:23 -07:00
Ayaz Hafiz 82055b2fb8 feat(bazel): compile targets used for indexing by Kythe with Ivy (#31786)
This switches all Angular targets to be built with the same Angular compiler architecture (c.n. Ivy) that the Angular indexer uses. This eliminates issues with cross-references to transitive dependencies not being generated because of the way such dependencies are loaded by the legacy compiler arch.

PR Close #31786
2019-07-23 21:14:16 -07:00
Alex Rickabaugh 5a8eb924ba fix(bazel): increase memory limit of ngc under bazel from 2 to 4 GB (#31784)
This commit bumps the heap size of node/ngc under bazel to 4 GB instead of
the previous 2 GB. This brings it in sync with what the TS compiler uses
in g3, and fixes a bug where ngc would crash with OOM in worker mode.

PR Close #31784
2019-07-22 12:14:14 -07:00
Ayaz Hafiz 0c61a35ea3 fix(bazel): pass custom bazel compiler host rather than rewriting one (#31496)
Switch back to passing a custom bazel host instead of rewriting one that
is passed to `compile` now that the Angular indexer is stable.

Revert "feat(bazel): allow passing and rewriting an old bazel host"

This reverts commit 0a4c1c8f803a65f5c156af90e67f7d7d68ebc7f8.

PR Close #31496
2019-07-12 11:37:58 -04:00
George Kalpakas 7724f7446a refactor(bazel): remove unused lockfile (#31458)
The corresponding `package.json` file was removed in 15c2467db; it looks
like the lockfile was left behind by accident.

PR Close #31458
2019-07-09 13:49:43 -07:00
Alex Eagle 1d3e22766a fix(bazel): revert location of xi18n outputs to bazel-genfiles (#31410)
This is needed in g3 where the translation system is sensitive to the full path of the output.
For Bazel users, we don't want this because it would force them to
disable a Bazel option that prevents using the deprecated ctx.new_file
API

PR Close #31410
2019-07-03 14:15:12 -07:00
Ayaz Hafiz 11a208f55c feat(bazel): allow passing and rewriting an old bazel host (#31381)
Updates the decision made in #31341; this is for the Angular indexer
inside Google. The indexer currently passes (and ngc-wrapped#compile
accepts) a bazel host to use, but because many methods are overwritten
specially for Angular compilation a better approach is to pass an old
bazel compiler host and siphon methods needed off of it before creating
a new host. This enables that.

PR Close #31381
2019-07-02 11:28:41 -07:00
Greg Magolan ba5b3af077 build(bazel): update //packages/bazel/test/ngc-wrapped:ngc_test test (#31325)
after update to rules_nodejs 0.32.1, @types are no longer automatically discovered by ngc-wrapped (which uses parts of ts_library) so this test needed updating so that the types files it generates is added as an explicit dep

PR Close #31325
2019-07-01 14:16:42 -07:00
Greg Magolan d2d84c4460 build(bazel): remove deprecated rules_nodejs NodeModuleInfo provider (#31325)
PR Close #31325
2019-07-01 14:16:42 -07:00
Greg Magolan 361109d80f build: update to rules_nodejs 0.32.2 (#31325)
Brings in ts_library fixes required to get angular/angular building after 0.32.0:
typescript: exclude typescript lib declarations in node_module_library transitive_declarations
typescript: remove override of @bazel/tsetse (+1 squashed commit)

@npm//node_modules/foobar:foobar.js labels changed to @npm//:node_modules/foobar/foobar.js with fix for bazelbuild/rules_nodejs#802

also updates to rules_rass commit compatible with rules_nodejs 0.32.0

PR Close #31325
2019-07-01 14:16:42 -07:00
Greg Magolan b7a099d27e build(bazel): update to bazel 0.27.0 and fix compat in @angular/bazel package (#31325)
ctx.actions.declare_file now used in @angular/bazel ng_module rule as ctx.new_file is now deprecated. Fixes error:

```
        File "ng_module.bzl", line 272, in _expected_outs
                ctx.new_file(ctx.genfiles_dir, (ctx.label.name ..."))
Use ctx.actions.declare_file instead of ctx.new_file.
Use --incompatible_new_actions_api=false to temporarily disable this check.
```

This can be worked around with incompatible_new_actions_api flag but may as well fix it proper so downstream doesn't require this flag due to this code.

Also, depset() is no longer iterable by default without a flag. This required fixing in a few spots in @angular/bazel.

fix: foo

PR Close #31325
2019-07-01 14:16:42 -07:00
Ayaz Hafiz a29dc961a2 feat(bazel): allow passing a custom bazel compiler host to ngc compile (#31341)
Enable users to pass a custom Bazel CompilerHost to use for an Angular
compilation. This supports users who must override the TypeScript
compiler host.

PR Close #31341
2019-06-28 12:18:20 -07:00
George Kalpakas 3851544674 style: fix code style in several files (#31295)
These files have not been formatted properly, due to issues in the
`gulp format*` tasks. See previous commits (or #31295) for more details.

PR Close #31295
2019-06-26 13:29:29 -07:00
Alex Rickabaugh 280e8563f0 Revert "build(bazel): update to bazel 0.27.0 and fix compat in @angular/bazel package (#31019)" (#31267)
This reverts commit 28d3bfc416.

Reason: this causes failures in g3 with i18n extraction. See #31267.

PR Close #31267
2019-06-25 14:36:01 -07:00
Alex Rickabaugh 660800ca4e Revert "build: update to rules_nodejs 0.32.2 (#31019)" (#31267)
This reverts commit a38433f36b.

Reason: this causes failures in g3 with i18n extraction. See #31267.

PR Close #31267
2019-06-25 14:36:00 -07:00
Alex Rickabaugh 5eb4691dec Revert "build(bazel): remove deprecated rules_nodejs NodeModuleInfo provider (#31019)" (#31267)
This reverts commit 72e4ff7591.

Reason: this causes failures in g3 with i18n extraction. See #31267.

PR Close #31267
2019-06-25 14:36:00 -07:00
Alex Rickabaugh 8afc998ec4 Revert "build(bazel): update //packages/bazel/test/ngc-wrapped:ngc_test test (#31019)" (#31267)
This reverts commit 708d0a2db2.

Reason: this causes failures in g3 with i18n extraction. See #31267.

PR Close #31267
2019-06-25 14:36:00 -07:00
Paul Gschwendtner 1d5c44551d build: use checked-in configuration from bazel-toolchains (#31251)
No longer uses docker in order to pull down the toolchain configs
for remote build execution. We don't need to make docker a prerequisite
for working on the Angular repository since we can leverage the checked-in
toolchain configurations from the `@bazel-toolchains` repository.

PR Close #31251
2019-06-25 10:24:43 -07:00
Greg Magolan 708d0a2db2 build(bazel): update //packages/bazel/test/ngc-wrapped:ngc_test test (#31019)
after update to rules_nodejs 0.32.1, @types are no longer automatically discovered by ngc-wrapped (which uses parts of ts_library) so this test needed updating so that the types files it generates is added as an explicit dep

PR Close #31019
2019-06-25 10:21:07 -07:00
Greg Magolan 72e4ff7591 build(bazel): remove deprecated rules_nodejs NodeModuleInfo provider (#31019)
PR Close #31019
2019-06-25 10:21:07 -07:00
Greg Magolan a38433f36b build: update to rules_nodejs 0.32.2 (#31019)
Brings in ts_library fixes required to get angular/angular building after 0.32.0:
typescript: exclude typescript lib declarations in node_module_library transitive_declarations
typescript: remove override of @bazel/tsetse (+1 squashed commit)

@npm//node_modules/foobar:foobar.js labels changed to @npm//:node_modules/foobar/foobar.js with fix for bazelbuild/rules_nodejs#802

also updates to rules_rass commit compatible with rules_nodejs 0.32.0

PR Close #31019
2019-06-25 10:21:07 -07:00
Greg Magolan 28d3bfc416 build(bazel): update to bazel 0.27.0 and fix compat in @angular/bazel package (#31019)
ctx.actions.declare_file now used in @angular/bazel ng_module rule as ctx.new_file is now deprecated. Fixes error:

```
        File "ng_module.bzl", line 272, in _expected_outs
                ctx.new_file(ctx.genfiles_dir, (ctx.label.name ..."))
Use ctx.actions.declare_file instead of ctx.new_file.
Use --incompatible_new_actions_api=false to temporarily disable this check.
```

This can be worked around with incompatible_new_actions_api flag but may as well fix it proper so downstream doesn't require this flag due to this code.

Also, depset() is no longer iterable by default without a flag. This required fixing in a few spots in @angular/bazel.

fix: foo

PR Close #31019
2019-06-25 10:21:06 -07:00
Alan Agius 16717fa12c fix(bazel): exclude all angular schematics folders from metadata build (#31237)
Fixes #31235

PR Close #31237
2019-06-24 18:48:44 -07:00
Alan Agius e83667ad76 fix(bazel): remove unsupported Css pre-processors from ng new (#31234)
Under Bazel, we don't yet support Stylus and Less, and thus we should not offer the users to generate applications which are known not to work.

Closes #31209

PR Close #31234
2019-06-24 14:57:06 -07:00
Alan Agius 805fc8698c fix(bazel): update ng new schema to match the current ng new schema of @schematics/angular (#31234)
The schema used in ng-new bazel, includes several outdated options. With this update we match the current version of @schematics/angular: https://github.com/angular/angular-cli/blob/master/packages/schematics/angular/ng-new/schema.json

Relates to #31233

PR Close #31234
2019-06-24 14:57:06 -07:00
Paul Gschwendtner 3998335188 build: update buildifier to version that supports windows (#31112)
* Updates buildifier to a version that also comes with windows binaries.
* Fixes a few new formatting/lint warnings
* Removes the `args-order` warning because it is no longer a warning.. and is now part of the formatter.

PR Close #31112
2019-06-18 12:09:41 -07:00
Paul Gschwendtner a1fc4deff3 fix(bazel): builder workspace should use nodejs v10.16.0 (#31088)
The generated Bazel workspace by the `@angular/bazel` builder should
use the latest stable NodeJS version. This is necessary because some
packages like `selenium-webdriver` which are part of the default bazel
setup in order to support `ng e2e` depend on a minimum NodeJS version
of `10.15.0`.. This means that running e2e tests in a plain new bazel CLI
project (`ng new {projectName} --collection=@angular/bazel`) errors.

```
command.
 (error selenium-webdriver@4.0.0-alpha.3: The engine "node" is incompatible with
 this module. Expected version ">= 10.15.0". Got "10.13.0"
error Found incompatible module
)
```

PR Close #31088
2019-06-17 13:07:27 -07:00
Keen Yee Liau b0866769b0 fix(bazel): do not modify tsconfig.json (#30877)
Before this change, user's tsconfig.json is cloned and some options
controlled by Bazel are removed otherwise Bazel would complain about:

```
WARNING: your tsconfig.json file specifies options which are overridden by Bazel:
 - compilerOptions.target and compilerOptions.module are controlled by downstream dependencies, such as ts_devserver
 - compilerOptions.typeRoots is always set to the @types subdirectory of the node_modules attribute
 - compilerOptions.rootDir and compilerOptions.baseUrl are always the workspace root directory
```

Since the warning has been removed in rules_typescript/8d8d398, there's no
need to clone and backup tsconfig.json

PR Close #30877
2019-06-11 14:23:00 -07:00
Greg Magolan 5193acb0a3 build: set symlink_node_modules = False for yarn_install in main WORKSPACE and bazel schematics (#30627)
This is needed to work-around issue: yarn_install & npm_install with managed directories can't handle deleted or manually regenerated node_modules folder [https://github.com/bazelbuild/rules_nodejs/issues/802]
Underlying issue has been fixed in Bazel https://github.com/bazelbuild/bazel/issues/8487 but hasn't landed in a release yet

PR Close #30627
2019-06-11 00:03:11 +00:00
Alex Eagle 532c1cb485 build: update to Bazel 0.26.1 (#30627)
PR Close #30627
2019-06-11 00:03:11 +00:00
Alex Eagle ef0b2cc74d build: convert entry_point to label (#30627)
PR Close #30627
2019-06-11 00:03:11 +00:00
Greg Magolan a794143820 build(bazel): update to nodejs rules 0.31.1 (#30627)
* entry_point attribute of nodejs_binary & rollup_bundle is now a label
* symlinking of node_modules for yarn_install temporarily disabled (except for integration/bazel) until the fix for https://github.com/bazelbuild/bazel/issues/8487 makes it into a future bazel release

PR Close #30627
2019-06-11 00:03:11 +00:00
Greg Magolan ba83d33dd0 build(bazel): update to nodejs rules 0.30.1 & bazel 0.26.0 (#30627)
nodejs rules 0.30.1 has new feature to symlink node_modules with yarn_install and bazel 0.26.0 includes new managed_directories feature which enables this

PR Close #30627
2019-06-11 00:03:11 +00:00
Jeremy Elbourn 05a43ca869 fix(bazel): exclude components schematics from build (#30825)
See https://github.com/angular/components/issues/16189

Without this, bazel attempts to build schematics templates as srcs

PR Close #30825
2019-06-05 21:27:46 -07:00
Keen Yee Liau 17bfedd224 fix(bazel): Load global stylesheet in dev and prod (#30879)
Global stylesheet should be injected as a <link> tag in index.html for
both dev and prod app.

PR Close #30879
2019-06-05 21:20:58 -07:00
Bowen Ni 4ecff42e7f refactor: Move away from index signature based "updateCache". (#30518)
We're deprecating the index signature overloads in favor of using a Map.

PR Close #30518
2019-06-04 12:02:13 -07:00
crisbeto 99c9bcab03 test: move away from deprecated testing method (#30747)
Switches all of the tests away from the `runSchematic` method which was deprecated in 8.0 (see https://github.com/angular/angular-cli/pull/14412). Along the same lines as https://github.com/angular/components/pull/16150.

PR Close #30747
2019-05-30 20:46:48 -07:00
Alex Eagle 3125376ec1 fix(bazel): allow ts_library interop with list-typed inputs (#30600)
_compile_action should take a list since we compute it within one node in the build graph
This needs to be cleaned up since Bazel is getting stricter with
disallowing iteration over depsets

PR Close #30600
2019-05-22 16:22:10 -07:00
Keen Yee Liau e688e02ee4 fix(bazel): ng test should run specific ts_web_test_suite (#30526)
PR closes https://github.com/angular/angular/issues/30191

PR Close #30526
2019-05-20 16:40:11 -07:00
Keen Yee Liau b6b1aec22b fix(bazel): Disable sandbox on Mac OS (#30460)
Removing the sandbox improves build time by almost 40%.

For a hello world (ng new) application:
ng build with sandbox: 22.0 seconds
ng build without sandbox: 13.3 seconds

PR Close #30460
2019-05-16 09:43:54 -07:00
Keen Yee Liau ff29cccb77 fix(bazel): Use existing npm/yarn lock files (#30438)
This PR fixes Bazel builder to create yarn_install rule in WORKSPACE if
yarn.lock is present, otherwise npm_install rule if package-lock.json is
present. If none is present, default to yarn_install and create an empty
yarn.lock file.

PR closes https://github.com/angular/angular/issues/30164
PR closes https://github.com/angular/angular/pull/30359

PR Close #30438
2019-05-14 11:37:33 -07:00
Alex Eagle 06efc340b6 build: update rules_nodejs and clean up bazel warnings (#30370)
Preserve compatibility with rollup_bundle rule.
Add missing npm dependencies, which are now enforced by the strict_deps plugin in tsc_wrapped

PR Close #30370
2019-05-14 10:08:45 -07:00
Alex Eagle 3fecab64b1 build: update to Bazel 0.26 (#30370)
PR Close #30370
2019-05-14 10:08:45 -07:00
Xin Gao 9abf114fbb feat(bazel): use rbe_autoconfig() and new container. (#29336)
After this PR is merged, maintainers no longer need to update .bazelrc
file, toolchain and platform related flags for RBE builds and tests
(unless there is a breaking change in Bazel related to those flags).

Maintainers just need to update the pin of @bazel-toolchains repo
regularly in the packages/bazel/package.bzl file according to
https://releases.bazel.build/bazel-toolchains.html to include the
latest checked-in toolchain configs. If rbe_autoconfig() cannot find
appropriate toolchain configs for the version of Bazel in the version of
@bazel_toolchains repo that is currently used by this project, it will pull
down the container and generate the configs on the fly as the beginning
of the build/test.

PR Close #29336
2019-05-09 14:58:34 -07:00
Alan 3aff79c251 fix(bazel): pass correct arguments to http_server in Windows (#30346)
Under Windows, the server binary has an extension of  `.exe` and the current logic is not handling that.

Partially addresses: #29785

PR Close #30346
2019-05-09 11:20:51 -07:00
Keen Yee Liau 2a0f497e94 fix(bazel): Directly spawn native Bazel binary (#30306)
Instead of launching a Node.js process that in turn spawns Bazel binary,
the Builder could now directly spawn the native binary. This makes the
bootup process slightly more efficient, and allows the Builder to
control spawn options. This works with both Bazel and iBazel.

PR Close #30306
2019-05-07 16:51:41 -07:00
Keen Yee Liau 1353bf0277 fix(bazel): Bump ibazel to 0.10.1 for windows fixes (#30196)
PR Close #30196
2019-04-29 13:29:12 -07:00
Alan Agius 67012509a8 test: fix ngc-wrapped bazel tests in windows (#30111)
Partially addresses #29785

PR Close #30111
2019-04-29 13:23:44 -07:00
Alex Eagle 4ae0ee86cb fix(bazel): update peerDep ranges (#30155)
PR Close #30155
2019-04-26 12:32:35 -07:00
Keen Yee Liau 1f4c380f58 fix(bazel): Exclude common/upgrade* in metadata.tsconfig.json (#30133)
It has a dependency on @angular/upgrade which is not part of the
dependencies in package.json, so postinstall would fail.

PR Close #30133
2019-04-26 11:07:34 -07:00
Brandon Roberts 6de4cbdd41 fix(common): add upgrade sub-package to ng_package rule for @angular/common (#30117)
Follow-up to #30055 to include @angular/common/upgrade in the npm package

Closes #30116

PR Close #30117
2019-04-25 15:01:17 -07:00
Greg Magolan 61365a94ed fix(bazel): transitive npm deps in ng_module (#30065)
BREAKING CHANGE:

ng_module now depends on a minimum of build_bazel_rules_nodejs 0.27.12

PR Close #30065
2019-04-25 14:42:02 -07:00
Keen Yee Liau 0b5f480eca fix(bazel): make name param in ng add optional (#30074)
PR Close #30074
2019-04-24 10:45:42 -07:00
Keen Yee Liau 2905bf5548 fix(bazel): Make sure only single copy of `@angular/bazel` is installed (#30072)
When `ng add` is invoked independently of `ng new`, a node installation
of `@angular/bazel` is performed by the CLI before invoking the
schematic. This step appends `@angular/bazel` to the `dependencies`
section of `package.json`. The schematics then appends the same package
to `devDependencies`.

This leads to the warning:

```
warning package.json: "dependencies" has dependency "@angular/bazel" with
range "^8.0.0-beta.13" that collides with a dependency in "devDependencies"
of the same name with version "~8.0.0-beta.12"
```

PR Close #30072
2019-04-24 10:44:42 -07:00
Keen Yee Liau 96a828993f fix(bazel): restore ng build --prod (#30005)
`ng build` by default builds the prodapp because there is not
a dev build in Bazel. This PR restores the `--prod` to do the
same to prevent achitect from showing missing config error.

PR Close #30005
2019-04-22 08:47:21 -07:00
Alex Rickabaugh d9ce8a4ab5 feat(ivy): introduce a flag to control template type-checking for Ivy (#29698)
Template type-checking is enabled by default in the View Engine compiler.
The feature in Ivy is not quite ready for this yet, so this flag will
temporarily control whether templates are type-checked in ngtsc.

The goal is to remove this flag after rolling out template type-checking in
google3 in Ivy mode, and making sure the feature is as compatible with the
View Engine implementation as possible.

Initially, the default value of the flag will leave checking disabled.

PR Close #29698
2019-04-19 11:15:25 -07:00
Paul Gschwendtner 2ba799ddc7 fix(bazel): do not typecheck core schematic files (#29876)
Currently for Angular Bazel projects, NGC needs to be run in the
"postinstall" NPM script in order to generate required summary files.

We need to update the postinstall `tsconfig` to not check/re-build the
`@angular/core` schematic code which has transitive dependencies
which are only available inside of a CLI project. As this is not guaranteed
to be the case with Angular Bazel projects, we need to make sure that
we don't check/re-build these files.

PR Close #29876
2019-04-18 18:22:09 -07:00
Keen Yee Liau 0629ebd9e9 build(bazel): Bump CLI and @angular-devkit/* to v8 beta 15 (#29966)
PR Close #29966
2019-04-18 13:53:33 -07:00
Alex Eagle b9251fd707 build: Remove cc_binary dependency on brotli (#29912)
Just use the JavaScript port instead. We don't care about speed since we compress once as a build step.

PR Close #29912
2019-04-17 17:20:16 -07:00
Greg Magolan 8a3a556c0c build(bazel): fix failure in http_server target due to transitive npm deps (#29799)
PR Close #29799
2019-04-17 13:02:03 -07:00
Greg Magolan 7edfcf948f build(bazel): update to nodejs rules 0.27.12 and pin versions in @angular/bazel peer deps and for @bazel/schematics (#29799)
PR Close #29799
2019-04-17 13:02:03 -07:00
Yun Peng ca755a6b72 build: Fix label name (#29777)
Fix the following error with future Bazel version:
```
 Invalid label: invalid target name 'internal/npm_package:npm_package.bzl': target names may not contain ':'
```

PR Close #29777
2019-04-16 09:50:19 -07:00
Keen Yee Liau 7a7781e925 refactor(bazel): Remove NodeJsSyncHost (#29796)
`NodeJsSyncHost` is no longer provided by BuilderContext in
architect v2, and its usage caused subtle path resolution issues
in Windows.

This PR cleans up `@angular/bazel` builder to use all native path
and fs methods.

PR Close #29796
2019-04-15 10:52:03 -07:00
Keen Yee Liau bd2ce9cd56 fix(bazel): Install packages after `ng add` when invoked independently (#29852)
PR Closes https://github.com/angular/angular/issues/29573

PR Close #29852
2019-04-15 10:50:49 -07:00
Keen Yee Liau cc2e4b639b fix(bazel): docs formatting (#29817)
PR Close #29817
2019-04-11 08:21:38 -07:00
Filipe Silva ef85336719 build: update to TypeScript 3.4 (#29372)
PR Close #29372
2019-04-10 12:12:16 -07:00
Greg Magolan db62ccf9eb build(bazel): pin versions of nodejs rules in @angular/bazel peer deps and @bazel/schematics (#29800)
PR Close #29800
2019-04-09 19:33:18 -07:00
Alan Agius 902a53a4f6 feat(bazel): update the build to use the new architect api (#29720)
With this change the builder has been updated to use the latest architect API and make it compatable with the latest CLI

Fixes https://github.com/angular/angular-cli/issues/14082

PR Close #29720
2019-04-08 09:47:34 -07:00
Rado Kirov f8cdda63d4 refactor: uniformly access all index sigs with index access. (#29390)
Follow-up to https://github.com/angular/angular/pull/28937

A build-time check to enforce this is part of tsetse -
https://tsetse.info/property-renaming-safe but I don't know how to turn
it on for this repositories bazel builds.

PR Close #29390
2019-04-05 09:34:26 -07:00
Greg Magolan 9c056b974a build(bazel): tslib.js still required in ts_devserver & ts_web_test_suite for schematics (#29694)
PR Close #29694
2019-04-04 14:27:05 -07:00
Greg Magolan c0ec8425c2 build(bazel): remove unnecessary scripts from ts_devserver & ts_web_test_suite in bazel schematics (#29694)
PR Close #29694
2019-04-04 14:27:05 -07:00
Greg Magolan 2e66ddfdce fix(bazel): add configuration_env_vars = ["compile"] to generated @npm//@angular/bazel/bin:ngc-wrapped nodejs_binary (#29694)
PR Close #29694
2019-04-04 14:27:04 -07:00
Greg Magolan 7fbe138b1f build(bazel): update to nodejs rules 0.27.10 (#29694)
PR Close #29694
2019-04-04 14:27:04 -07:00
Keen Yee Liau 2bd9214435 fix(bazel): remove karma-jasmine from ts_web_test_suite (#29695)
It's not needed.

PR Close #29695
2019-04-04 14:26:11 -07:00
Alan 9810c6c0f9 fix(bazel): support running ng-add on minimal applications (#29681)
Minimal applications don't have `test` and `e2e` targets but we are not currently checking if they exists.

Fixes #29680

PR Close #29681
2019-04-03 15:30:46 -07:00
Alex Eagle b14537a004 fix(bazel): use //:tsconfig.json as the default for ng_module (#29670)
This matches the behavior of ts_library

PR Close #29670
2019-04-02 15:57:11 -07:00
Greg Magolan 7c1f73ac7b build(bazel): update to nodejs rules 0.27.9 (#29647)
PR Close #29647
2019-04-02 10:27:14 -07:00
Alex Eagle aaa8a3a957 build: update bazel to 0.24 (#29530)
PR Close #29530
2019-03-27 13:45:29 -07:00
Keen Yee Liau 401b8eedd5 fix(bazel): Update schematics to support routing (#29548)
PR closes https://github.com/angular/angular/issues/29035

PR Close #29548
2019-03-27 12:35:52 -07:00
Greg Magolan d9162a872d build(bazel): update to nodejs rules 0.27.8 (#29508)
* fixes prodmode issue in integration/bazel

BREAKING CHANGE:

@bazel/typescript is now a peerDependency of @angular/bazel so user's of @angular/bazel must add @bazel/typescript to their package.json

PR Close #29508
2019-03-27 09:41:11 -07:00
Marc Laval c412374854 fix(ivy): DebugNode.query should query nodes in the logical tree (#29480)
PR Close #29480
2019-03-26 12:48:37 -07:00
Alex Eagle 769d960db1 fix(bazel): workaround problem reading summary files from node_modules (#29459)
PR Close #29459
2019-03-22 13:17:00 -07:00
Alex Eagle 21be0fb926 fix(bazel): allow ng_module users to set createExternalSymbolFactoryReexports (#29459)
PR Close #29459
2019-03-22 13:17:00 -07:00
Keen Yee Liau d6d081e120 feat(bazel): Upgrade rules_nodejs and rules_sass (#29388)
PR Close #29388
2019-03-20 13:42:03 -04:00
Greg Magolan b460b26308 build(bazel): update to nodejs rules 0.27.7 (#29375)
PR Close #29375
2019-03-19 23:39:37 -04:00
Greg Magolan ea0e832e5f build(bazel): update to nodejs rules 0.27.6 (#29375)
PR Close #29375
2019-03-19 23:39:36 -04:00
Alex Eagle 9d090cb3db fix(bazel): correct regexp test for self-references in metadata (#29346)
Add a test that catches the mistake, should have had this in the previous change

PR Close #29346
2019-03-18 07:17:19 -07:00
Keen Yee Liau 8ef690c342 fix(bazel): Support new e2e project layout (#29318)
https://github.com/angular/angular-cli/pull/13780 changes the project
layout for the e2e application. It is no longer a separate project
and the e2e directory is now located alongside the existing project.

This commit updates Bazel scheamtics to support both old and new project
layout.

PR Close #29318
2019-03-15 00:16:01 -04:00
Alex Eagle 3facdebd07 fix(bazel): don't produce self-references in metadata (#29317)
Fixes #29315

PR Close #29317
2019-03-15 00:15:41 -04:00
Keen Yee Liau 1db8bf312e fix(bazel): Remove @angular/upgrade from dev dependencies (#29319)
@angular/upgrade is unnecessary, but it's required by router/upgrade.

PR Close #29319
2019-03-15 00:15:17 -04:00
Matias Niemelä fc8048ddaf build: update to nodejs rules 0.27 (#29210)
PR Close #29210
2019-03-14 19:35:00 -07:00
Matias Niemelä b2aadffbbc revert: build: update to nodejs rules 0.27 (#29210)
This reverts commit 08231f0bfa.
2019-03-14 17:38:35 -07:00
Alex Eagle 410ccacf38 build: disable tsc_wrapped workers (#29197)
Angular devs are hitting a bug with typings forcing them to run "bazel shutdown"

PR Close #29197
2019-03-14 13:11:36 -04:00
Greg Magolan 4990b935b4 fix(bazel): turn off pure call tree shaking for ng_package (#29210)
PR Close #29210
2019-03-14 11:38:12 -04:00
Greg Magolan 08231f0bfa build: update to nodejs rules 0.27 (#29210)
PR Close #29210
2019-03-14 11:38:12 -04:00
Greg Magolan 7b20cec986 build(bazel): fix tsconfig extends for //packages/bazel/test/protractor-2:ts_spec (#29280)
PR Close #29280
2019-03-13 10:39:21 -07:00
Igor Minar 75748d6044 feat: add support for TypeScript 3.3 (and drop older versions) (#29004)
https://blogs.msdn.microsoft.com/typescript/2019/01/31/announcing-typescript-3-3/

BREAKING CHANGE: TypeScript 3.1 and 3.2 are no longer supported.

Please update your TypeScript version to 3.3

PR Close #29004
2019-03-13 10:38:37 -07:00
Greg Magolan 9a7f5601fa fix(bazel): fix strict null checks compile error in packages/bazel/src/schematics/ng-add/index.ts (#29282)
PR Close #29282
2019-03-13 10:38:13 -07:00
Alan Agius df354d1b34 fix(bazel): add missing binary path for api-extractor (#29202)
`api-extractor` binary is required for external consumers of `ng_module` that want to use the `bundle_dts` flag.

This also sets a different api-exttractor binary to use for ng_module, based if it's internal or external.

PR Close #29202
2019-03-12 10:49:49 -07:00
Alan 7b0e9eddd1 build: enable bundle_dts for core package (#28884)
`ng_module` will now include an `src/r3_symbol.d.ts` when compiling the core package under `ngc` togather with `dts bundling`, This is due that `ngcc` relies on this file to be present, but the `r3_symbols` file which is not part of our public api.

With this change, we can now ship an addition dts file which is flattened.

PR Close #28884
2019-03-08 12:36:55 -08:00
Keen Yee Liau f4f20daee3 refactor(bazel): Remove bazel-workspace schematics (#29148)
`bazel-workspace` schematics is no longer needed now that the Bazel
files are injected into the project by the Bazel builder.

PR Close #29148
2019-03-07 13:04:09 -08:00
Keen Yee Liau 36a1550e00 feat(bazel): Eject Bazel (#29167)
Add command line flag to expose Bazel files on disk.

`ng build --leaveBazelFilesOnDisk`

PR Close #29167
2019-03-07 13:03:44 -08:00
Alan 9a1959269f build: remove now redundant `bundle_dts = True` attribute (#29128)
This is now turned on by default in the ng_module macro

PR Close #29128
2019-03-07 10:47:20 -08:00
Keen Yee Liau 7060d9038b feat(bazel): Hide Bazel files in Bazel builder (#29110)
This commit modifies the Bazel builder to copy the Bazel WORKSPACE and
BUILD.bazel files to the project root directory before invoking Bazel.

This hides the Bazel files from users.

PR Close #29110
2019-03-06 17:35:06 -08:00
Keen Yee Liau 14ce8a9c31 fix(bazel): ng build should produce prod bundle (#29136)
`ng build` should produce a bundle that could be readily deployed to
a web server, similar to the behavior of current `ng build` with
webpack.

Note that in Bazel, there is no `ng build` for dev bundles. Instead,
users are expected to run `ts_devserver`.

Closes https://github.com/angular/angular/issues/28877

PR Close #29136
2019-03-06 16:41:25 -08:00
Alex Eagle ba602dbaec build: update Bazel to 0.23 (#29058)
PR Close #29058
2019-03-01 15:24:05 -08:00
Alan b5629d98d8 fix(bazel): api extractor don't generate tsdoc metadata (#29023)
tsdoc metadata is not needed for `ng_module` and with `@microsoft/api-extractor` version 7.0.21 there is a new flag to disable it's generation.

See: https://github.com/Microsoft/web-build-tools/issues/1051

PR Close #29023
2019-03-01 10:16:43 -08:00
Keen Yee Liau c532646f5b fix(bazel): ng serve should always watch (#29032)
PR Close #29032
2019-02-28 12:07:25 -08:00
Greg Magolan ea09430039 build: rules_nodejs 0.26.0 & use @npm instead of @ngdeps now that downstream angular build uses angular bundles (#28871)
PR Close #28871
2019-02-28 12:06:36 -08:00
Keen Yee Liau 5fdf24e843 fix(bazel): add favicon to web package (#29017)
This would fix the RESOURCE_NOT_FOUND error.

PR Close #29017
2019-02-28 10:38:00 -08:00
Greg Magolan 7b944c46d3 style: format (#28995)
PR Close #28995
2019-02-27 08:47:26 -08:00
Greg Magolan c4c3c1231b build(bazel): allow a user to control a subset of angularCompilerOption in their tsconfig file when using ng_module (#28995)
PR Close #28995
2019-02-27 08:47:26 -08:00
Wassim Chegham dad5a258b8 style: enforce buildifier lint on CI (#28186)
PR Close #28186
2019-02-26 16:57:41 -08:00
Wassim Chegham ce68b4d839 style: enforce buildifier lint on CI (#28186)
PR Close #28186
2019-02-26 16:57:41 -08:00
Keen Yee Liau dc335194ab fix(bazel): Add SHA256 for rules_sass (#28994)
This will make the debugging output go away
DEBUG: Rule 'io_bazel_rules_sass' modified arguments {"sha256": "6caffb8277b3033d6b5117b77437faaa6cd3c6679d6d6c81284511225aa54711"}

PR Close #28994
2019-02-26 16:56:47 -08:00
Adam Yi edb6c2d814 feat(bazel): add ts_config extending support for ng_module (#21883)
PR Close #21883
2019-02-26 02:01:37 +00:00
Alex Eagle 350802b207 build: update to latest bazel rules (#28931)
PR Close #28931
2019-02-22 17:27:09 -08:00
Greg Magolan fafabc0b92 build(bazel): use http_server rule from rules_nodejs (#28905)
PR Close #28905
2019-02-22 12:14:55 -08:00
Keen Yee Liau 7f3e3a8c45 docs(bazel): Use CLI 8 for Bazel schematics (#28908)
CLI 8 (beta) is needed so that the projects pull in Angular version 8.
It will no longer build Angular from source.

PR Close #28908
2019-02-22 10:51:35 -08:00
Keen Yee Liau 1145bdb478 fix(bazel): Pin browsers for schematics (#28913)
PR closes https://github.com/angular/angular/issues/28724

PR Close #28913
2019-02-21 17:55:36 -08:00
Greg Magolan ebffde7143 build: update to rules_typescript 0.25.1 (#28625)
Updated a spot in the compiler which assumed es5 downlevelling get ready for es2015 devmode in the future.

PR Close #28625
2019-02-21 07:46:21 -08:00
Keen Yee Liau 9ae14db343 fix(bazel): rxjs_umd_modules should always be present (#28881)
This commit fixes the bug whereby `rxjs_umd_modules` would only be generated
when Sass files are used.

PR closes https://github.com/angular/angular/issues/28878

PR Close #28881
2019-02-21 00:14:14 -08:00
Keen Yee Liau e5e4e63e71 refactor(bazel): Schematics should fetch angular from distro (#28851)
PR Close #28851
2019-02-20 09:01:44 -08:00
Keen Yee Liau 96b597cfd0 fix(bazel): Add postinstall step to generate summaries (#28850)
This commit adds a postinstall step to the package.json generated by the
schematics to generate ng summary files needed for AOT. Summary files
are not published in npm packages.

PR Close #28850
2019-02-19 22:29:27 -08:00
Alex Eagle 1eccf64b15 build: Add .bzl/BUILD files to @angular/bazel package (#28769)
It's now possible to use it as a hybrid package in latest rules_nodejs, so no WORKSPACE dep is needed

PR Close #28769
2019-02-19 17:55:57 -08:00
Keen Yee Liau 2d804198d5 fix(bazel): Schematics should upgrade rxjs to 6.4.0 (#28841)
Since rxjs is no longer built from source in Bazel schematics, the
minimum version ought to be at least 6.4.0.

This commit adds function to bump the version in package.json.

PR Close #28841
2019-02-19 16:32:15 -08:00
Greg Magolan 25aae64274 build(bazel): do not build rxjs from source under Bazel (#28720)
PR Close #28720
2019-02-19 16:28:14 -08:00
Filipe Silva 1923c2f99c feat(compiler-cli): make enableIvy ngtsc/true equivalent (#28616)
Currently setting `enableIvy` to true runs a hybrid mode of `ngc` and `ngtsc`. This is counterintuitive given the name of the flag itself.

This PR makes the `true` value equivalent to the previous `ngtsc`, and `ngtsc` becomes an alias for `true`. Effectively this removes the hybrid mode as well since there's no other way to enable it.

PR Close #28616
2019-02-19 12:28:44 -08:00
Paul Gschwendtner 7cbc36fdac build: remove unused rollup.config.js files (#28646)
Since we build and publish the individual packages
using Bazel and `build.sh` has been removed, we can
safely remove the `rollup.config.js` files which are no
longer needed because the `ng_package` bazel rule
automatically handles the rollup settings and globals.

PR Close #28646
2019-02-14 19:28:08 +00:00
Keen Yee Liau 65c2deacbb refactor(bazel): Fix warning about overridden tsconfig options (#28674)
Under Bazel, some compilerOptions in tsconfig.json are controlled by
downstream rules. The default tsconfig.json causes Bazel to print out
warnings about overriden settings.

This commit makes a backup of the original tsconfig.json and removes
tsconfig settings that are controlled by Bazel.

As part of this fix, JsonAst utils are refactored into separate package
and unit tests are added.

PR closes https://github.com/angular/angular/issues/28034

PR Close #28674
2019-02-13 21:24:19 -08:00
Alex Eagle 8cec4b3ff7 build: make api-extractor work in google3 (#28588)
PR Close #28588
2019-02-13 19:16:29 -08:00
Alan Agius 9e5d1357fe build: update `@microsoft/api-extractor` to `7.0.17` (#28588)
This fixes one of the problems that we reported https://github.com/Microsoft/web-build-tools/issues/1048

PR Close #28588
2019-02-13 19:16:29 -08:00
Alan Agius 3bb3d6d3e6 test: update ng_package tests to use bundle_dts (#28588)
PR Close #28588
2019-02-13 19:16:29 -08:00
Alan Agius 3d39100c85 feat(bazel): add dts bundler as action to ng_module (#28588)
This enabled dts flattening in the final distrubutable package.

Notes:
 - For the time being this is an opt-in feature via the `ng_module` attribute  `bundle_dts`, however in the near future this will be turned on by default.
 - This only supports the legacy compiler `ngc`, as `ngtsc` emits namespaced imports `import * as __` from local modules which is not supported for the time being by API Extractor. See: https://github.com/Microsoft/web-build-tools/issues/1029

Ref: TOOL-611

PR Close #28588
2019-02-13 19:16:29 -08:00
Alex Rickabaugh 423b39e216 feat(ivy): use fileNameToModuleName to emit imports when it's available (#28523)
The ultimate goal of this commit is to make use of fileNameToModuleName to
get the module specifier to use when generating an import, when that API is
available in the CompilerHost that ngtsc is created with.

As part of getting there, the way in which ngtsc tracks references and
generates import module specifiers is refactored considerably. References
are tracked with the Reference class, and previously ngtsc had several
different kinds of Reference. An AbsoluteReference represented a declaration
which needed to be imported via an absolute module specifier tracked in the
AbsoluteReference, and a RelativeReference represented a declaration from
the local program, imported via relative path or referred to directly by
identifier if possible. Thus, how to refer to a particular declaration was
encoded into the Reference type _at the time of creation of the Reference_.

This commit refactors that logic and reduces Reference to a single class
with no subclasses. A Reference represents a node being referenced, plus
context about how the node was located. This context includes a
"bestGuessOwningModule", the compiler's best guess at which absolute
module specifier has defined this reference. For example, if the compiler
arrives at the declaration of CommonModule via an import to @angular/common,
then any references obtained from CommonModule (e.g. NgIf) will also be
considered to be owned by @angular/common.

A ReferenceEmitter class and accompanying ReferenceEmitStrategy interface
are introduced. To produce an Expression referring to a given Reference'd
node, the ReferenceEmitter consults a sequence of ReferenceEmitStrategy
implementations.

Several different strategies are defined:

- LocalIdentifierStrategy: use local ts.Identifiers if available.
- AbsoluteModuleStrategy: if the Reference has a bestGuessOwningModule,
  import the node via an absolute import from that module specifier.
- LogicalProjectStrategy: if the Reference is in the logical project
  (is under the project rootDirs), import the node via a relative import.
- FileToModuleStrategy: use a FileToModuleHost to generate the module
  specifier by which to import the node.

Depending on the availability of fileNameToModuleName in the CompilerHost,
then, a different collection of these strategies is used for compilation.

PR Close #28523
2019-02-13 19:13:11 -08:00
Greg Magolan 28bdeeef3e build(bazel): update to rules_nodejs 0.18.6 (#28699)
PR Close #28699
2019-02-13 12:13:08 -08:00
Keen Yee Liau 2ea030c2c5 fix(bazel): Turn on strict action env (#28675)
This commit fixes a bug whereby recompilation occurs every time `yarn ng build`
or `yarn bazel build ...` is invoked.

This is a temporary solution until # https://github.com/bazelbuild/bazel/issues/7026
is fixed.

PR Close #28675
2019-02-13 09:52:51 -08:00
Keen Yee Liau 49fb8c3cb0 fix(bazel): Install angular repo before yarn_install (#28670)
PR closes https://github.com/angular/angular/issues/28636

PR Close #28670
2019-02-13 09:52:30 -08:00
Keen Yee Liau 0c7581da89 refactor(bazel): use multi_sass_binary rule (#28669)
`multi_sass_binary` rules is reinstated in rules_sass v1.17.0
and it is a better solution than list comprehension currently used
because it handles imports correctly.

PR Close #28669
2019-02-13 09:52:10 -08:00
Paul Gschwendtner 91b7152852 feat(compiler-cli): no longer re-export external symbols by default (#28633)
With #28594 we refactored the `@angular/compiler` slightly to
allow opting out from external symbol re-exports which are
enabled by default.

Since symbol re-exports only benefit projects which have a
very strict dependency enforcement, external symbols should
not be re-exported by default as this could grow the size of
factory files and cause unexpected behavior with Angular's
AOT symbol resolving (e.g. see: #25644).

Note that the common strict dependency enforcement for source
files does still work with external symbol re-exports disabled,
but there are also strict dependency checks that enforce strict
module dependencies also for _generated files_ (such as the
ngfactory files). This is how Google3 manages it's dependencies
and therefore external symbol re-exports need to be enabled within
Google3.

Also "ngtsc" also does not provide any way of using external symbol
re-exports, so this means that with this change, NGC can partially
match the behavior of "ngtsc" then (unless explicitly opted-out).

As mentioned before, internally at Google symbol re-exports need to
be still enabled, so the `ng_module` Bazel rule will enable the symbol
re-exports by default when running within Blaze.

Fixes #25644.

PR Close #28633
2019-02-13 09:49:51 -08:00
Vladimir Moskva 6f9dd1bf28 refactor(common): Remove deprecated FileType (#28583)
FileType objects are deprecated. They are not required for specifying valid file types for rule attributes, a list of strings can be used instead.

PR Close #28583
2019-02-07 16:45:22 -08:00
Kristiyan Kostadinov 8d90142a0f build: disable sandbox when running protractor through bazel (#28557)
Adds `--no-sandbox` in order to disable the sandbox when running Protractor through Bazel. Enabling the sandbox causes Chrome to crash under certain environments.

PR Close #28557
2019-02-06 21:22:37 -08:00
Greg Magolan 4142db0828 style: run format (#28532)
PR Close #28532
2019-02-05 16:55:43 -05:00
Greg Magolan 7a6237bc50 build: update lock files (#28532)
PR Close #28532
2019-02-05 16:55:43 -05:00
Greg Magolan 62c0deac42 build: fix for integration test bazel-schematics (#28532)
PR Close #28532
2019-02-05 16:55:43 -05:00
Greg Magolan cec1fa04c2 build: remove all deps on io_bazel_rules_go (#28532)
PR Close #28532
2019-02-05 16:55:43 -05:00
Greg Magolan 0d1e065a1c build: update to rules_typescript 0.23.2 and rules_nodejs 0.16.8 (#28532)
PR Close #28532
2019-02-05 16:55:43 -05:00
Keen Yee Liau 4a92fa9471 refactor(bazel): Create `ng-add` schematic for Bazel (#28436)
The logic to create additional files needed for Bazel are currently
hosted in `ng new`. Such files include the main.*.ts files needed
for AOT and a different angular.json to use Bazel builder, among others.

This commit refactors the logic into `ng add` so that it can be used to
perform the same modifications in an existing project. Users could do so
by running `ng add @angular/bazel`.

With this change, `ng new` effectively becomes an orchestrator that runs
the original `ng new` followed by `ng add @angular/bazel`.

PR Close #28436
2019-02-05 14:40:46 -05:00
Paul Gschwendtner b7738ef9e4 build: fix bazel protractor tests not capturing console output (#28490)
Currently we depend on the "rules_webtesting" version that is
installed by "rules_typescript//:package.bzl". This version of
the webtesting rules comes with a very old version of Chromium
and the `chromedriver` that does not support capturing console
errors properly (with stack traces). Since we have a few e2e
tests that depend on console output (e.g. playground/src/source-map),
we need to make sure that these tests can pass upon Bazel
migration.

PR Close #28490
2019-02-04 16:51:11 -05:00
Keen Yee Liau a98d66078d docs(bazel): Explain explicit version requirement (#28482)
PR Close #28482
2019-02-04 14:56:46 -05:00
Keen Yee Liau 36902e2f0e fix(bazel): Bazel builder resolves with require.resolve() (#28478)
This commit fixes a bug in the Bazel builder in which the path to Bazel
executable is constructed using the project path. For non-default
project, the node_modules directory is actually one level above the
project path.

This PR fixes the bug by resolving node_modules with require.resolve().
It requires @bazel/bazel v0.22.1 because previous versions do not have
index.js or main field in package.json and would cause node module
resolution to fail.

This has been tested with both bazel and ibazel.

PR Close #28478
2019-02-01 13:56:53 -05:00
Filipe Silva 70e426ba1b fix(bazel): also pass afterDeclarations transformers to emitWithTsickle (#28342)
Tsickle supports afterDeclarations transformers, but these were not being passed in.

PR Close #28342
2019-01-29 12:00:55 -08:00
Keen Yee Liau c84739dc55 test(bazel): Integration test for Sass support (#28297)
Add .sass files to the integration test for bazel-schematics.

Also addressed Alex's comment in
https://github.com/angular/angular/pull/28167/files#r248149866
about the unit tests being too brittle.

PR Close #28297
2019-01-28 20:01:18 -08:00