Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ test --incompatible_strict_action_env
build --experimental_remote_merkle_tree_cache

# Ensure that tags applied in BUILDs propagate to actions
common --experimental_allow_tags_propagation
common --incompatible_allow_tags_propagation

# Ensure sandboxing is enabled even for exclusive tests
test --incompatible_exclusive_test_sandboxed
Expand Down
2 changes: 1 addition & 1 deletion .bazelversion
Original file line number Diff line number Diff line change
@@ -1 +1 @@
7.7.1
8.4.2
12 changes: 0 additions & 12 deletions BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -108,15 +108,3 @@ validate_ts_version_matching(
module_lock_file = "MODULE.bazel.lock",
package_json = "package.json",
)

# This is needed following https://github.com/bazel-contrib/rules_nodejs/pull/3859
toolchain(
name = "node22_windows_no_exec_config_toolchain",
exec_compatible_with = [],
target_compatible_with = [
"@platforms//os:windows",
"@platforms//cpu:x86_64",
],
toolchain = "@node22_windows_amd64//:toolchain",
toolchain_type = "@rules_nodejs//nodejs:toolchain_type",
)
19 changes: 5 additions & 14 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,13 @@ module(
name = "angular_cli",
)

bazel_dep(name = "platforms", version = "1.0.0")
bazel_dep(name = "yq.bzl", version = "0.3.2")
bazel_dep(name = "rules_nodejs", version = "6.6.2")
bazel_dep(name = "aspect_rules_js", version = "2.8.3")
bazel_dep(name = "aspect_rules_ts", version = "3.7.1")
bazel_dep(name = "rules_pkg", version = "0.8.1")

# Alow for usage of rules_pkg@0.8.1 even though other deps want a later verison.
multiple_version_override(
module_name = "rules_pkg",
versions = [
"0.8.1",
"1.1.0",
],
)

bazel_dep(name = "rules_pkg", version = "1.1.0")
bazel_dep(name = "rules_cc", version = "0.1.1")
bazel_dep(name = "aspect_bazel_lib", version = "2.22.0")
bazel_dep(name = "bazel_skylib", version = "1.8.2")
bazel_dep(name = "aspect_rules_esbuild", version = "0.24.0")
Expand Down Expand Up @@ -104,9 +96,6 @@ use_repo(
"node24_windows_amd64",
)

# This is needed following https://github.com/bazel-contrib/rules_nodejs/pull/3859
register_toolchains("//:node22_windows_no_exec_config_toolchain")

npm = use_extension("@aspect_rules_js//npm:extensions.bzl", "npm")
npm.npm_translate_lock(
name = "npm",
Expand Down Expand Up @@ -172,4 +161,6 @@ register_toolchains(
"@devinfra//bazel/git-toolchain:git_macos_x86_toolchain",
"@devinfra//bazel/git-toolchain:git_macos_arm64_toolchain",
"@devinfra//bazel/git-toolchain:git_windows_toolchain",
"//tools/toolchains:dummy_cc_windows_no_exec_toolchain",
"//tools/toolchains:node22_windows_no_exec_toolchain",
)
1,274 changes: 514 additions & 760 deletions MODULE.bazel.lock

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion packages/angular/ssr/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ pkg_tar(
name = "npm_package_archive",
srcs = [":npm_package"],
extension = "tgz",
strip_prefix = "./npm_package",
# should not be built unless it is a dependency of another rule
tags = ["manual"],
)
Expand Down
2 changes: 1 addition & 1 deletion scripts/build-packages-dist.mts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ function buildReleasePackages(
// List of targets to build. e.g. "packages/angular/cli:npm_package"
const targets = exec(queryPackagesCmd, true).split(/\r?\n/);
const packageNames = getPackageNamesOfTargets(targets);
const bazelBinPath = exec(`${bazelCmd} info bazel-bin`, true);
const bazelBinPath = join(import.meta.dirname, '../dist/bin');
const getBazelOutputPath = (pkgName: string) =>
join(bazelBinPath, 'packages', pkgName, 'npm_package');
const getDistPath = (pkgName: string) => join(distPath, pkgName);
Expand Down
3 changes: 1 addition & 2 deletions scripts/build.mts
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,7 @@ export default async function (
argv: { local?: boolean; snapshot?: boolean } = {},
): Promise<{ name: string; outputPath: string; tarPath: string }[]> {
const logger = globalThis.console;

const bazelBin = await _exec(`${bazelCmd} info bazel-bin`, true, logger);
const bazelBin = join(import.meta.dirname, '../dist/bin');

await _clean(logger);

Expand Down
12 changes: 1 addition & 11 deletions scripts/diff-release-package.mts
Original file line number Diff line number Diff line change
Expand Up @@ -62,17 +62,7 @@ async function main(packageName: string) {
git.run(['clone', `https://github.com/${snapshotRepoName}.git`, tmpDir]);
console.log(`--> Cloned snapshot repo.`);

const bazelBinDir = childProcess
.spawnSync(`${bazel} info bazel-bin`, {
shell: true,
encoding: 'utf8',
stdio: ['pipe', 'pipe', 'inherit'],
})
.stdout.trim();
if (bazelBinDir === '') {
throw new Error('Could not determine bazel-bin directory.');
}

const bazelBinDir = join(import.meta.dirname, '../dist/bin');
const outputPath = path.join(bazelBinDir, 'packages/', targetDir, 'npm_package');

// Delete old directory to avoid surprises, or stamping being outdated.
Expand Down
2 changes: 1 addition & 1 deletion tests/legacy-cli/e2e_runner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,7 @@ async function findPackageTars(): Promise<{ [pkg: string]: PkgInfo }> {
);

const pkgJsons = await Promise.all(
pkgs.map((pkg) => realpathSync(pkg)).map((pkg) => extractFile(pkg, './package.json')),
pkgs.map((pkg) => realpathSync(pkg)).map((pkg) => extractFile(pkg, 'npm_package/package.json')),
);

return pkgs.reduce(
Expand Down
3 changes: 2 additions & 1 deletion tools/bazel/npm_package.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ def npm_package(
name = "npm_package_archive",
srcs = [":pkg"],
extension = "tgz",
strip_prefix = "./npm_package",
# should not be built unless it is a dependency of another rule
tags = ["manual"],
visibility = visibility,
)
44 changes: 44 additions & 0 deletions tools/toolchains/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
load("@rules_cc//cc:defs.bzl", "cc_toolchain")
load(":dummy_cc_toolchain.bzl", "dummy_cc_toolchain_config")

# This is needed following https://github.com/bazel-contrib/rules_nodejs/pull/3859
toolchain(
name = "node22_windows_no_exec_toolchain",
exec_compatible_with = [],
target_compatible_with = [
"@platforms//os:windows",
"@platforms//cpu:x86_64",
],
toolchain = "@node22_windows_amd64//:toolchain",
toolchain_type = "@rules_nodejs//nodejs:toolchain_type",
)

# This defines a dummy C++ toolchain for Windows.
# Without this, the build fails with "Unable to find a CC toolchain using toolchain resolution".
dummy_cc_toolchain_config(name = "dummy_cc_toolchain_config")

filegroup(name = "empty")

cc_toolchain(
name = "dummy_cc_toolchain",
all_files = ":empty",
compiler_files = ":empty",
dwp_files = ":empty",
linker_files = ":empty",
objcopy_files = ":empty",
strip_files = ":empty",
supports_param_files = 0,
toolchain_config = ":dummy_cc_toolchain_config",
toolchain_identifier = "dummy_cc_toolchain",
)

toolchain(
name = "dummy_cc_windows_no_exec_toolchain",
exec_compatible_with = [],
target_compatible_with = [
"@platforms//os:windows",
"@platforms//cpu:x86_64",
],
toolchain = ":dummy_cc_toolchain",
toolchain_type = "@rules_cc//cc:toolchain_type",
)
28 changes: 28 additions & 0 deletions tools/toolchains/dummy_cc_toolchain.bzl
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
"""
This file defines a dummy C++ toolchain for Windows.
It is needed to satisfy Bazel's toolchain resolution when cross-compiling for Windows on Linux.
Some rules (e.g. rules_nodejs, js_test) or their dependencies may trigger C++ toolchain resolution
even if no actual C++ compilation is performed for the target platform.
Without this, the build fails with "Unable to find a CC toolchain using toolchain resolution".
"""

load("@rules_cc//cc:defs.bzl", "cc_common")

def _impl(ctx):
return cc_common.create_cc_toolchain_config_info(
ctx = ctx,
toolchain_identifier = "dummy-toolchain",
host_system_name = "local",
target_system_name = "local",
target_cpu = "x64_windows",
target_libc = "unknown",
compiler = "dummy",
abi_version = "unknown",
abi_libc_version = "unknown",
)

dummy_cc_toolchain_config = rule(
implementation = _impl,
attrs = {},
provides = [CcToolchainConfigInfo],
)