build: use snapshot builds for dependencies in @angular/language-server (#64334)

This commit introduces a mechanism to use snapshot builds for @angular/language-service dependencies when building the VSCode extension.

A new --//:enable_snapshot_repo_deps flag allows swapping the stable versioned dependency with a snapshot build from the angular/language-server-builds GitHub repository. This enables testing and development against the latest unreleased version of the language service.

PR Close #64334
This commit is contained in:
Alan Agius
2025-10-10 06:48:51 -07:00
committed by Andrew Kushnir
parent 94067fb0e4
commit 8693959fc7
3 changed files with 31 additions and 4 deletions
+3
View File
@@ -69,6 +69,9 @@ build:release --stamp
# Snapshots should also be stamped with version control information.
build:snapshot-build --workspace_status_command="pnpm --silent ng-dev release build-env-stamp --mode=snapshot"
build:snapshot-build --stamp
# @angular/language-server package depends directly on other Angular framework packages.
# This flag ensures that the language server uses the snapshot-built framework packages from the repository.
build:snapshot-build --//:enable_language_server_snapshot_repo_deps
# Angular DevTools for Firefox releases *cannot* be stamped and `--config snapshot-build-firefox` is a no-op.
# This is because Mozilla requires add-on source code to be uploaded and then they manually reproduce the build.
+16
View File
@@ -1,4 +1,5 @@
load("@aspect_rules_js//js:defs.bzl", "js_library")
load("@bazel_skylib//rules:common_settings.bzl", "bool_flag")
load("@devinfra//bazel/validation:defs.bzl", "validate_ts_version_matching")
load("@npm//:defs.bzl", "npm_link_all_packages")
load("//tools:defaults.bzl", "copy_to_bin")
@@ -71,3 +72,18 @@ alias(
"@devinfra//bazel/constraints:macos_arm64": "@sauce_connect_mac//:bin/sc",
}),
)
# When enabled, this flag substitutes dependency versions with snapshot repositories
# for all packages in this repository. Note that this does not apply to peer
# dependencies, as they must be installed directly.
bool_flag(
name = "enable_language_server_snapshot_repo_deps",
build_setting_default = False,
)
config_setting(
name = "language_server_package_json_use_snapshot_repo_deps",
flag_values = {
":enable_language_server_snapshot_repo_deps": "true",
},
)
+12 -4
View File
@@ -61,10 +61,18 @@ esbuild(
expand_template_rule(
name = "package_json_expanded",
out = "package_expanded.json",
stamp_substitutions = {
"0.0.0-PLACEHOLDER": "{{STABLE_PROJECT_VERSION}}",
"workspace:*": "{{STABLE_PROJECT_VERSION}}",
},
# We only have a single dependency now, which makes this safe.
# In the case we add more we should consider adding a JQ filter.
stamp_substitutions = select({
"//:language_server_package_json_use_snapshot_repo_deps": {
"0.0.0-PLACEHOLDER": "{{STABLE_PROJECT_VERSION}}",
"workspace:*": "github:angular/language-server-builds#{{BUILD_SCM_ABBREV_HASH}}",
},
"//conditions:default": {
"0.0.0-PLACEHOLDER": "{{STABLE_PROJECT_VERSION}}",
"workspace:*": "{{STABLE_PROJECT_VERSION}}",
},
}),
substitutions = {
"0.0.0-PLACEHOLDER": "0.0.0",
"workspace:*": "0.0.0",