Skip to content

Commit 1ca8a78

Browse files
authored
build: run partial compilation tests with linker at JIT (#23882)
Runs partial compilation tests with the linker at JIT. This helps validating the Angular linker to catch bugs as reported by Stackblitz which relies on JIT compilation with its v1 non-webcontainer approach.
1 parent 681f37d commit 1ca8a78

File tree

5 files changed

+72
-9
lines changed

5 files changed

+72
-9
lines changed

.circleci/config.yml

Lines changed: 47 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -472,7 +472,6 @@ jobs:
472472
- *yarn_install
473473
- *setup_bazel_binary
474474

475-
- run: yarn integration-tests:partial-ivy
476475
- run: yarn integration-tests
477476
- run:
478477
name: Running size integration tests (failures are reported in Slack only).
@@ -482,9 +481,47 @@ jobs:
482481
- *slack_notify_on_failure
483482

484483
# ----------------------------------------------------------------------------
485-
# Job that runs all integration tests against Angular snapshot builds.
484+
# Job that runs the AOT linker tests.
486485
# ----------------------------------------------------------------------------
487-
integration_tests_snapshot:
486+
linker_aot_test:
487+
<<: *job_defaults
488+
resource_class: xlarge
489+
environment:
490+
GCP_DECRYPT_TOKEN: *gcp_decrypt_token
491+
steps:
492+
- checkout_and_rebase
493+
- *restore_cache
494+
- *setup_bazel_ci_config
495+
- *setup_bazel_remote_execution
496+
- *yarn_install
497+
- *setup_bazel_binary
498+
499+
- run: yarn test-linker-aot
500+
- *slack_notify_on_failure
501+
502+
# ----------------------------------------------------------------------------
503+
# Job that runs the JIT linker tests.
504+
# ----------------------------------------------------------------------------
505+
linker_jit_test:
506+
<<: *job_defaults
507+
resource_class: xlarge
508+
environment:
509+
GCP_DECRYPT_TOKEN: *gcp_decrypt_token
510+
steps:
511+
- checkout_and_rebase
512+
- *restore_cache
513+
- *setup_bazel_ci_config
514+
- *setup_bazel_remote_execution
515+
- *yarn_install
516+
- *setup_bazel_binary
517+
518+
- run: yarn test-linker-jit
519+
- *slack_notify_on_failure
520+
521+
# ----------------------------------------------------------------------------
522+
# Job that runs both AOT and JIT linker tests against Angular snapshot builds.
523+
# ----------------------------------------------------------------------------
524+
snapshot_linker_tests:
488525
<<: *job_defaults
489526
resource_class: xlarge
490527
environment:
@@ -498,7 +535,8 @@ jobs:
498535
- *yarn_install_loose_lockfile
499536
- *setup_bazel_binary
500537

501-
- run: yarn integration-tests:partial-ivy
538+
- run: yarn test-linker-aot
539+
- run: yarn test-linker-jit
502540
- *slack_notify_on_failure
503541

504542
# ----------------------------------------------------------------------------
@@ -544,6 +582,10 @@ workflows:
544582
filters: *ignore_presubmit_branch_filter
545583
- integration_tests:
546584
filters: *ignore_presubmit_branch_filter
585+
- linker_aot_test:
586+
filters: *ignore_presubmit_branch_filter
587+
- linker_jit_test:
588+
filters: *ignore_presubmit_branch_filter
547589
- tests_local_browsers:
548590
filters: *ignore_presubmit_branch_filter
549591
- tests_browserstack:
@@ -578,7 +620,7 @@ workflows:
578620
filters: *only_main_branch_filter
579621
- mdc_snapshot_test_cronjob:
580622
filters: *only_main_branch_filter
581-
- integration_tests_snapshot:
623+
- snapshot_linker_tests:
582624
filters: *only_main_branch_filter
583625

584626
triggers:

integration/linker/BUILD.bazel

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,4 @@ nodejs_test(
1919
"@npm//glob",
2020
],
2121
entry_point = "link-packages-test.mjs",
22-
tags = ["partial-compilation-integration"],
2322
)

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,9 @@
4040
"approve-api": "node ./scripts/approve-api-golden.js",
4141
"approve-size-tests": "node ./scripts/approve-size-golden.js",
4242
"integration-tests": "bazel test --test_tag_filters=-linker-integration-test --build_tests_only -- //integration/... -//integration/size-test/...",
43-
"integration-tests:partial-ivy": "bazel test --partial_compilation --test_tag_filters=partial-compilation-integration,-firefox --build_tests_only -- //integration/... //src/...",
4443
"integration-tests:size-test": "bazel test //integration/size-test/...",
44+
"test-linker-aot": "bazel test --partial_compilation --test_tag_filters=partial-compilation-integration,-firefox --build_tests_only -- //integration/... //src/...",
45+
"test-linker-jit": "bazel test --partial_compilation --test_tag_filters=partial-compilation-integration,-firefox --build_tests_only --//tools:force_partial_jit_compilation=True -- //integration/... //src/...",
4546
"check-mdc-tests": "ts-node --project scripts/tsconfig.json scripts/check-mdc-tests.ts",
4647
"check-mdc-exports": "ts-node --project scripts/tsconfig.json scripts/check-mdc-exports.ts",
4748
"check-tooling-setup": "yarn tsc --project tools/tsconfig.json && yarn tsc --project .ng-dev/tsconfig.json",

tools/BUILD.bazel

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
load("@bazel_skylib//rules:common_settings.bzl", "bool_flag")
2+
13
package(default_visibility = ["//visibility:public"])
24

35
exports_files([
@@ -13,6 +15,23 @@ config_setting(
1315
},
1416
)
1517

18+
# Command line flag that can be specified to force the JIT compilation to be used for tests
19+
# with partial compilation. By default, tests are processed with the linker at build time.
20+
bool_flag(
21+
name = "force_partial_jit_compilation",
22+
build_setting_default = False,
23+
)
24+
25+
# Config setting that matches if the force JIT compilation build setting is enabled.
26+
# This setting needs to be used in combination of the partial compilation build setting.
27+
config_setting(
28+
name = "force_partial_jit_compilation_enabled",
29+
flag_values = {
30+
"@npm//@angular/bazel/src:partial_compilation": "True",
31+
":force_partial_jit_compilation": "True",
32+
},
33+
)
34+
1635
# Detect if the build is running with stamping enabled.
1736
config_setting(
1837
name = "stamp",

tools/defaults.bzl

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -429,8 +429,10 @@ def spec_bundle(name, deps, **kwargs):
429429
deps = ["%s_devmode_deps" % name] + LINKER_PROCESSED_FW_PACKAGES,
430430
workspace_name = "angular_material",
431431
run_angular_linker = select({
432-
# Pass through whether partial compilation is enabled or not. This is helpful
433-
# for our integration tests which run all tests in partial compilation mode.
432+
# Depending on whether partial compilation is enabled, we may want to run the linker
433+
# to test the Angular compiler linker AOT processing. Additionally, a config setting
434+
# can forcibly disable the linker to ensure tests rely on JIT linking at runtime.
435+
"//tools:force_partial_jit_compilation_enabled": False,
434436
"//tools:partial_compilation_enabled": True,
435437
"//conditions:default": False,
436438
}),

0 commit comments

Comments
 (0)