diff --git a/.circleci/config.yml b/.circleci/config.yml index 0024b90e3fe8..9642727ceb4f 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -472,7 +472,6 @@ jobs: - *yarn_install - *setup_bazel_binary - - run: yarn integration-tests:partial-ivy - run: yarn integration-tests - run: name: Running size integration tests (failures are reported in Slack only). @@ -482,9 +481,47 @@ jobs: - *slack_notify_on_failure # ---------------------------------------------------------------------------- - # Job that runs all integration tests against Angular snapshot builds. + # Job that runs the AOT linker tests. # ---------------------------------------------------------------------------- - integration_tests_snapshot: + linker_aot_test: + <<: *job_defaults + resource_class: xlarge + environment: + GCP_DECRYPT_TOKEN: *gcp_decrypt_token + steps: + - checkout_and_rebase + - *restore_cache + - *setup_bazel_ci_config + - *setup_bazel_remote_execution + - *yarn_install + - *setup_bazel_binary + + - run: yarn test-linker-aot + - *slack_notify_on_failure + + # ---------------------------------------------------------------------------- + # Job that runs the JIT linker tests. + # ---------------------------------------------------------------------------- + linker_jit_test: + <<: *job_defaults + resource_class: xlarge + environment: + GCP_DECRYPT_TOKEN: *gcp_decrypt_token + steps: + - checkout_and_rebase + - *restore_cache + - *setup_bazel_ci_config + - *setup_bazel_remote_execution + - *yarn_install + - *setup_bazel_binary + + - run: yarn test-linker-jit + - *slack_notify_on_failure + + # ---------------------------------------------------------------------------- + # Job that runs both AOT and JIT linker tests against Angular snapshot builds. + # ---------------------------------------------------------------------------- + snapshot_linker_tests: <<: *job_defaults resource_class: xlarge environment: @@ -498,7 +535,8 @@ jobs: - *yarn_install_loose_lockfile - *setup_bazel_binary - - run: yarn integration-tests:partial-ivy + - run: yarn test-linker-aot + - run: yarn test-linker-jit - *slack_notify_on_failure # ---------------------------------------------------------------------------- @@ -544,6 +582,10 @@ workflows: filters: *ignore_presubmit_branch_filter - integration_tests: filters: *ignore_presubmit_branch_filter + - linker_aot_test: + filters: *ignore_presubmit_branch_filter + - linker_jit_test: + filters: *ignore_presubmit_branch_filter - tests_local_browsers: filters: *ignore_presubmit_branch_filter - tests_browserstack: @@ -578,7 +620,7 @@ workflows: filters: *only_main_branch_filter - mdc_snapshot_test_cronjob: filters: *only_main_branch_filter - - integration_tests_snapshot: + - snapshot_linker_tests: filters: *only_main_branch_filter triggers: diff --git a/integration/linker/BUILD.bazel b/integration/linker/BUILD.bazel index 0e3d610a34fc..f84234bfcbde 100644 --- a/integration/linker/BUILD.bazel +++ b/integration/linker/BUILD.bazel @@ -19,5 +19,4 @@ nodejs_test( "@npm//glob", ], entry_point = "link-packages-test.mjs", - tags = ["partial-compilation-integration"], ) diff --git a/package.json b/package.json index 846e5f10bb4f..1a8e84d10e04 100644 --- a/package.json +++ b/package.json @@ -40,8 +40,9 @@ "approve-api": "node ./scripts/approve-api-golden.js", "approve-size-tests": "node ./scripts/approve-size-golden.js", "integration-tests": "bazel test --test_tag_filters=-linker-integration-test --build_tests_only -- //integration/... -//integration/size-test/...", - "integration-tests:partial-ivy": "bazel test --partial_compilation --test_tag_filters=partial-compilation-integration,-firefox --build_tests_only -- //integration/... //src/...", "integration-tests:size-test": "bazel test //integration/size-test/...", + "test-linker-aot": "bazel test --partial_compilation --test_tag_filters=partial-compilation-integration,-firefox --build_tests_only -- //integration/... //src/...", + "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/...", "check-mdc-tests": "ts-node --project scripts/tsconfig.json scripts/check-mdc-tests.ts", "check-mdc-exports": "ts-node --project scripts/tsconfig.json scripts/check-mdc-exports.ts", "check-tooling-setup": "yarn tsc --project tools/tsconfig.json && yarn tsc --project .ng-dev/tsconfig.json", diff --git a/tools/BUILD.bazel b/tools/BUILD.bazel index 846a8305a8b0..196b3c6c93cc 100644 --- a/tools/BUILD.bazel +++ b/tools/BUILD.bazel @@ -1,3 +1,5 @@ +load("@bazel_skylib//rules:common_settings.bzl", "bool_flag") + package(default_visibility = ["//visibility:public"]) exports_files([ @@ -13,6 +15,23 @@ config_setting( }, ) +# Command line flag that can be specified to force the JIT compilation to be used for tests +# with partial compilation. By default, tests are processed with the linker at build time. +bool_flag( + name = "force_partial_jit_compilation", + build_setting_default = False, +) + +# Config setting that matches if the force JIT compilation build setting is enabled. +# This setting needs to be used in combination of the partial compilation build setting. +config_setting( + name = "force_partial_jit_compilation_enabled", + flag_values = { + "@npm//@angular/bazel/src:partial_compilation": "True", + ":force_partial_jit_compilation": "True", + }, +) + # Detect if the build is running with stamping enabled. config_setting( name = "stamp", diff --git a/tools/defaults.bzl b/tools/defaults.bzl index fc73655ad34c..18f6bd8c519e 100644 --- a/tools/defaults.bzl +++ b/tools/defaults.bzl @@ -429,8 +429,10 @@ def spec_bundle(name, deps, **kwargs): deps = ["%s_devmode_deps" % name] + LINKER_PROCESSED_FW_PACKAGES, workspace_name = "angular_material", run_angular_linker = select({ - # Pass through whether partial compilation is enabled or not. This is helpful - # for our integration tests which run all tests in partial compilation mode. + # Depending on whether partial compilation is enabled, we may want to run the linker + # to test the Angular compiler linker AOT processing. Additionally, a config setting + # can forcibly disable the linker to ensure tests rely on JIT linking at runtime. + "//tools:force_partial_jit_compilation_enabled": False, "//tools:partial_compilation_enabled": True, "//conditions:default": False, }),