Commit Graph

248 Commits

Author SHA1 Message Date
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
Adam Plumer a100472b5d build: bump year (#27880)
PR Close #27880
2019-01-11 11:15:59 -08:00
Keen Yee Liau b78351cc7e build(bazel): Bump @bazel/typescript & @bazel/karma to 0.22.1 (#28031)
PR Close #28031
2019-01-10 16:49:56 -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 ac5f5ed0a6 test(bazel): re-enable ng_package golden testing on ci (#27829)
* Enables the ng_package golden testing on the CI
* Fixes the ng_package golden testing for Windows

PR Close #27829
2019-01-07 14:46:47 -08:00
Paul Gschwendtner 8122970f63 test(bazel): fix all ng_package tests not working on windows (#27829)
PR Close #27829
2019-01-07 14:46:47 -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
Greg Magolan e7f43386a6 build: update to Bazel 0.21.0 (#27935)
PR Close #27935
2019-01-04 18:38:44 -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
Igor Minar 17e702bf8b feat: add support for typescript 3.2 (#27536)
https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-2.html
https://blogs.msdn.microsoft.com/typescript/2018/11/29/announcing-typescript-3-2/

Any application using tsickle for closure compatibility will need to update it's tsickle
dependency to 0.34

PR Close #27536
2018-12-18 13:20:01 -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
Alex Eagle d32939d51a build: restrict visibility of npm_package targets (#27611)
dependencies on these cause very long rebuilds which have to re-package angular.
Such tests belong in the integration/ folder

PR Close #27611
2018-12-14 10:20:40 -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
Greg Magolan 1cc08b4a4a fix(bazel): fix major/minor semver check between @angular/bazel npm packager version and angular bazel repo version (#27635)
PR Close #27635
2018-12-13 10:59:14 -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
Alex Eagle bf57e9d781 build: update rules_typescript (#27586)
This release of rules_typescript fixes a critical bug: typescript code
was not checked at all, including type-checking, tsetse, and strict deps

fixes #27569

PR Close #27586
2018-12-10 16:33:41 -08:00
Igor Minar f5c0b30256 test: remove extranious fixme from packages/bazel/test/ngc-wrapped (#27578)
we forgot to remove this when the last fixme was removed.

PR Close #27578
2018-12-10 10:31:06 -08:00
Alex Eagle 44dd764d6d build: update to Bazel 0.20 (#27394)
refactor Bazel RBE configs

PR Close #27394
2018-12-07 14:29:03 -08:00
Paul Gschwendtner f0341142b8 fix(bazel): tsickle dependency not working with typescript 3.1.x (#27402)
`@angular/bazel` currently requires TypeScript 3.1.x as a peer dependency, but comes with `tsickle` as dependency. The current version of `tsickle` that is specified by `@angular/bazel` does not support TypeScript 3.1.x (which is a peer dependency) and therefore we need to make sure that `tsickle` works with the required TypeScript versions.

This change updates `tsickle` to the latest version that comes with b10fb6de0a in order to work with TypeScript 3.1.x.

PR Close #27402
2018-12-07 10:51:36 -08:00
Alex Eagle cab5927bd5 ci: use buildifier binary release (#27489)
Switch from Skylint to buildifier --lint - this is required for the Bazel 0.20 upgrade since Bazel no longer lets us use the embedded JDK to build and run Java programs, and Skylint is a Java program

PR Close #27489
2018-12-07 09:27:32 -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
Alex Rickabaugh 8f425701e4 test(ivy): enable //packages/bazel/test/ngc-wrapped/... tests for Ivy (#27470)
This commit allows //packages/bazel/test/ngc-wrapped/... tests to run
under Ivy mode. To get them to pass, it addresses a problem with the
way the tests are configured: both test targets have sloppy .d.ts
dependencies configured, leading to many type errors being generated
in TypeScript for the .d.ts files.

Due to the way ngc directs TypeScript emit, it avoids type-checking
.d.ts files and thus this issue does not surface. ngtsc does a whole-
program emit which results in full .d.ts type-checking by default,
catching this configuration issue.

To fix this, skipLibCheck is added to the tsconfig.jsons for these
tests, which tells TypeScript to skip type-checking of the .d.ts files,
avoiding this problem in a similar way to ngc.

PR Close #27470
2018-12-05 10:46:51 -08:00
Misko Hevery f52600e261 test(ivy): add ability to find already passing tests (#27449)
PR Close #27449
2018-12-05 09:34:52 -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