Skip to content

Commit a957283

Browse files
committed
build: migrate to bazel 7.6.0 and use bazel modules
1 parent c8af5c0 commit a957283

11 files changed

Lines changed: 820 additions & 82 deletions

File tree

.bazelversion

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
6.5.0
1+
7.6.0

MODULE.bazel

Lines changed: 46 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,53 @@
1-
module(
2-
name = "rules_angular",
3-
version = "0.0.0",
4-
)
1+
module(name = "rules_angular")
52

6-
bazel_dep(name = "aspect_bazel_lib", version = "2.14.0")
7-
bazel_dep(name = "aspect_rules_js", version = "2.3.3")
8-
bazel_dep(name = "aspect_rules_ts", version = "3.6.0", dev_dependency = True)
9-
bazel_dep(name = "bazel_skylib", version = "1.3.0")
3+
bazel_dep(name = "yq.bzl", version = "0.2.0")
4+
bazel_dep(name = "aspect_bazel_lib", version = "2.19.3")
5+
bazel_dep(name = "aspect_rules_js", version = "2.4.2")
6+
bazel_dep(name = "aspect_rules_ts", version = "3.6.3")
7+
bazel_dep(name = "bazel_skylib", version = "1.8.1")
108
bazel_dep(name = "jq.bzl", version = "0.1.0")
11-
bazel_dep(name = "rules_nodejs", version = "6.4.0")
9+
bazel_dep(name = "rules_nodejs", version = "6.5.0")
1210

13-
rules_ts_ext = use_extension("@aspect_rules_ts//ts:extensions.bzl", "ext", dev_dependency = True)
11+
yq = use_extension("@yq.bzl//yq:extensions.bzl", "yq")
12+
use_repo(yq, "yq_toolchains")
1413

14+
rules_ts_ext = use_extension("@aspect_rules_ts//ts:extensions.bzl", "ext")
1515
rules_ts_ext.deps(
16-
#ts_version_from = "//:package.json",
17-
# TODO: Support in https://github.com/aspect-build/rules_ts/blob/main/ts/private/npm_repositories.bzl
18-
ts_version = "5.6.2",
16+
name = "rules_angular_npm_typescript",
17+
# Obtained by: curl --silent https://registry.npmjs.org/typescript/5.9.2 | jq -r '.dist.integrity'
18+
ts_integrity = "sha512-CWBzXQrc/qOkhidw1OzBTQuYRbfyxDXJMVJ1XNwUHGROVmuaeiEm3OslpZ1RV96d7SKKjZKrSJu3+t/xlw3R9A==",
19+
ts_version = "5.9.2",
20+
)
21+
use_repo(rules_ts_ext, **{"npm_typescript": "rules_angular_npm_typescript"})
22+
23+
node = use_extension("@rules_nodejs//nodejs:extensions.bzl", "node")
24+
node.toolchain(
25+
node_repositories = {
26+
"24.0.0-darwin_arm64": ("node-v24.0.0-darwin-arm64.tar.gz", "node-v24.0.0-darwin-arm64", "194e2f3dd3ec8c2adcaa713ed40f44c5ca38467880e160974ceac1659be60121"),
27+
"24.0.0-darwin_amd64": ("node-v24.0.0-darwin-x64.tar.gz", "node-v24.0.0-darwin-x64", "f716b3ce14a7e37a6cbf97c9de10d444d7da07ef833cd8da81dd944d111e6a4a"),
28+
"24.0.0-linux_arm64": ("node-v24.0.0-linux-arm64.tar.xz", "node-v24.0.0-linux-arm64", "d40ec7ffe0b82b02dce94208c84351424099bd70fa3a42b65c46d95322305040"),
29+
"24.0.0-linux_ppc64le": ("node-v24.0.0-linux-ppc64le.tar.xz", "node-v24.0.0-linux-ppc64le", "cfa0e8d51a2f9a446f1bfb81cdf4c7e95336ad622e2aa230e3fa1d093c63d77d"),
30+
"24.0.0-linux_s390x": ("node-v24.0.0-linux-s390x.tar.xz", "node-v24.0.0-linux-s390x", "e37a04c7ee05416ec1234fd3255e05b6b81287eb0424a57441c8b69f0a155021"),
31+
"24.0.0-linux_amd64": ("node-v24.0.0-linux-x64.tar.xz", "node-v24.0.0-linux-x64", "59b8af617dccd7f9f68cc8451b2aee1e86d6bd5cb92cd51dd6216a31b707efd7"),
32+
"24.0.0-windows_amd64": ("node-v24.0.0-win-x64.zip", "node-v24.0.0-win-x64", "3d0fff80c87bb9a8d7f49f2f27832aa34a1477d137af46f5b14df5498be81304"),
33+
},
34+
node_version = "24.0.0",
1935
)
2036

21-
use_repo(rules_ts_ext, "npm_typescript")
37+
npm = use_extension("@aspect_rules_js//npm:extensions.bzl", "npm")
38+
npm.npm_translate_lock(
39+
name = "rules_angular_npm",
40+
data = [
41+
"@rules_angular//:package.json",
42+
],
43+
npmrc = "//:.npmrc",
44+
pnpm_lock = "@rules_angular//:pnpm-lock.yaml",
45+
)
46+
use_repo(npm, "rules_angular_npm")
47+
48+
rules_angular = use_extension("//setup:extensions.bzl", "rules_angular")
49+
rules_angular.setup(
50+
angular_compiler_cli = "//:node_modules/@angular/compiler-cli",
51+
typescript = "//:node_modules/typescript-local",
52+
)
53+
use_repo(rules_angular, "rules_angular_configurable_deps")

MODULE.bazel.lock

Lines changed: 746 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

WORKSPACE

Lines changed: 0 additions & 40 deletions
This file was deleted.

setup/extensions.bzl

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
load("//setup:repositories.bzl", "configurable_deps_repo")
2+
3+
def _extension(ctx):
4+
for mod in ctx.modules:
5+
for attr in mod.tags.setup:
6+
configurable_deps_repo(
7+
name = attr.name,
8+
angular_compiler_cli = attr.angular_compiler_cli,
9+
typescript = attr.typescript,
10+
)
11+
12+
rules_angular = module_extension(
13+
implementation = _extension,
14+
tag_classes = {
15+
"setup": tag_class(attrs = {
16+
"name": attr.string(default = "rules_angular_configurable_deps"),
17+
"angular_compiler_cli": attr.string(mandatory = True),
18+
"typescript": attr.string(mandatory = True),
19+
}),
20+
},
21+
)
Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
def _step3_impl(rctx):
1+
def _configurable_deps_impl(rctx):
22
rctx.file(
33
"BUILD.bazel",
44
content = """
@@ -19,8 +19,8 @@ alias(
1919
),
2020
)
2121

22-
_step3 = repository_rule(
23-
implementation = _step3_impl,
22+
configurable_deps_repo = repository_rule(
23+
implementation = _configurable_deps_impl,
2424
attrs = {
2525
"angular_compiler_cli": attr.label(
2626
mandatory = True,
@@ -32,10 +32,3 @@ _step3 = repository_rule(
3232
),
3333
},
3434
)
35-
36-
def rules_angular_step3(angular_compiler_cli, typescript):
37-
_step3(
38-
name = "rules_angular_configurable_deps",
39-
angular_compiler_cli = angular_compiler_cli,
40-
typescript = typescript,
41-
)

setup/step_1.bzl

Lines changed: 0 additions & 11 deletions
This file was deleted.

setup/step_2.bzl

Lines changed: 0 additions & 4 deletions
This file was deleted.

src/optimization/boilerplate/generate.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ function suppress_on_success {
1414

1515
# find path to the Angular CLI executable.
1616
RUNFILES="$(realpath $0.runfiles)"
17-
NG_CLI_TOOL="$RUNFILES/rules_angular/src/optimization/ng_cli_tool_/ng_cli_tool"
17+
NG_CLI_TOOL="$RUNFILES/_main/src/optimization/ng_cli_tool_/ng_cli_tool"
1818

1919
# cd into the bazel bin dir
2020
cd ${OUT_DIR}/..

src/optimization/optimize.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ function suppress_on_success {
1515

1616
# find path to the Angular CLI executable.
1717
RUNFILES="$(realpath $0.runfiles)"
18-
NG_CLI_TOOL="$RUNFILES/rules_angular/src/optimization/ng_cli_tool_/ng_cli_tool"
18+
NG_CLI_TOOL="$RUNFILES/_main/src/optimization/ng_cli_tool_/ng_cli_tool"
1919

2020
# Copy Angular CLI boilerplate.
2121
cp -Rf -L $BOILERPLATE_DIR/* $OUT_DIR

0 commit comments

Comments
 (0)