Commit Graph

299 Commits

Author SHA1 Message Date
Daniel Ruf 0a564c3158 refactor: fix code style (#28203)
PR Close #28203
2019-01-23 10:58:38 -08:00
Daniel Ruf b9854e582f refactor: remove unused parameters (#28203)
PR Close #28203
2019-01-23 10:58:37 -08:00
Keen Yee Liau c1c87462fd build(bazel): Use local rollup & build-optimizer for ng_rollup_bundle (#28215)
The current build workflow depends on cross workspace dependency by
installing angular-cli as a Bazel repository. This is not ideal because
it introduces separate node_module directories other than the one
installed by Angular through the yarn_install rule (ngdeps).

This commit removes angular-cli from the Bazel workspace and installs
rollup and @angular-devkit/build-optimizer locally.

PR Close #28215
2019-01-18 09:07:52 -08:00
Igor Minar 73616ab237 fix(bazel): increase node memory limit for ng_module rule to prevent OOM for big modules (#28237)
This came up as a request from an internal Google team.

Context:
- http://cl/229881085
- https://groups.google.com/a/google.com/forum/#!topic/nodejs/GLqDEOW0MV4

PR Close #28237
2019-01-18 09:06:54 -08:00
Keen Yee Liau f59f18c13e feat(bazel): Add support for SASS (#28167)
This commit adds the appropriate rules to the WORKSPACE for a project
that requires SASS support.

PR Close #28167
2019-01-16 17:35:54 -08:00
Keen Yee Liau 06e5bf1661 fix(bazel): Bazel schematics should add router package (#28141)
This commit fixes a bug whereby a Bazel project created by the
schematics would not compiled if project contains routing module.

It is missing a dependency on the router package.

PR Close #28141
2019-01-14 17:12:00 -08:00
Paul Gschwendtner d12db4e114 fix(bazel): incorrectly always uses ngc-wrapped from "npm" workspace (#28137)
* This is a follow-up to cd0451305a which fixes that "ngc-wrapped" from the "npm" workspace is always used if "angular" is fetched as an external dependency.

PR Close #28137
2019-01-14 14:12:18 -08:00
Paul Gschwendtner cd0451305a fix(bazel): replay compilation uses wrong compiler for building esm5 (#28053)
With the update to TypeScript 3.2.x, a big issue seems to have appeared for downstream Bazel users. If the downstream user still uses a lower TypeScript version, normal Bazel targets using the `ng_module` rule are still compiled with the correct/old TypeScript version (assuming they set the `node_modules` attribute properly).

But, if they build the previous Bazel targets by specifying them within a `ng_package` rule, the TypeScript version from the Angular `workspace` is being used for the replayed ESM5 compilation. This is because we resolve the replay compiler to `ngc_wrapped` or `tsc_wrapped` Bazel executables which are defined as part of the `angular` workspace. This means that the compilers are different if the downstream user uses `ngc-wrapped` from the `@npm` repository because the replayed compilation would use the compiler with `@ngdeps//typescript`.

In order to fix this, we should just use the compiler that is defined in the `@angular//BUILD.bazel` file. This target by defaults to the "@npm" workspace which is working for downstream users. This is similar to how it is handled for `tsc-wrapped`. `tsc-wrapped` works as expected for downstream users.

**Note**: This is not the ideal solution because ideally we would
completely respect the `compiler` option from the base `ng_module`, but
this is not possible in a hermetic way, unless we somehow accept the
`compiler` as an attribute that builds all transitive deps. This is
something we should explore in the future. For now, we just fix this in
a reasonable way that is also used for `tsc_wrapped` from the TypeScript
rules.

PR Close #28053
2019-01-14 10:44:24 -08:00
Keen Yee Liau e8495b460f refactor(bazel): use web_package rule for index.html (#27995)
index.html needs to have the zone.js and the project bundle injected
using script tags. This used to be done explicitly by specifying a
new index.html but with `web_package` rule introduced in rules_nodejs,
it is now possible to perform the injection dynamically.

PR Close #27995
2019-01-14 10:42:13 -08:00
Keen Yee Liau fc881390d0 docs(bazel): Getting started with Bazel + CLI (#27784)
PR Close #27784
2019-01-14 10:40:38 -08:00
Keen Yee Liau 605f450251 fix(bazel): Add ibazel to deps of Bazel project (#28090)
Incremental rebuilds is a fundamental part of the development
workflow. `@bazel/ibazel` should be added to the dev dependencies
of a Bazel project.

PR Close #28090
2019-01-11 15:58:38 -08:00
Filipe Silva b73d6781da build: support external angular in ng_rollup_bundle (#28049)
PR Close #28049
2019-01-11 14:31:11 -08:00
Suguru Inatomi b05baa59e0 fix(bazel): Add /bazel-out to .gitignore (#27874)
PR Close #27874
2019-01-10 13:40:28 -08:00
Paul Gschwendtner 65e72e958e fix(bazel): protractor rule does not run spec files with underscore (#28022)
There are various e2e tests with the `_spec.ts` suffix in the Angular project. Currently the protractor Bazel rule does not pick up these files and just ignores them. Since underscore is commonly used, we should support this.

Needed for the conversion fo the `examples` to Bazel.

PR Close #28022
2019-01-10 10:53:25 -08:00
Keen Yee Liau 5a0deb8d69 fix(bazel): Add @bazel/bazel to dev deps (#28032)
Project created by @angular/cli depends on Bazel at build time and
we should not assume that Bazel is available globally.
Instead, the project should specify an explicit dev dependency on
`@bazel/bazel`.

PR Close #28032
2019-01-09 17:45:16 -08:00
Keen Yee Liau 29e3144269 build(bazel): List explicit dependencies in WORKSPACE (#28000)
Instead of relying on implicit dependencies through Angular, the WORKSPACE
of the project should explicitly add rules_nodejs and rules_typescript so
it can better control the versions.

PR Close #28000
2019-01-09 11:49:08 -08:00
Paul Gschwendtner 935ce63b73 fix(bazel): flat module misses AMD module name on windows (#27839)
* Fixes that the flat module out files do not have a proper AMD module name on Windows. This is currently blocking serving a `ng_module` using the Bazel TypeScript `devserver` on Windows.

PR Close #27839
2019-01-09 10:42:37 -08:00
Paul Gschwendtner 9de9c8ad03 fix(bazel): protractor utils cannot start server on windows (#27915)
* Currently the protractor utils assume that the specified Bazel server runfile can be resolved by just using the real file system. This is not the case on Windows because the runfiles are not symlinked into the working directory and need to be resolved through the runfile manifest.

PR Close #27915
2019-01-07 14:49:44 -08:00
Paul Gschwendtner 8473d68ea8 fix(bazel): packager not properly removing amd directives on windows (#27829)
PR Close #27829
2019-01-07 14:46:46 -08:00
Paul Gschwendtner 4caf6540d1 fix(bazel): ng_package creates invalid typings reexport on windows (#27829)
Currently when building a package on Windows, the typings re-export for secondary entry-points is not valid TypeScript. Similarly the metadata and the "package.json" files use non-posix paths and cause inconsistency within the NPM package.

For example:

_package.json_
```
  "esm5": "./esm5\\core.js",
  "esm2015": "./esm2015\\core.js",
```

_testing.d.t.s_ (of the `core` package)
```
export * from './testing\testing';
```

PR Close #27829
2019-01-07 14:46:46 -08:00
Paul Gschwendtner 1e6c9be86c fix(bazel): unable to launch protractor test on windows (#27850)
Due to an incorrect environment variable name, it's currently not possible to launch Protractor on Windows using the Bazel protractor rule.

PR Close #27850
2019-01-03 09:36:37 -08:00
Alex Eagle d1de9ff313 build: update to latest rules_nodejs (#27764)
This includes a performance fix for module resolution in the common case under Ivy

PR Close #27764
2018-12-26 11:31:37 -08:00
Keen Yee Liau f57916c0d9 fix(bazel): devserver entry_module should have underscore name (#27719)
This commit fixes a bug whereby the path of the entry_module is not
consistent with the workspace name, which does not permit dashes
in the name.

PR Close #27719
2018-12-18 09:12:55 -08:00
Keen Yee Liau 85866defa4 fix(bazel): Set module_name and enable ng test (#27715)
Relative imports in Typescript files only work when module_name is
defined in ts_library (when run in Node.js).
See issue https://github.com/bazelbuild/rules_typescript/issues/360

With that fixed, `ng test` now works.

`ng build` requires `node_modules` to be available in the project
directory, so it's not usable yet. Running `yarn` in project directory
does not work because of postinstall version check.

PR Close #27715
2018-12-17 16:43:09 -08:00
Igor Minar 522919a537 fix(bazel): emit full node stack traces when Angular compilation crashes (#27678)
The default 10 items are often not enough to debug deeply nested compilation operations.

This PR is based on @martinprobst's http://cl/225528216.

PR Close #27678
2018-12-14 14:58:21 -08:00
Keen Yee Liau 3680aef801 test(bazel): integration test for ng new with Bazel (#27659)
integration test for bazel build and bazel test

PR Close #27659
2018-12-14 10:19:22 -08:00
Paul Gschwendtner 44dfa606ed fix(bazel): ng_package writes unrelevant definitions to bazel out (#27519)
In order to keep the bazel bin directory as clean as possible, we should not write definition files that are not relevant to a `ng_package` to an undesired location in the bazel bin directory. This currently just happens because we only filter out external definition files while we also should filter out definitions that aren't just in the current package.

The `packager.ts` file currently tries to write these files to the package, but fails because those are not inside of the current package. So the logic to create a relative path for the file fails, and the definition will be copied to a location like:

```js
// Notice the double "bazel-out" here.
C:\Users\Paul\_bazel_Paul\kn4tsvyh\execroot\angular_material\bazel-out\x64_windows-fastbuild\bin\src\bazel-out\x64_windows-fastbuild\bin\src\cdk
```

[See logic that causes this](4f9374951d/packages/bazel/src/ng_package/packager.ts (L105-L124)) (nothing wrong with that logic because it assumes that only paths from within the package are passed to it)

PR Close #27519
2018-12-13 14:58:38 -08:00
Alex Rickabaugh 6b96931576 fix(ivy): enable flat module index production in Bazel (#27655)
ngtsc now produces flat module index files when that option is enabled
in tsconfig, but Bazel still needs the output declared in order for them to
be passed through.

This fixes some tests which verify this behavior on Bazel.

FW-738 #resolve

PR Close #27655
2018-12-13 14:55:15 -08:00
Keen Yee Liau 8313ffc38d fix(bazel): Load http_archive and rules_nodejs dependencies (#27609)
Bazel 0.20 requires loading http_archive explicitly.
rules_nodejs dependencies must now be installed explicity as well.

PR Close #27609
2018-12-13 11:01:31 -08:00
Pete Bacon Darwin 3290fc3365 fix(bazel): fix TS errors in the `schematics/bazel-workspace` files (#27600)
Upgrading to the new `ts_library` rule uncovered TS errors in these
files. This commit fixes the code to pass TS checking.

PR Close #27600
2018-12-11 09:24:08 -08:00
Keen Yee Liau 30a3b49830 fix(bazel): Read latest versions from latest-versions.ts & use semver check (#27526)
When @angular/bazel is installed, a postinstall script is run to make sure that
the npm version is *exactly* the same as the Angular repository install by
Bazel. This check is overly stringent. Instead, it should enforce that the
version satisfies the range check instead. This is consistent with the range
defined in angular-cli/packages/schematics/angular/utility/latest-versions.ts.

This commit also fixes the Bazel workspace to use the same Rxjs version if it's
already installed.

PR Close #27526
2018-12-10 16:35:42 -08:00
Alex Eagle 50687e11cf build: fix type-check errors introduced during rules_ts 0.21 (#27586)
PR Close #27586
2018-12-10 16:33:41 -08:00
Keen Yee Liau 4da739a970 fix(bazel): Respect existing angular installation (#27495)
If user has already installed Angular, Bazel should fetch the same
version. Otherwise, user will see an error in the post-install step
that performs version check.

PR Close #27495
2018-12-06 13:36:19 -08:00
Alex Rickabaugh 0ae8c08b3c build(ivy): expect factories and summaries in Ivy mode (#27483)
Previously, Bazel/Blaze were only expecting .ngfactory.js and .ngsummary.js
files to be generated in legacy mode. ngtsc was attempting to write those
files, but they ended up being ignored at the Bazel level.

This commit causes Bazel to expect these files, and rearranges the logic
a little bit as the name 'include_ng_files' is now incorrect.

FW-514 FW-737 #resolve

PR Close #27483
2018-12-05 16:26:39 -08:00
Paul Gschwendtner c61a8b7b14 fix(bazel): do not throw if ts compile action does not create esm5 outputs (#27401)
In some applications, developers define a `ts_library` that just consists of `d.ts` files (e.g. to type `module.id`; see: https://github.com/angular/material2/blob/master/src/module-typings.d.ts), and expect the `esm5.bzl` file to not throw an error like:

```
  target.typescript.replay_params.outputs
struct' object has no attribute 'outputs'
```

The "replay_parameters" property will exist in that case, but is set to "None" because there is no action that should be replayed in favor of producing ES5 outputs. See: https://github.com/bazelbuild/rules_typescript/pull/326. Notice that this right now breaks similarly because an empty `struct()` is returned that does not have a property called `outputs`. [#326](https://github.com/bazelbuild/rules_typescript/pull/326) fixes that by being explicit that there is no _action_ at all.

PR Close #27401
2018-12-04 19:58:36 -08:00
Paul Gschwendtner 4f9374951d fix(bazel): ng_package cannot be run multiple times without clean (#27200)
Currently when building the `ng_package` multiple times, the old `ng_package` output will be copied over to the new `ng_package` content. Resulting in packages like `src/cdk/npm_package/npm_package/npm_package/AND_MORE`.

This happens because currently all TypeScript definition files are resolved from within the `binDir`. This is just wrong because it could then take up the `d.ts` files from the previous `ng_package` output. All typescript definitions that belong to the target package, should be resolved through Bazel and copied based on that computation.

Also fixes that `esm` files aren't written to the `ng_package` on Windows. This is because we try to flatten paths using the `path.delimiter` while the path is always using Posix delimiters (causing the paths to be incorrect)

PR Close #27200
2018-12-04 14:01:25 -08:00
Paul Gschwendtner 20a2bae1d3 fix(bazel): do not throw error when writing tsickle externs (#27200)
* Currently when building the ES5 and ES2015 output, `ngc_wrapped` will fail because it tries to write the `fs.openSync` the tsickle output file at the same time. This causes a runtime exception in Windows and can be fixed by just writing the externs for ES5 mode to the proper ES5 "output root".

PR Close #27200
2018-12-04 14:01:24 -08:00
Paul Gschwendtner 7d598801f0 fix(bazel): ng_package not generating UMD bundles on windows (#27200)
* Fixes that `ng_package` does not work generate UMD bundles on Windows because the `esm5/` files are not written to the output directory. This is because `rootDirs` and `rootDir` are posix paths and cause invalid relative paths when mixed with Windows backslash paths.

PR Close #27200
2018-12-04 14:01:24 -08:00
Keen Yee Liau 06d4a0c46e feat(bazel): ng-new schematics with Bazel (#27277)
This commit creates a schematics for ng new command that builds
the project with Bazel.

PR Close #27277
2018-12-03 14:38:23 -08:00
Alex Eagle f5f323dae0 build: only stamp version info when releasing (#27362)
Also build releases into a dedicated output_base so you can't
accidentally publish with outdated version stamp.

Bump the version of rules_nodejs so we don't need to create the
symlink_prefixes for the .publish command to work.

PR Close #27362
2018-11-30 16:08:23 -08:00
Igor Minar eb17502a7c fix(bazel): ng_package should correctly map to source maps in secondary entry-points (#27313)
This fixes the issue with broken source maps for @angular/common/http/testing.

Fixes #25510

PR Close #27313
2018-11-30 13:40:00 -08:00
Miško Hevery 4354fce2bb build: Replace iteration over depsets with an explicit .to_list() call. (#27336)
PR Close #27336
2018-11-29 21:22:39 -08:00
Igor Minar f7ba4b2ff9 fix(ivy): remove obsolete ng_module code for global and jit mode (#27278)
These paths are no longer needed / used.

I had to disable one jit mode spec because it fails now that we actually run it.
I root caused the jit test failure as missing forwardRef support. See FW-645.

PR Close #27278
2018-11-27 10:30:58 -08:00
Keen Yee Liau a72250bace build(bazel): Add Bazel builders (#27141)
PR Close #27141
2018-11-21 07:46:42 -08:00
Alex Eagle 81e975ad93 build: update to latest Bazel rules_typescript (#27138)
PR Close #27138
2018-11-17 12:19:32 -08:00
mrmeku b07bd30b70 feat(bazel): Bazel workspace schematics (#26971)
This commit creates a schematics for Bazel workspace.

PR Close #26971
2018-11-16 12:18:06 -08:00
Greg Magolan 15e671ec5a build(bazel): upgrade benchmarks to protractor_web_test_suite for CI without local chrome (#26908)
PR Close #26908
2018-11-07 16:47:39 -08:00
Alan Agius aed95fd8c7 fix(bazel): unknown replay compiler error in windows (#26711)
In Windows the compiler path ends with `.exe` thus it will never match and throw  `Unknown replay compiler`

PR Close #26711
2018-11-01 15:16:06 -07:00
Greg Magolan 332394d87c build(bazel): generalize fix for AMD name for flat module out file (#26837)
PR Close #26837
2018-10-30 18:37:12 -04:00
Greg Magolan 4e91ead40b style: format (#26708)
PR Close #26708
2018-10-24 12:13:46 -07:00
Greg Magolan 7f39f37003 fix(bazel): support --nolegacy_external_runfiles in protractor rule (#26708)
PR Close #26708
2018-10-24 12:13:46 -07:00
Igor Minar ee0b857172 build: rename the ivy compile mode 'local' to 'aot' (#26686)
PR Close #26686
2018-10-23 14:14:49 -07:00
Greg Magolan 83dc3c0ee0 build: add config_env_vars = ["compile"] to ngc-wrapped (#26471)
PR Close #26471
2018-10-23 08:57:42 -07:00
Igor Minar 57531737e5 build: add source-map-support to various rules within our repo (#26471)
This removes an verbose warning and adds source-mapping support to our build/ci.

Related issue: https://github.com/bazelbuild/rules_nodejs/issues/389

PR Close #26471
2018-10-23 08:57:42 -07:00
Greg Magolan 838a3f204f style: ran buildifier (#26488)
PR Close #26488
2018-10-19 20:59:29 -07:00
Greg Magolan 15c2467dbd build: review comments addressed (#26488)
PR Close #26488
2018-10-19 20:59:29 -07:00
Alex Eagle 74ea4e9b5d style: run buildifier (#26488)
PR Close #26488
2018-10-19 20:59:29 -07:00
Alex Eagle 2132c8f461 refactor(bazel): allow google3 overrides for external deps (#26488)
PR Close #26488
2018-10-19 20:59:29 -07:00
Greg Magolan 631998b2df build: idiomatic install of @angular/bazel npm package (#26258) (#26488)
PR Close #26488
2018-10-19 20:59:29 -07:00
Greg Magolan 6468711e16 build(bazel): update to rules_typescript 0.20.2 (#26279) (#26488)
PR Close #26488
2018-10-19 20:59:29 -07:00
Greg Magolan d698b0eadf build: update to rules_typescript 0.20.1 and rules_nodejs 0.15.0 (#26260) (#26488)
PR Close #26488
2018-10-19 20:59:29 -07:00
Greg Magolan 1f3331f5e6 build(bazel): use fine-grained npm deps (#26111) (#26488)
PR Close #26488
2018-10-19 20:59:29 -07:00
Alex Eagle 5b4cf38166 refactor(bazel): remove workaround for TS bug (#26516)
PR Close #26516
2018-10-19 11:14:24 -07:00
Greg Magolan b99d7ed5bf build(bazel): update to rules_typescript 0.17.0 & rules_nodejs 0.13.4 (#25920)
PR Close #25920
2018-09-18 13:05:38 -07:00
Greg Estren f3b552f51f build(bazel): remove outdated "cfg = "data"" references (#25434)
PR Close #25434

PR Close #25434
2018-09-11 08:27:39 -07:00
Miško Hevery 96eb79b1c7 build: add support for running builds outside of sandbox on Mac. (#25870)
Add following to your `~/.bazelrc`. This will run the build faster locally
(outside of sandbox), but continue running the builds with sandboxing
on CI.

```
build --spawn_strategy=standalone --strategy=ESM5=sandboxed
```
PR Close #25870
2018-09-07 16:06:55 -07:00
Greg Magolan 910381ddbd build(bazel): fix bazel types reference directive resolves (#25581)
PR Close #25581
2018-08-31 11:12:03 -07:00
Alex Eagle 3809e0fcae fix(bazel): protractor rule should include *.e2e-spec.js (#25701)
PR Close #25701
2018-08-30 21:21:27 -07:00
Alex Eagle f394ba0e27 fix(bazel): Cache fileNameToModuleName lookups (#25731)
This saves expensive re-parsing of the file when not run as a Bazel worker

PR Close #25731
2018-08-29 17:39:22 -04:00
Alex Eagle 42072c4d0d fix(bazel): only lookup amd module-name tags in .d.ts files (#25710)
PR Close #25710
2018-08-28 21:07:15 -04:00
Greg Magolan 366195e182 build(bazel): esm5_outputs_aspect to work with targets such as ts_proto_library with no replay_params attribute (#25605)
PR Close #25605
2018-08-27 18:19:44 -04:00
Greg Magolan 9bcd8c2425 build(bazel): use value of /// <amd-module name=“”> directive to convert fileNameToModuleName in ngc-wrapped (#25650)
PR Close #25650
2018-08-27 12:21:18 -04:00
Alex Eagle 22e7f7e99f build(bazel): update to rules_typescript 0.16.1 (#25490)
PR Close #25490
2018-08-23 15:26:21 -04:00
Vikram Subramanian 9ed3bd6b4f refactor(bazel): allow and ignore extra args for _ts_expected_outs (#25558)
This is needed to let ts_compile_actions take explicit list of srcs and deps to generate tsc actions from another rule. This is no-op for ngc for now.

PR Close #25558
2018-08-20 16:25:19 -07:00
Wei Huang f053a3f274 test(bazel): Remove --no-sandbox for protractor tests (#25362)
Since we no longer need this flag to run web tests inside a docker
container, this reverts https://github.com/angular/angular/pull/24906

PR Close #25362
2018-08-17 09:58:30 -07:00
Greg Magolan b5f354f2fb build(bazel): update to rules_typescript 0.16.0 & update to tagged rules_webtesting 0.2.1 (#25433)
PR Close #25433
2018-08-14 16:37:15 -07:00
Martin Probst c869b143c6 build: drop unused re-export of json_marshal. (#25449)
This appears to be unused, and will be removed from rules_typescript now
that `struct.to_json` can take `dicts`.

PR Close #25449
2018-08-13 21:37:41 -07:00
Ben Lesh fb2c5241fc fix(bazel): correct type concatenated to devmode_js (#25467)
PR Close #25467
2018-08-13 17:27:45 -07:00
Alex Rickabaugh 7058072ff6 feat(ivy): enable .ngfactory.js generation in g3 only (#25392)
This turns on generation of ngfactory.js files when compiling in Ivy
mode in g3. They're not turned on for Bazel users as there appears to
be a strange interaction with the way our tests run in Bazel mode.

PR Close #25392
2018-08-09 09:58:13 -07:00
Alex Eagle 6c4da9dcd3 build: stop printing source-map-support warning (#25339)
PR Close #25339
2018-08-08 19:02:57 -07:00
Alex Eagle a3f1e2cb42 style: format .bzl files with buildifier (#23544)
PR Close #23544
2018-08-08 13:12:07 -07:00
Alex Eagle bfdbdc2ee6 docs(bazel): add skydoc generation (#23544)
PR Close #23544
2018-08-08 13:12:07 -07:00
Fabian Wiles b0d86c1c2f refactor(bazel): dont rely on language target to downlevel for loop (#24534)
PR Close #24534
2018-08-03 15:55:18 -07:00
Greg Magolan 5254d3447d build(bazel): update to rules_nodejs 0.11.2 and latest rules_typescript (#25169)
PR Close #25169
2018-07-31 11:41:50 -07:00
Greg Magolan f82b6b2ed7 build(bazel): fix typos in comments (#25172)
PR Close #25172
2018-07-27 17:20:58 -07:00
Greg Magolan 1d051c5841 build(bazel): use bazel managed node_modules for downstream angular from source build support (#24663)
PR Close #24663
2018-07-26 17:02:21 -07:00
Alex Rickabaugh 0d1d5898e3 fix(bazel): allow compile_strategy to be (privately) imported (#25080)
compile_strategy() is used to decide whether to build Angular code
using ngc (legacy) or ngtsc (local). In order for g3 BUILD rules
to switch properly and allow testing of Ivy in g3, they need to
import this function.

This commit removes the _ prefix which allows the function to be
imported.

PR Close #25080
2018-07-26 16:38:09 -07:00
Wei Huang 2cb0f68a7b test(bazel): allow no sandbox for protractor tests (#24906)
It specifies --no-sandbox flag when running the protractor tests as
root. This is needed for running the tests inside a docker container.

PR Close #24906
2018-07-24 08:28:03 -07:00
Greg Magolan c438b5eeda build(bazel): turn on preserve-symlinks (#24881)
This change turns on preserve-symlinks in nodejs to verify hermeticity of the Angular build.

BREAKING CHANGE: Use of @angular/bazel rules now requires calling ng_setup_workspace() in your WORKSPACE file.

For example:

local_repository(
    name = "angular",
    path = "node_modules/@angular/bazel",
)

load("@angular//:index.bzl", "ng_setup_workspace")

ng_setup_workspace()

PR Close #24881
2018-07-20 10:37:30 -07:00
Alex Eagle 06a33984af build: rename angular_devkit dependency to angular_cli (#24842)
PR Close #24842
2018-07-17 16:44:01 -04:00
Greg Magolan 161ff5c79d feat(bazel): protractor_web_test_suite for release (#24787)
PR Close #24787
2018-07-12 16:34:45 -04:00
mrmeku 71e0df039c feat(bazel): Initial commit of protractor_web_test_suite (#24787)
Co-authored-by: Andrew Z Allen <me@andrewzallen.com>

PR Close #24787
2018-07-12 16:34:45 -04:00
Igor Minar e3064d5432 feat: typescript 2.9 support (#24652)
PR Close #24652
2018-07-03 13:32:06 -07:00
Alex Rickabaugh 2ecaa40e64 build(ivy): run latest build-optimizer on ngtsc compiled code (#24677)
Previously the repo was depending on an old version of build optimizer.
This change updates to the latest (an RC release in the CLI package).

Additionally, this changes the behavior of ng_rollup_bundle to apply
the optimizer to ngtsc compiled code, and configures it to treat the
@angular/compiler package as side-effect-free.

This results in a substantial size reduction of ngtsc compiled code.

PR Close #24677
2018-06-28 17:51:42 -04:00
Alex Eagle 5aa12c73ae build: update to Bazel 0.14.0 (#24512)
Includes a fix for out-of-memory condition which caused this to be
reverted yesterday.

PR Close #24512
2018-06-14 10:04:42 -07:00
Alex Eagle 03f93b3772 Revert "build: update to Bazel 0.14.0 (#24296)" (#24492)
This reverts commit 0d07d273dc.

Fixes #24484

PR Close #24492
2018-06-13 16:47:18 -07:00
Alex Eagle 0d07d273dc build: update to Bazel 0.14.0 (#24296)
Also update usage of the ctx.actions.args to a newer preferred API

PR Close #24296
2018-06-12 11:42:35 -07:00
Alex Eagle 282d3510cf fix(bazel): Allow ng_module to depend on targets w no deps (#24446)
PR Close #24446
2018-06-12 11:35:52 -07:00
Greg Magolan a6e797b8f5 build(bazel): fix ng_package rollup root dir for fesm2015 output (#24298)
PR Close #24298
2018-06-07 17:56:09 -04:00
Greg Magolan 6948ef125c build(bazel): fix bazel built es5 ngfactory with secondary entry-point angular imports (#24170)
PR Close #24170
2018-06-01 13:40:47 -07:00
Alex Rickabaugh 646b42a113 feat(ivy): JIT renders the TODO app (#24138)
This commit builds out enough of the JIT compiler to render
//packages/core/test/bundling/todo, and allows the tests to run in
JIT mode.

To play with the app, run:

bazel run --define=compile=jit //packages/core/test/bundling/todo:prodserver

PR Close #24138
2018-05-30 11:25:57 -07:00
Fabian 5b25c07795 docs(bazel): improve error message for ng_package with no metadata (#22964)
PR Close #22964
2018-05-30 10:04:35 -07:00
Alex Rickabaugh 1eafd04eb3 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-29 18:02:29 -04:00
Alex Eagle b4c252bcc5 build: serve ivy todo app with real http-server (#23446)
PR Close #23446
2018-04-25 15:51:18 -07:00
Victor Berchet 9ed5fb6d2c
style: format code 2018-04-24 14:32:57 -07:00
Martin Probst e1c4930a1a fix(compiler): avoid a crash in ngc-wrapped. (#23468)
`ng.performCompilation` can return an `undefined` program, which is not handled by ngc-wrapped.

Avoid crashing by checking for the error return and returning the diagnostics.
PR Close #23468
2018-04-24 13:57:03 -07:00
Alex Eagle 2e270bb96a build: include tslib in umd bundles (#23354)
Fixes #22971

PR Close #23354
2018-04-13 00:13:54 -07:00
Alex Eagle b76dd3b979 fix(compiler): use correct global name in compiler.umd.js (#23354)
Fixes #23343

PR Close #23354
2018-04-13 00:13:54 -07:00
Alex Eagle d1e33d2df7 build: disambiguate rollup progress message (#23318)
All our package labels are `npm_package` so the bazel build reports a bunch of identical actions running, like

```
    Angular Packaging: rolling up npm_package; 31s darwin-sandbox
    Angular Packaging: rolling up npm_package; 30s darwin-sandbox
    Angular Packaging: rolling up npm_package; 29s darwin-sandbox
    Angular Packaging: rolling up npm_package; 27s darwin-sandbox
    Angular Packaging: rolling up npm_package; 26s darwin-sandbox
    Angular Packaging: rolling up npm_package; 23s darwin-sandbox
    Angular Packaging: rolling up npm_package; 19s darwin-sandbox
    Angular Packaging: rolling up npm_package; 11s darwin-sandbox
```
PR Close #23318
2018-04-11 15:31:02 -07:00
Alex Eagle b3a10e0a42 build: update Bazel dependency to 0.11.1 (#23297)
PR Close #23297
2018-04-10 23:01:30 -07:00
Alex Eagle 37c1634276 build: Add sourcemap output from ng_rollup_bundle (#23276)
PR Close #23276
2018-04-09 16:07:13 -07:00
Alex Eagle 3e8eef6015 fix(bazel): set rollup output.name and amd.id (#23274)
These are based on the name of the package as declared in the module_name attribute on ng_module

Fixes #23238

PR Close #23274
2018-04-09 15:15:44 -07:00
Igor Minar da58a55ece fix(bazel): don't produce ngfactory files for ng_packages (#23237)
PR Close #23237
2018-04-06 16:26:31 -07:00
Jeremy Elbourn ae8a0092bd build(bazel): use ng_package entry_point_name for umd bundles (#23132)
This change also requires updating the package gold test to work with
multiple test packages.

PR Close #23132
2018-04-05 14:51:31 -07:00
Alex Eagle 6699fb5d77 build: language-service package built by bazel (#23155)
PR Close #23155
2018-04-04 16:48:39 -07:00
Alex Eagle 580f05bd9c build: flatten esm5 sources before rollup (#23131)
this is needed to update to latest rules_nodejs due to breaking change in
https://github.com/bazelbuild/rules_nodejs/pull/172
It has the side-effect of correctly marking rxjs packages as side-effect-free

PR Close #23131
2018-04-03 10:47:29 -07:00
Keen Yee Liau 0c4e3718f5 build(bazel): Emit metadata.json under Blaze (#23049)
This commit modifies the compilation to emit metadata.json files when
compiled under Blaze. The default behavior of ngc is to emit metadata
only when the --flatModuleOutFile flag is specified, but this mode
is not used in Blaze.
Emitting metadata for individual Angular components is needed for
Angular Language Service to work with projects compiled with Blaze.

PR Close #23049
2018-03-30 15:23:30 -07:00
Alex Eagle be10bf538b fix(bazel): don't try to do flatmoduleindex under Blaze (#23083)
PR Close #23083
2018-03-29 22:23:49 -07:00
Igor Minar 439030fb57 fix(bazel): complete the rollup globals list for all angular entrypoints (#23080)
PR Close #23080
2018-03-29 20:34:58 -07:00
Alex Eagle 481b22ecb0 fix(bazel): downlevel decorators in fesm5 files (#23078)
Needed so that our bundles appear side-effect-free to tools like webpack

PR Close #23078
2018-03-29 18:53:49 -07:00
Alex Eagle 45e090b614 fix(bazel): pass --global option to rollup (#23073)
This fixes the UMD bundles which otherwise don't contain the right global symbols

PR Close #23073
2018-03-29 17:44:43 -07:00
Alex Eagle 0d9140cdce fix(bazel): ng_package should include private exports in fesms (#23054)
PR Close #23054
2018-03-29 14:11:12 -07:00
Alex Eagle 0b348c8ffe build: fix bazel stamping (#22965)
As pointed out in https://github.com/bazelbuild/rules_nodejs/issues/156
our mechanism would never pick up changes to the version info.

PR Close #22965
2018-03-28 09:00:02 -07:00
Veres Lajos de90314304 style: typos fixed - https://github.com/vlajos/misspell-fixer (#22975)
PR Close #22975
2018-03-27 14:51:53 -04:00
Jeremy Elbourn 2aabbc51fa fix(bazel): ng_package packages attr not forwarded to npm_package (#22967)
PR Close #22967
2018-03-26 22:32:09 -04:00
Jeremy Elbourn 2388f24256 build(bazel): add entry_point_name attr to ng_package (#22963)
PR Close #22963
2018-03-26 22:30:16 -04:00
Alex Eagle 27e14b2fb3 feat(bazel): prefix private-export (barred-latin-o) symbols (#23007)
This allows a bundle index to be re-exported by a higher-level module without fear of collisions.
Under bazel, we always set the prefix to be underscore-joined workspace, package, label

PR Close #23007
2018-03-26 22:28:55 -04:00
Jeremy Elbourn d9a0a8ff3e build(bazel): add `data` attr to ng_package (#22919)
PR Close #22919
2018-03-23 13:16:07 -04:00
Rado Kirov 838a610197 fix(compiler): don't typecheck all inputs (#22899)
ngc knows to filter out d.ts inputs, but the logic accidentally
depended on whether it had a previous Program lying around.

Fixing that logic puts ngc on the fast code path, but in that code
path it must be able to merge tsickle EmitResults, so we need to
plumb the tsickle.mergeEmitResults function through all the intervening
APIs.  The bulk of this change is that plumbing.

PR Close #22899
2018-03-21 18:29:18 -04:00
Alex Eagle 64efcf103c build: add the FESM files back to ng_package (#22889)
PR Close #22889
2018-03-21 13:19:19 -07:00
Alex Eagle 689f351092 build: expose flatModuleOutFile option on ng_module (#22814)
This lets projects like Material change ng_package "bundle index" files to non-conflicting paths

Currently packages like @angular/core ship with the generated metadata
in a path like 'core.js' which overwrites one of the inputs.

Angular material puts the generated file in a path like 'index.js'

Either way these files generated by ng_module rules have the potential
to collide with inputs given by the user, which results in an error.

Instead, give users the freedom to choose a different non-conflicting name.

Also this refactors the ng_package rule, removing the redundant
secondary_entry_points attribute.

Instead, we assume that any ng_module in the deps with a module_name
attribute is a secondary entry point.

PR Close #22814
2018-03-20 13:28:57 -07:00
Igor Minar b43f8bc7d3 feat(core): upgrade rxjs to 6.0.0-alpha.4 (#22573)
PR Close #22573
2018-03-19 21:51:51 -07:00
Greg Magolan bfe077ad64 fix(bazel): correct expected outs for external sources in ng_module (#22755)
PR Close #22755
2018-03-19 16:30:01 -05:00
Alex Rickabaugh 6ef9f2278f feat(ivy): @NgModule -> ngInjectorDef compilation (#22458)
This adds compilation of @NgModule providers and imports into
ngInjectorDef statements in generated code. All @NgModule annotations
will be compiled and the @NgModule decorators removed from the
resultant js output.

All @Injectables will also be compiled in Ivy mode, and the decorator
removed.

PR Close #22458
2018-03-16 12:57:11 -07:00
Jeremy Elbourn b149424b11 build(bazel): make ng_package auto generate package.json for secondary entry-points (#22806)
PR Close #22806
2018-03-15 21:18:27 -07:00
Alex Eagle 88b3198c80 feat(bazel): change ng_package rule to APF v6 (#22782)
Angular Package Format v6 stops bundling files in the esm5 and esm2015
directories, now that Webpack 4 can tree-shake per-file.

Adds some missing files like package.json to make packages closer to
what we publish today.

Refactor ng_package to be a type of npm_package and re-use the packaging
action from that rule.

PR Close #22782
2018-03-15 11:38:31 -07:00
Jeremy Elbourn 34e355a3b0 build(bazel): ng_package rxjs/operators rollup config (#22744)
PR Close #22744
2018-03-13 12:12:11 -07:00
Alex Eagle 40315bef3d fix(compiler-cli): enableResourceInlining handles both styles and styleUrls (#22688)
When both are present, the inlined styles are appended to the end of the styles

PR Close #22688
2018-03-11 22:14:32 -07:00
Alex Eagle 123efba388 fix(compiler-cli): resolve resource URLs before loading them under enableResourceInlining (#22688)
Also turn on the feature for Bazel ng_module rules

PR Close #22688
2018-03-11 22:14:31 -07:00
Alex Eagle 1e6cc42a01 test: migrate remaining public-api tests to Bazel (#22639)
We now create npm packages to cover all the public api assertions in tools/public_api_guard.
We no longer depend on ts-api-guardian from npm - it is now stale since the repository was archived.
There is no longer a gulp task to enforce or accept the public API, this is in CircleCI as part of running all bazel test targets.

PR Close #22639
2018-03-09 09:11:40 -08:00
Alex Eagle ce649f725f build: add a ng_package rule for @angular/router (#22628)
PR Close #22628
2018-03-07 10:56:27 -08:00
Alex Eagle fcb8c492d6 build: add an npm_package rule for @angular/bazel (#22628)
PR Close #22628
2018-03-07 10:56:27 -08:00
Alex Eagle 4c40812b71 fix(bazel): fixes for ng_package on Windows (#22597)
PR Close #22597
2018-03-06 07:52:48 -08:00
Alex Eagle ba8df8a3f1 build: update to latest bazel rules (#22558)
PR Close #22558
2018-03-02 13:27:25 -08:00
Rado Kirov ab790f3c84 build: Add support for bazelOptions.maxCacheSizeMb in ngc-wrapped. (#22511)
PR Close #22511
2018-03-01 08:41:10 -08:00
Alex Eagle aabe16c08c fix(bazel): ng_package includes transitive .d.ts and flatModuleMetadata (#22499)
Fixes #22419

PR Close #22499
2018-02-28 13:29:56 -08:00
Alex Eagle b6c941053e feat(bazel): ng_package adds package.json props (#22499)
We now add the 'main', 'module', 'es2015', and 'typings' properties,
pointing to where the packaging tool lays them out.

Fixes #22416

PR Close #22499
2018-02-28 13:29:56 -08:00
Alex Eagle b43b164a61 feat(bazel): add an ng_package rule (#22221)
This produces a directory following the Angular Package layout spec.

Includes integration test coverage by making a minimal ng_package in integration/bazel.
Unit tests verify the content of the @angular/core and @angular/common packages.

This doesn't totally match our current output, but is good enough to unblock some
early adopters.

It re-uses logic from the rollup_bundle rule in rules_nodejs. It should also
eventually have the .pack and .publish secondary targets like npm_package rule.

PR Close #22221
2018-02-23 11:19:04 -08:00
Martin Probst ca06af40f4 build: allow passing node options to ngc. (#22245)
PR Close #22245
2018-02-22 10:20:04 -08:00
Oussama Ben Brahim f1a063298e feat(core): set preserveWhitespaces to false by default (#22046)
Fixes #22027

PR Close #22046
2018-02-16 09:06:14 -08:00