Skip to content

Commit 1a2426f

Browse files
committed
build: run partial compilation tests with linker at JIT
Runs partial compilation tests with the linker at JIT.
1 parent a801603 commit 1a2426f

File tree

4 files changed

+77
-12
lines changed

4 files changed

+77
-12
lines changed

.circleci/config.yml

Lines changed: 50 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,13 @@ 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
589+
# TODO: This should be removed!!
590+
- snapshot_linker_tests:
591+
filters: *ignore_presubmit_branch_filter
547592
- tests_local_browsers:
548593
filters: *ignore_presubmit_branch_filter
549594
- tests_browserstack:
@@ -578,7 +623,7 @@ workflows:
578623
filters: *only_main_branch_filter
579624
- mdc_snapshot_test_cronjob:
580625
filters: *only_main_branch_filter
581-
- integration_tests_snapshot:
626+
- snapshot_linker_tests:
582627
filters: *only_main_branch_filter
583628

584629
triggers:

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/spec-bundling/esbuild.config-tmpl.mjs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,8 @@
1010
// is generated and can end up in arbitrary Bazel packages.
1111
import {createLinkerEsbuildPlugin} from 'angular_material/tools/angular/create_linker_esbuild_plugin.mjs';
1212

13-
// Conditionally, based on whether partial compilation is enabled, we run the
14-
// linker on all files part of the test.
15-
const plugins = TMPL_PARTIAL_COMPILATION_ENABLED
13+
// Based on the Bazel action and its substitutions, we run the linker for all inputs.
14+
const plugins = TMPL_RUN_LINKER
1615
? [await createLinkerEsbuildPlugin(/.*/, /* ensureNoPartialDeclaration */ true)]
1716
: [];
1817

tools/spec-bundling/index.bzl

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,10 +105,12 @@ def spec_bundle(name, platform, deps, **kwargs):
105105
template = "//tools/spec-bundling:esbuild.config-tmpl.mjs",
106106
output_name = "%s_config.mjs" % name,
107107
substitutions = select({
108-
# Pass through whether partial compilation is enabled or not. This is helpful
109-
# for our integration tests which run all tests in partial compilation mode.
110-
"//tools:partial_compilation_enabled": {"TMPL_PARTIAL_COMPILATION_ENABLED": "true"},
111-
"//conditions:default": {"TMPL_PARTIAL_COMPILATION_ENABLED": "false"},
108+
# Depending on whether partial compilation is enabled, we may want to run the linker
109+
# to test the Angular compiler linker AOT processing. Additionally, a config setting
110+
# can forcibly disable the linker to ensure tests rely on JIT linking at runtime.
111+
"//tools:force_partial_jit_compilation_enabled": {"TMPL_RUN_LINKER": "false"},
112+
"//tools:partial_compilation_enabled": {"TMPL_RUN_LINKER": "true"},
113+
"//conditions:default": {"TMPL_RUN_LINKER": "false"},
112114
}),
113115
)
114116

0 commit comments

Comments
 (0)