Skip to content

Commit 299db91

Browse files
committed
build: switch to ivy partial compilation package format
Switches from View Engine NPM package output to the partial compilation-based NPM outout. As part of this, various workarounds/patches to make the View Engine release output work with Bazel have been removed (finally!) fixup! build: switch to ivy partial compilation package format ds fixup! build: switch to ivy partial compilation package format ds ds
1 parent 82072ac commit 299db91

File tree

201 files changed

+2454
-4017
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

201 files changed

+2454
-4017
lines changed

.bazelrc

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -51,14 +51,15 @@ build:release --stamp
5151
build:snapshot-build --workspace_status_command="yarn -s ng-dev release build-env-stamp --mode=snapshot"
5252
build:snapshot-build --stamp
5353

54-
################################
55-
# View Engine / Ivy toggle #
56-
################################
57-
build:view-engine --define=angular_ivy_enabled=False
58-
build:ivy --define=angular_ivy_enabled=True
54+
####################################
55+
# Bazel custom flags #
56+
####################################
57+
build --flag_alias=partial_compilation=@npm//@angular/bazel/src:partial_compilation
5958

60-
# Set Ivy as the default
61-
build --config=ivy
59+
##################################
60+
# Always enable Ivy compilation #
61+
##################################
62+
build --define=angular_ivy_enabled=True
6263

6364
################################
6465
# Remote Execution Setup #

.circleci/config.yml

Lines changed: 3 additions & 130 deletions
Original file line numberDiff line numberDiff line change
@@ -197,28 +197,6 @@ jobs:
197197
- run: bazel build --build_tag_filters=-docs-package,-release-package -- src/...
198198
- *slack_notify_on_failure
199199

200-
# -----------------------------------
201-
# Job which ensures that all non-test Bazel targets build properly
202-
# in View Engine configuration.
203-
# -----------------------------------
204-
view_engine_build:
205-
<<: *job_defaults
206-
resource_class: xlarge
207-
environment:
208-
GCP_DECRYPT_TOKEN: *gcp_decrypt_token
209-
steps:
210-
- checkout_and_rebase
211-
- *restore_cache
212-
- *setup_bazel_ci_config
213-
- *setup_bazel_remote_execution
214-
- *yarn_install
215-
- *setup_bazel_binary
216-
217-
# Exclude release and docs packages here as those will be built within
218-
# the "build_release_packages" and "publish_snapshots" jobs.
219-
- run: bazel build --build_tag_filters=-docs-package,-release-package --config=view-engine -- src/...
220-
- *slack_notify_on_failure
221-
222200
# --------------------------------------------------------------------------------------------
223201
# Job that runs API golden tests in "tools/public_api_guard".
224202
# This job fails whenever an API has been updated but not explicitly approved through goldens.
@@ -338,10 +316,10 @@ jobs:
338316
- *setup_bazel_binary
339317

340318
- run:
341-
name: Checking rollup globals
319+
name: Checking package externals
342320
command: |
343-
bazel build //:rollup_globals
344-
yarn check-rollup-globals $(bazel info bazel-bin)/rollup_globals.json
321+
bazel build //:package_externals
322+
yarn check-package-externals $(bazel info bazel-bin)/package_externals.json
345323
346324
- run:
347325
name: Checking entry-points configuration
@@ -456,54 +434,6 @@ jobs:
456434
- run: ./scripts/circleci/publish-snapshots.sh
457435
- *slack_notify_on_failure
458436

459-
# -----------------------------------------------------------------
460-
# Job that ensures that the release output is compatible with ngcc.
461-
# -----------------------------------------------------------------
462-
ngcc_compatibility:
463-
<<: *job_defaults
464-
resource_class: xlarge
465-
steps:
466-
- checkout_and_rebase
467-
- *restore_cache
468-
- *attach_release_output
469-
- *yarn_install
470-
471-
# Copy the release packages into the node modules so that ngcc can process them.
472-
- run: cp -R dist/releases/* node_modules/@angular/
473-
# Delete existing ngcc manifests that would prevent the copied packages
474-
# from being discovered.
475-
- run: rm -f node_modules/__ngcc_entry_points__.json
476-
# Ensure that the job fails if an entry-point cannot be compiled. Also disable
477-
# tsconfig parsing as that causes the release packages to be incorrectly resolved
478-
# to the sources due to path mapping.
479-
- run: yarn ngcc --error-on-failed-entry-point --no-tsconfig
480-
- *slack_notify_on_failure
481-
482-
# -----------------------------------------------------------------
483-
# Job that ensures that the release output is compatible with the
484-
# latest snapshot ngcc changes.
485-
# -----------------------------------------------------------------
486-
ngcc_compatibility_snapshot:
487-
<<: *job_defaults
488-
resource_class: xlarge
489-
steps:
490-
- checkout_and_rebase
491-
- *restore_cache
492-
- *attach_release_output
493-
- *setup_snapshot_builds
494-
- *yarn_install_loose_lockfile
495-
496-
# Copy the release packages into the node modules so that ngcc can process them.
497-
- run: cp -R dist/releases/* node_modules/@angular/
498-
# Delete existing ngcc manifests that would prevent the copied packages
499-
# from being discovered.
500-
- run: rm -f node_modules/__ngcc_entry_points__.json
501-
# Ensure that the job fails if an entry-point cannot be compiled. Also disable
502-
# tsconfig parsing as that causes the release packages to be incorrectly resolved
503-
# to the sources due to path mapping.
504-
- run: yarn ngcc --error-on-failed-entry-point --no-tsconfig
505-
- *slack_notify_on_failure
506-
507437
# ----------------------------------------------------------------------------
508438
# Job that runs the local browser tests against the Angular Github snapshots
509439
# ----------------------------------------------------------------------------
@@ -525,48 +455,6 @@ jobs:
525455
- run: bazel test --build_tag_filters=-e2e --test_tag_filters=-e2e --build_tests_only -- src/...
526456
- *slack_notify_on_failure
527457

528-
# ----------------------------------------------------------------------------
529-
# Job that runs all Bazel tests against View Engine with the current Angular version
530-
# specified in the project dev dependencies.
531-
# ----------------------------------------------------------------------------
532-
view_engine_test:
533-
<<: *job_defaults
534-
resource_class: xlarge
535-
environment:
536-
GCP_DECRYPT_TOKEN: *gcp_decrypt_token
537-
steps:
538-
- checkout_and_rebase
539-
- *restore_cache
540-
- *setup_bazel_ci_config
541-
- *setup_bazel_remote_execution
542-
- *yarn_install
543-
- *setup_bazel_binary
544-
545-
# Run project tests with NGC and View Engine.
546-
- run: bazel test --build_tag_filters=-docs-package,-e2e --test_tag_filters=-e2e --config=view-engine --build_tests_only -- src/...
547-
- *slack_notify_on_failure
548-
549-
# ----------------------------------------------------------------------------
550-
# Job that runs all Bazel tests against View Engine from angular/angular#master.
551-
# ----------------------------------------------------------------------------
552-
view_engine_snapshot_test_cronjob:
553-
<<: *job_defaults
554-
resource_class: xlarge
555-
environment:
556-
GCP_DECRYPT_TOKEN: *gcp_decrypt_token
557-
steps:
558-
- checkout_and_rebase
559-
- *restore_cache
560-
- *setup_bazel_ci_config
561-
- *setup_bazel_remote_execution
562-
- *setup_snapshot_builds
563-
- *yarn_install_loose_lockfile
564-
- *setup_bazel_binary
565-
566-
# Run project tests with NGC and View Engine.
567-
- run: bazel test --build_tag_filters=-docs-package,-e2e --test_tag_filters=-e2e --config=view-engine --build_tests_only -- src/...
568-
- *slack_notify_on_failure
569-
570458
# ----------------------------------------------------------------------------
571459
# Job that runs all Bazel integration tests.
572460
# ----------------------------------------------------------------------------
@@ -584,7 +472,6 @@ jobs:
584472
- *setup_bazel_binary
585473

586474
- run: yarn integration-tests:partial-ivy
587-
- run: yarn integration-tests:view-engine
588475
# TODO: Re-enable when there are integration tests that should run with Ivy.
589476
# Currently this command fails as there are no tests.
590477
# - run: yarn integration-tests
@@ -654,10 +541,6 @@ workflows:
654541
jobs:
655542
- bazel_build:
656543
filters: *ignore_presubmit_branch_filter
657-
- view_engine_build:
658-
filters: *ignore_presubmit_branch_filter
659-
- view_engine_test:
660-
filters: *ignore_presubmit_branch_filter
661544
- api_golden_checks:
662545
filters: *ignore_presubmit_branch_filter
663546
- integration_tests:
@@ -680,14 +563,6 @@ workflows:
680563
- build_release_packages
681564
- lint:
682565
filters: *ignore_presubmit_branch_filter
683-
- ngcc_compatibility:
684-
filters: *ignore_presubmit_branch_filter
685-
requires:
686-
- build_release_packages
687-
- ngcc_compatibility_snapshot:
688-
filters: *only_main_branch_filter
689-
requires:
690-
- build_release_packages
691566
- publish_snapshots:
692567
filters: *publish_branches_filter
693568
requires:
@@ -702,8 +577,6 @@ workflows:
702577
# workflow. See: https://circleci.com/ideas/?idea=CCI-I-295
703578
- snapshot_tests_local_browsers:
704579
filters: *only_main_branch_filter
705-
- view_engine_snapshot_test_cronjob:
706-
filters: *only_main_branch_filter
707580
- mdc_snapshot_test_cronjob:
708581
filters: *only_main_branch_filter
709582
- integration_tests_snapshot:

.ng-dev/pull-request.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ export const pullRequest: PullRequestConfig = {
1515
{pattern: 'preserve commits', method: 'rebase'}
1616
]
1717
},
18-
claSignedLabel: 'cla: yes',
1918
mergeReadyLabel: 'merge ready',
2019
commitMessageFixupLabel: 'commit message fixup',
2120
caretakerNoteLabel: 'caretaker note',

BUILD.bazel

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
load("//:rollup-globals.bzl", "ROLLUP_GLOBALS")
1+
load("//:pkg-externals.bzl", "PKG_EXTERNALS")
22
load("//src/cdk:config.bzl", "CDK_ENTRYPOINTS")
33
load("//src/cdk-experimental:config.bzl", "CDK_EXPERIMENTAL_ENTRYPOINTS")
44
load("//src/material:config.bzl", "MATERIAL_ENTRYPOINTS", "MATERIAL_TESTING_ENTRYPOINTS")
55
load("//src/material-experimental:config.bzl", "MATERIAL_EXPERIMENTAL_ENTRYPOINTS", "MATERIAL_EXPERIMENTAL_TESTING_ENTRYPOINTS")
6+
load("//tools/esbuild:index.bzl", "esbuild_amd")
67

78
package(default_visibility = ["//visibility:public"])
89

@@ -12,9 +13,9 @@ exports_files([
1213
])
1314

1415
genrule(
15-
name = "rollup_globals",
16-
outs = ["rollup_globals.json"],
17-
cmd = "echo '%s' > $@" % ROLLUP_GLOBALS,
16+
name = "package_externals",
17+
outs = ["package_externals.json"],
18+
cmd = "echo '%s' > $@" % PKG_EXTERNALS,
1819
)
1920

2021
entryPoints = ["cdk/%s" % e for e in CDK_ENTRYPOINTS] + \
@@ -27,3 +28,11 @@ genrule(
2728
outs = ["entry_points_manifest.json"],
2829
cmd = "echo '%s' > $@" % entryPoints,
2930
)
31+
32+
esbuild_amd(
33+
name = "core_amd",
34+
testonly = False,
35+
entry_point = "@npm//:node_modules/@angular/core/fesm2020/core.mjs",
36+
module_name = "@angular/core",
37+
deps = [],
38+
)

WORKSPACE

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
88
# Add NodeJS rules
99
http_archive(
1010
name = "build_bazel_rules_nodejs",
11-
sha256 = "4e1a5633267a0ca1d550cced2919dd4148575c0bafd47608b88aea79c41b5ca3",
12-
urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/4.2.0/rules_nodejs-4.2.0.tar.gz"],
11+
sha256 = "",
12+
urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/4.3.0/rules_nodejs-4.3.0.tar.gz"],
1313
)
1414

1515
# Add sass rules
@@ -27,11 +27,10 @@ http_archive(
2727
# for declaring Bazel build setting flags.
2828
http_archive(
2929
name = "bazel_skylib",
30-
sha256 = "ebdf850bfef28d923a2cc67ddca86355a449b5e4f38b0a70e584dc24e5984aa6",
31-
strip_prefix = "bazel-skylib-f80bc733d4b9f83d427ce3442be2e07427b2cc8d",
30+
sha256 = "191ea53b19b7e49b5b63d0ef81d1a6278227f9ac2c09fed1c2b3a75d573f1eeb",
31+
strip_prefix = "bazel-skylib-b2ed61686ebca2a44d44857fef5b3e1d31cc2483",
3232
urls = [
33-
"https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/archive/f80bc733d4b9f83d427ce3442be2e07427b2cc8d.tar.gz",
34-
"https://github.com/bazelbuild/bazel-skylib/archive/f80bc733d4b9f83d427ce3442be2e07427b2cc8d.tar.gz",
33+
"https://github.com/bazelbuild/bazel-skylib/archive/b2ed61686ebca2a44d44857fef5b3e1d31cc2483.tar.gz",
3534
],
3635
)
3736

@@ -50,11 +49,10 @@ node_repositories(
5049

5150
yarn_install(
5251
name = "npm",
53-
# We add the postinstall patches file, and ngcc main fields update script here so
54-
# that Yarn will rerun whenever one of these files has been modified.
52+
# We add the postinstall patches file here so that Yarn will rerun whenever
53+
# the file is modified.
5554
data = [
5655
"//:tools/postinstall/apply-patches.js",
57-
"//:tools/postinstall/update-ngcc-main-fields.js",
5856
],
5957
package_json = "//:package.json",
6058
quiet = False,

angular-tsconfig.json

Lines changed: 0 additions & 44 deletions
This file was deleted.

gulpfile.js

Lines changed: 0 additions & 24 deletions
This file was deleted.

integration/BUILD.bazel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@ package(default_visibility = ["//visibility:public"])
66
# available in the runfiles of an action.
77
js_library(
88
name = "npm-packages-from-runfiles",
9-
srcs = ["npm-packages-from-runfiles.js"],
9+
srcs = ["npm-packages-from-runfiles.mjs"],
1010
)

integration/linker/BUILD.bazel

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ load("@build_bazel_rules_nodejs//:index.bzl", "nodejs_test")
55
nodejs_test(
66
name = "linker",
77
data = [
8+
"link-packages-test.mjs",
89
"//integration:npm-packages-from-runfiles",
910
"//src/cdk:npm_package",
1011
"//src/cdk-experimental:npm_package",
@@ -18,6 +19,6 @@ nodejs_test(
1819
"@npm//chalk",
1920
"@npm//glob",
2021
],
21-
entry_point = "link-packages-test.js",
22+
entry_point = "link-packages-test.mjs",
2223
tags = ["partial-compilation-integration"],
2324
)

0 commit comments

Comments
 (0)