Commit graph

2301 commits

Author SHA1 Message Date
Paul Gschwendtner
7a3e200e7b build: temporarily patch @bazel/concatjs to unblock tsickle update (#47018)
Temporary patch until
https://github.com/bazelbuild/rules_nodejs/pull/3517 is available in
another `rules_nodejs` release.

We can remove this patch, but for now it doesn't hurt. On the external
side the tsickle code path is not hit at all anyway, but we need to
satisfy the TypeScript checker.

PR Close #47018
2022-08-03 17:36:18 -07:00
Paul Gschwendtner
b757b1387c build: update dev-infra packages and account for build-tooling split from ng-dev (#46976)
The dev-infra build tooling is now decoupled from `ng-dev`. This will
make it easier to update `ng-dev` without necessarily needing to upgrade
the whole build system, Bazel etc. This is useful when e.g. new release
tool features have been added and should also be ported to active LTS
branches.

PR Close #46976
2022-08-02 09:37:37 -07:00
Paul Gschwendtner
f6859e8da2 build: replace size-tracking test with rule from shared dev-infra (#46802)
The JS size-tracking logic has been moved into the dev-infra repository
and the rule has been updated to work better with Bazel labels. The
Starlark target is updated accordingly in this commit.

PR Close #46802
2022-07-12 19:06:30 +00:00
Paul Gschwendtner
c8b0127f31 build: remove unused inline-package-json-deps.js script (#46798)
This script was used back when dev-infra code was part of
the Angular framework repository. The script is now unused
and can be deleted.

PR Close #46798
2022-07-12 15:54:51 +00:00
Paul Gschwendtner
1596902825 build: move jasmine seed generation logic to karma config (#46798)
The jasmine seed generator is only used in a single karma configuration
file. Used by the legacy build and the Saucelabs/ZoneJS Karma jobs.

We should move the separate script code directly into the config to make
it clear that the seed generation is not used elsewhere, and to simplify
the Starlark code.

PR Close #46798
2022-07-12 15:54:51 +00:00
Paul Gschwendtner
5f942717e8 build: account for app_bundle rule location change (#46642)
The `app_bundle` rule from the shared dev-infra package is no longer in
the benchmarking folder, but instead is part of the general Bazel rules
exposed by `dev-infra`. This commit accounts for this location change.

PR Close #46642
2022-07-01 10:20:51 -07:00
Joey Perrott
d5c2169f62 build: remove the unused source-map-test (#46518)
As source-map-test is unused and obsolete at this point, removing it from the repository.

PR Close #46518
2022-06-27 15:42:43 -07:00
Paul Gschwendtner
0360cde473 build: remove unused script from legacy build scripts (#46506)
Removes an unused `file2modulename` script and removes the folder
in `tools` since it's now empty.

PR Close #46506
2022-06-27 09:06:15 -07:00
Paul Gschwendtner
fbb1d56a9c build: remove unused check-node-modules script (#46507)
We now validate/enforce Yarn through the `npmrc` strict engines
setting. This script can be removed as it is not used anywhere.

PR Close #46507
2022-06-27 09:05:38 -07:00
Paul Gschwendtner
05254f53ff build: replace extract_typings rule with shared rule from dev-infra (#46508)
This replaces the `extract_typings` rule with the shared rule from
dev-infra, avoiding us having to maintain two rules.

PR Close #46508
2022-06-27 09:05:09 -07:00
Derek Cormier
d2648d9d77 build(bazel): remove tsec patch to enable runfiles on Windows (#46447)
tsec previously did not use runfiles on Windows even when the flag was enabled.
The latest version now adds an option to force its usage.

PR Close #46447
2022-06-21 12:19:53 -07:00
Paul Gschwendtner
3b077c05c4 build: update dev-infra package to latest version with full ESM (#46437)
Updates `angular/dev-infra` to the latest version which is now full ESM.

PR Close #46437
2022-06-21 11:48:03 -07:00
Derek Cormier
2c8fd2b57b build(bazel): enable runfiles (#46313)
Patches are required for tsec and rules_webtesting. The fix for
rules_webtesting was merged to that repo
(581b1557e3)
but it's unclear when a release will be cut.

PR Close #46313
2022-06-14 16:58:19 +00:00
Paul Gschwendtner
95555658cf build: disable bazel nodejs linker to improve stability on windows (#45872)
The NodeJS Bazel linker does not work well on Windows because there
is no sandboxing and linker processes from different tests will attempt
to modify the same `node_modules`, causing concurrency race conditions
and resulting in flakiness.

PR Close #45872
2022-05-04 16:20:57 -07:00
Paul Gschwendtner
f1cc4a6c6f build: update tsec and drop corresponding postinstall patch (#45767)
Updates tsec and drops the corresponding postinstall patch that
we added when we updated to Bazel v5. See:

https://github.com/google/tsec/pull/25

PR Close #45767
2022-04-26 11:48:34 -07:00
Paul Gschwendtner
68597bb0ca feat(bazel): speed up dev-turnaround by bundling types only when packaging (#45405)
Speeds up the dev-turnaround by only bundling types when packaging. Currently
bundling occurs for all the `ng_module` targets in devmode.

This has various positive benefits:

* Avoidance of this rather slower operation in development
* Makes APF-built packages also handle types for `ts_library` targets consistently.
* Allows us to ensure APF entry-points have `d.ts` _always_ bundled (working with ESM
module resolution in TypeScript -- currently experimental)
* Allows us to remove the secondary `package.json` files from APF (maybe APF v14? - seems
low-impact). This would clean-up the APF even more and fix resolution issues (like in Vite)

PR Close #45405
2022-04-21 11:09:39 -07:00
Paul Gschwendtner
c996b477a9 build: replace bazel devserver with shared dev-infra implementation (#45452)
As part of the devtools migration, we copied the custom http server/
dev-server from the `angular/components` repo. This server implementation
has now moved to the shared dev-infra code, and we can clean up the
copy in this repository now.

PR Close #45452
2022-03-28 09:23:28 -07:00
Paul Gschwendtner
a24293ae80 build: migrate more usages from @bazel/typescript to @bazel/concatjs (#45431)
As mentioned in previous commits (check them for more details), `@bazel/typescript`
no longer contains `ts_library`-specific code, so we no longer need that dependency.

PR Close #45431
2022-03-25 12:18:34 -07:00
Paul Gschwendtner
c56f05c4bf build: add temporary patch to make tsec compatible with rules_nodejs v5 (#45431)
Adds a temporary patch to make `tsec` compatible with `rules_nodejs` v5
until https://github.com/google/tsec/pull/25 is available/released.

PR Close #45431
2022-03-25 12:18:33 -07:00
Renovate Bot
010a39f856 build: update bazel (#45431)
Update `@bazel` packages to the latest 5.x version.

Some of the changes here are modeled after
angular/dev-infra@40c0ac8559.

Co-Authored-By: George Kalpakas <kalpakas.g@gmail.com>

PR Close #45431
2022-03-25 12:18:33 -07:00
Alan Agius
6eaaefd22e feat(core): drop support for Node.js 12 (#45286)
Node.js v12 will become EOL on 2022-04-30. As a result, Angular CLI v14 will no longer support Node.js v12.

BREAKING CHANGE:

Support for Node.js v12 has been removed as it will become EOL on 2022-04-30. Please use Node.js v14.15 or later.

PR Close #45286
2022-03-08 12:05:03 -08:00
Joey Perrott
bc89598bb9 build: patch snapshot issue in dev-infra selecting the latest version tag (#45269)
Local patch ahead of landing of https://github.com/angular/dev-infra/pull/449

PR Close #45269
2022-03-04 15:23:39 -08:00
Paul Gschwendtner
2f7fc3d87c build: switch to karma web test rule from shared dev-infra (#45117)
Switches the Karma web test rule from `@bazel/concatjs` to our
wrapped/extended variant from the shared dev-infra code.

One benefit is that we now get a `_debug` target for web tests where
no browser is being launched and the action is kept alive. Allowing
developers to conveniently connect a browser manually for debugging.
Also works with iBazel for the manually connected browser.

PR Close #45117
2022-02-25 19:03:16 +00:00
zuckjet
459cbed33b refactor(dev-infra): convert nullish coalescing operator to plain javascript (#44968)
low version nodejs doesn't support nullish coalescing operator very well

PR Close #44968
2022-02-04 10:40:43 -08:00
Paul Gschwendtner
d614a97af9 build: update legacy saucelabs bundle generation to account for esbuild update (#44830)
Previously with ESBuild 0.14.11, when a file had dynamic requires to
builtin NodeJS modules like `url`, the resolution completed successfully
regardless of `--platform browser`. This seems to be fixed in ESBuild now.

This unveiled some resolution errors with our Saucelabs bundle generation
because the framework code sometimes switches dynamically to `require('url')`
if `window.URL` is not defined. Previously this just didn't matter, but now
the `require('url')` is checked and a module resolution error is reported given
`url` not being available in the browser as a builtin module.

We fix this by marking the module as external. We will not hit this code path
anyway in the browser saucelabs code. Similarly we exclude all platform-server
files from the bundle. This is not strictly needed after the `url` module being
marked as external, but the issue showed that lots of unnecessary code for the
server platform is included. This can be omitted (unfortunately not from the TS
compilation without over-complicating things significantly more; experimented with
that).

PR Close #44830
2022-01-31 17:00:18 +00:00
Paul Gschwendtner
8817b08219 build: update postinstall patch to account for benchmark macro changes (#44830)
Updates the postinstall patch for the benchmark macro rule from dev-infra.
We moved the ZoneJS setup to the bundler. This was necessary in order to
switch away from the Go-based (windows-incompatible, m1-incompatible)
concatjs devserver to a rather basic HTTP server (also provided by dev-infra now).

PR Close #44830
2022-01-31 17:00:18 +00:00
AleksanderBodurri
445fbf81fd refactor(devtools): bring the angular devtools directory into the root bazel workspace
Previously devtools used a nested workspace for its bazel configurations. This meant framework dependencies were consumed via npm.

Now devtools is part of the root bazel directory that all other files in this codebase fall under. This allows us to build devtools using local angular packages, removing the need to consume these dependencies with npn. This is useful because we no longer have to update these dependencies with an automated tool like renovate, and our CI tests will always run against the most up to date framework packages.
2022-01-26 16:35:31 -05:00
Paul Gschwendtner
c46d533b22 build: switch devmode output to es2015 (#44505)
To make our test output i.e. devmode output more aligned
with what we produce in the NPM packages, or to be more
aligned with what Angular applications will usually consume,
the devmode output is switched from ES5 to ES2015.

Additionally various tsconfigs (outside of Bazel) have been
updated to match with the other parts of the build. The rules
are:

ES2015 for test configurations, ES2020 for actual code that will
end up being shipped (this includes the IDE-only tsconfigs).

PR Close #44505
2022-01-05 23:20:20 +00:00
Paul Gschwendtner
c8cd5d5f2c build: switch all instances from ng_rollup_bundle to app_bundle (#44490)
The `ng_rollup_bundle` rule has been replaced with a new rule called
`app_bundle`. This rule replicates the Angular v13 optimization
pipeline in the CLI, so that we can get better benchmarking results.
Also the rule is much simpler to maintain as it relies on ESbuild.

The old `ng_rollup_bundle` rule did rely on e.g. build-optimizer that no
longer has an effect on v13 Angular packages, so technically size
tests/symbol tests were no longer as correct as they were before. This
commit fixes that.

A couple of different changes and their explanation:

* Language-service will no longer use the benchmark rule for creating
  its NPM bundles! It will use plain `rollup_bundle`. ESBuild would have
  been nice but the language-service relies on AMD that ESBuild cannot
  generate (yet?)

* Service-worker ngsw-worker.js file was generated using the benchmark
  bundle rule. This is wrong. We will use a simple ESbuild rule in the
  future. The output is more predictable that way, and we can have a
  clear use of the benchmark bundle rule..

* A couple of benchmarks in `modules/` had to be updated to use e.g.
  `initTableUtils` calls. This is done because with the new rule, all
  files except for the entry-point are considered side-effect free. The
  utilities for benchmarks relied on side-effects in some
  transitively-loaded file (bad practice anyway IMO). We are now
  initializing the utilities using a proper init function that is
  exported...

PR Close #44490
2022-01-04 12:14:14 -08:00
Paul Gschwendtner
4e58a508a9 build: update postinstall script to account for local target references in dev-infra (#44490)
We are in an inconvenient situation where the ng-dev package might rely
on packages from the Angular framework repository. Given that we install
this package in the framework repository, we need to update some
references through a postinstall.

This commit updates the patches to account for the latest changes in the
dev-infra package/repository.

PR Close #44490
2022-01-04 12:14:14 -08:00
Paul Gschwendtner
d73c7162df build: add postinstall script as runfile for yarn_install repository rule (#44490)
Adds the postinstall script as runfile for the `yarn_install`
repository rule, so that the dependencies are re-fetched when
the script changes.

PR Close #44490
2022-01-04 12:14:14 -08:00
Paul Gschwendtner
c3a5568143 build: update symbol extractor to support IIFE bundles using arrow-functions (#44490)
Updates the symbol extractor to support IIFE bundles using
arrow-functions instead of function declarations. This is in preparation
for running symbol extraction tests with the overhauled optimization
pipeline for Angular v13, relying on ESBuild internally.

Also removes rollup-specific code that does not seem to be relevant
anymore / rollup will be replaced anyway.

PR Close #44490
2022-01-04 12:14:14 -08:00
Paul Gschwendtner
6c0905d7ab build: wire up integration test rule from shared dev-infra package (#44238)
Wires up the integration test rule from the shared dev-infra package,
while also deleting the old integration test rule.

The readme is updated to reflect the changes that are being made
to run with the new integration rule. Overall one major difference is
that we will declare the integration test targets within each test
directory, making those actual bazel packages. This is more idiomatic
within Bazel and also reduces the computation within Skyframe as less
globs need to be evaluated for example.

PR Close #44238
2021-12-08 13:42:41 -05:00
Paul Gschwendtner
6add6a097d build: replace validate import ESM/CJS interop rule with dev-infra shipped rule (#44238)
The import ESM/CJS interop lint rule has been ported to the shared
dev-infra package, so we can remove the local version here.

PR Close #44238
2021-12-08 13:42:41 -05:00
Paul Gschwendtner
960068899c build: fix lint errors in build-saucelabs legacy script (#44311)
Fixes lint errors in the build-saucelabs legacy script. Likely this only
surfaces now after merge due to some other lint-affecting changes
landing just before the script landed.

PR Close #44311
2021-11-30 12:23:24 -05:00
Paul Gschwendtner
0fcf18d5f4 ci: increase jasmine default timeout for saucelabs legacy tests (#44281)
Previously, when we did not bundle tests, we also had the jasmine
default timeout increased to 15000ms. This commit re-introduces this
increased timeout by also maintaining a custom test init file for the
legacy saucelab jobs. This is desirable as all of the Saucelabs test
code is local in the `tools/legacy-saucelabs` folder.

PR Close #44281
2021-11-30 11:56:05 -05:00
Paul Gschwendtner
b23ce150d0 build: bundle spec files for saucelabs legacy job (#44281)
Bundle spec files similar to how it is done within the Angular
Components repo. This should simplify the setup and also speed
up the Saucelab job as only a single spec bundle would need to be
downloaded, compared to having to load hundreds of files through the
Saucelabs tunnel.

Also makes a couple of tests more robust with the emulators/and accounts
for ES2015 test runner changes. The tests should be less reluctant to
such build process changes.

Note for reviewers: Some imports have been simplified here. This work
came from Joey's original WIP for this. It's unclear to me whether this
is still needed, but it sounded like this was necessary for the ESBuild
bundling to work. I have robusted the module resolution plugin though,
so I doubt it's still needed. At the same time though: Not worth
reverting/trying as these changes are nice to have anyway!

Co-Authored-By: Joey Perrott <josephperrott@gmail.com>
Co-Authored-By: Paul Gschwendtner <paulgschwendtner@gmail.com>

PR Close #44281
2021-11-30 11:56:04 -05:00
Pei Wang
adaff4109b ci: Upgrade tsec to 0.2.0. (#44205)
tools/tsec.bzl is now part of tsec. Remove from Angular repo and update
BUILD.bazel files.

PR Close #44205
2021-11-24 18:55:58 +00:00
Alex Rickabaugh
aadfad739b build: remove view engine build infrastructure (#43884)
This commit removes --config=viewengine and makes Ivy the default for
building Angular.

PR Close #43884
2021-11-23 21:10:06 +00:00
Alex Rickabaugh
bb9ff6003c test: remove view-engine-only tests (#43884)
This commit removes most tests that were designated as only covering View
Engine code. It also removes tag filters from CI and local commands to run
tests.

In a few cases (such as with the packages/compiler tests), this tag was
improperly applied, and certain test cases have been added back running in
Ivy mode.

This commit also empties `@angular/compiler/testing` as it is no longer
necessary (this is safe since compiler packages are not public API). It can
be deleted in the future.

PR Close #43884
2021-11-23 21:10:06 +00:00
Paul Gschwendtner
9c40f6c92c build: update extract js module output target to reflect latest API changes (#44145)
The API of the `extract_js_module_output` rule has changed with the
latest build of the shared dev-infra package. This commit adds the
missing attributes to the targets using this rule, avoiding the
CI failures as these attributes are mandatory.

Note: For NPM packages the linker mappings are not relevant, neither
do we want to include sources from the external NPM packages inside
those.

PR Close #44145
2021-11-18 10:17:14 -08:00
Pei Wang
7ac2a8cd67 ci: Windows support for tsec_test. (#43924)
Contents of generated tsconfig for tsec_test now depend on whether
Bazel uses symlinked runfiles for nodejs_test. The current
implementation assumes that symlinked runfiles are not available
on Windows.

PR Close #43924
2021-11-10 04:36:48 +00:00
Joey Perrott
af1f8f8429 ci: remove saucelabs view engine tests (#43862)
Remove the view engine specific saucelabs test job and associated tags/tooling as view engine is no longer being tested
on CI.

PR Close #43862
2021-10-19 10:06:55 -07:00
Joey Perrott
aef63e7ae5 build: remove "ivy-only" bazel tag (#43862)
Because all actions are assumed to be running on Ivy, things which only work on Ivy should not be marked as
Ivy only.

PR Close #43862
2021-10-19 10:06:55 -07:00
Joey Perrott
a365a1f0ff build: rename "no-ivy-aot" tag to "view-engine-only" (#43862)
Using the tag "view-engine-only" better describes the expected usage of bazel targets with the test. They can
only be run with view engine.

PR Close #43862
2021-10-19 10:06:55 -07:00
Joey Perrott
00d801122c build: Use Ivy compiler for bazel builds by default (#43862)
Setting the angular_ivy_enabled environment variable to True will default Bazel builds to use the Ivy
compiler rather than defaulting to ViewEngine.

PR Close #43862
2021-10-19 10:06:54 -07:00
Joey Perrott
9f40d2a0ea ci: remove browserstack configuration (#43881)
Remove browserstack configuration from the repo as it is not used for our CI.

PR Close #43881
2021-10-18 15:00:22 -07:00
Alan Agius
e7b647fc06 refactor(dev-infra): remove dependency on minimist (#43644)
Refactor scripts to use `yargs`. The main motivation for this is to align and use a single parser.

PR Close #43644
2021-10-04 17:31:03 -07:00
Paul Gschwendtner
8d7f1098d8 refactor: make all imports compatible with ESM/CJS output. (#43431)
As outlined in the previous commit which enabled the `esModuleInterop`
TypeScript compiler option, we need to update all namespace imports
for `typescript` to default imports. This is needed to allow for
TypeScript to be imported at runtime from an ES module.

Similar changes are needed for modules like `semver` where the types incorrectly
suggest named exports that will not exist at runtime when imported from ESM.

This commit refactors all imports to match with the lint rule we have
configured in the previous commit. See the previous commit for more
details on why certain imports have been changed.

A special case are the imports to `@babel/core` and `@babel/types`. For
these a special interop is needed as both default imports, or named
imports break the other module format. e.g default imports would work
well for ESM, but it breaks for CJS. For CJS, the named imports would
only work, but in ESM, only the default export exist. We work around
this for now until the devmode is using ESM as well (which would be
consistent with prodmode and gives us more valuable test results). More
details on the interop can be found in the `babel_core.ts` files (two
interops are needed for both localize/or the compiler-cli).

PR Close #43431
2021-10-01 18:28:45 +00:00
Paul Gschwendtner
d15a692789 build: enable esModuleInterop in TypeScript compilations (#43431)
Enables the `esModuleInterop` for all TypeScript compilations in the
project. This allows us to emit proper ESM-compatible code. e.g.
consider the following import:

```ts
import * as ts from 'typescript';
```

This import currently will break at runtime in NodeJS because the
`typescript` package is not shipping ESM. It's still a CommonJS module.
ES modules are able to import from `typescript` though, using an import
statement as above, but everything in `module.exports` is being exposed
as the `default` named export. TypeScript at runtime does not have any
other named exports, so for actual ESM compatibility, all of our imports
need to be switched to:

```
import ts from 'typescript';
```

The `esModuleInterop` option allows this to work even though the
`d.ts` file of TS currently suggests that there are _only_ named exports.
The TypeScript language service will now suggest the correct import form as
shown above. It doesn't enforce that unfortunately, but this commit also
adds a lint rule that enforces certain patterns so that we emit imports
that are compatible with both ESM and CJS output (CJS still needed here
since tests run with CJS devmode output still; this is a future project
to switch that over to ESM!)

PR Close #43431
2021-10-01 18:28:45 +00:00