Skip to content

Commit b5d4de9

Browse files
committed
build: prepare for new ng_project rule and try in cdk/a11y
Sets up the new `ng_project` rule and uses it in `cdk/a11y`. Also sets up this rule similar to our `ts_project` interop- reusing that code completely, yay!
1 parent 538b8bc commit b5d4de9

File tree

8 files changed

+2050
-2003
lines changed

8 files changed

+2050
-2003
lines changed

.aspect/rules/external_repository_action_cache/npm_translate_lock_MzA5NzUwNzMx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@
22
# Input hashes for repository rule npm_translate_lock(name = "npm2", pnpm_lock = "@//:pnpm-lock.yaml").
33
# This file should be checked into version control along with the pnpm-lock.yaml file.
44
.npmrc=-1406867100
5-
package.json=303330631
6-
pnpm-lock.yaml=2094925072
5+
package.json=1688124479
6+
patches/@angular__compiler-cli.patch=1066638894
7+
pnpm-lock.yaml=1236422353
78
pnpm-workspace.yaml=14857322
89
src/cdk/package.json=-908433069
910
yarn.lock=230420156

WORKSPACE

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,7 @@ npm_translate_lock(
174174
},
175175
data = [
176176
"//:package.json",
177+
"//:patches/@angular__compiler-cli.patch",
177178
"//:pnpm-workspace.yaml",
178179
"//src/cdk:package.json",
179180
],
@@ -239,14 +240,21 @@ setup_dependencies_2()
239240

240241
git_repository(
241242
name = "rules_angular",
242-
commit = "bbf9493c73f4a2d715259e8febaa99c363ceaec3",
243+
commit = "92127883c3a3714e63782a51bac1a7c03ec8b0f5",
243244
remote = "https://github.com/devversion/rules_angular.git",
244245
)
245246

246-
load("@rules_angular//setup:step_1.bzl", "step_1")
247+
load("@rules_angular//setup:step_1.bzl", "rules_angular_step1")
247248

248-
step_1()
249+
rules_angular_step1()
249250

250-
load("@rules_angular//setup:step_2.bzl", "step_2")
251+
load("@rules_angular//setup:step_2.bzl", "rules_angular_step2")
251252

252-
step_2()
253+
rules_angular_step2()
254+
255+
load("@rules_angular//setup:step_3.bzl", "rules_angular_step3")
256+
257+
rules_angular_step3(
258+
angular_compiler_cli = "//:node_modules/@angular/compiler-cli",
259+
typescript = "//:node_modules/typescript",
260+
)

package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,9 @@
187187
},
188188
"pnpm": {
189189
"onlyBuiltDependencies": [],
190+
"patchedDependencies": {
191+
"@angular/compiler-cli@20.0.0-next.4": "patches/@angular__compiler-cli.patch"
192+
},
190193
"packageExtensions": {
191194
"@angular/animations": {
192195
"dependencies": {

patches/@angular__compiler-cli.patch

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
diff --git a/bundles/chunk-7CTS3DE5.js b/bundles/chunk-7CTS3DE5.js
2+
index c2dac3e174206f2e1e701cfc0a45cb9a12754d15..517e0a50292f96676dea638cf44014dfbf853a31 100755
3+
--- a/bundles/chunk-7CTS3DE5.js
4+
+++ b/bundles/chunk-7CTS3DE5.js
5+
@@ -4189,7 +4189,7 @@ var NgCompiler = class {
6+
let aliasingHost = null;
7+
if (this.adapter.unifiedModulesHost === null || !this.options["_useHostForImportGeneration"] && !this.options["_useHostForImportAndAliasGeneration"]) {
8+
let localImportStrategy;
9+
- if (this.options.rootDir !== void 0 || this.options.rootDirs !== void 0 && this.options.rootDirs.length > 0) {
10+
+ if (this.options.rootDirs !== void 0 && this.options.rootDirs.length > 0) {
11+
localImportStrategy = new LogicalProjectStrategy(reflector, new LogicalFileSystem([...this.adapter.rootDirs], this.adapter));
12+
} else {
13+
localImportStrategy = new RelativePathStrategy(reflector);

pnpm-lock.yaml

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

src/cdk/a11y/BUILD.bazel

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,21 @@
11
load(
22
"//tools:defaults.bzl",
33
"markdown_to_html",
4-
"ng_module",
54
"ng_web_test_suite",
65
"sass_binary",
76
"sass_library",
87
)
9-
load("//tools:defaults2.bzl", "ts_project")
8+
load("//tools:defaults2.bzl", "ng_project", "ts_project")
109

1110
package(default_visibility = ["//visibility:public"])
1211

13-
ng_module(
12+
ng_project(
1413
name = "a11y",
1514
srcs = glob(
1615
["**/*.ts"],
1716
exclude = ["**/*.spec.ts"],
1817
),
19-
deps = [
18+
interop_deps = [
2019
"//src:dev_mode_types",
2120
"//src/cdk/coercion",
2221
"//src/cdk/coercion/private",
@@ -25,8 +24,11 @@ ng_module(
2524
"//src/cdk/observers",
2625
"//src/cdk/platform",
2726
"//src/cdk/private",
28-
"@npm//@angular/core",
29-
"@npm//rxjs",
27+
],
28+
deps = [
29+
"//:node_modules/@angular/common",
30+
"//:node_modules/@angular/core",
31+
"//:node_modules/rxjs",
3032
],
3133
)
3234

tools/bazel/ts_project_interop.bzl

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
load("@aspect_rules_js//js:providers.bzl", "JsInfo", "js_info")
2-
load("@aspect_rules_ts//ts:defs.bzl", _ts_project = "ts_project")
2+
load("@rules_angular//src/ts_project:index.bzl", _ts_project = "ts_project")
33
load("@build_bazel_rules_nodejs//:providers.bzl", "DeclarationInfo", "JSEcmaScriptModuleInfo", "JSModuleInfo", "LinkablePackageInfo")
44
load("@devinfra//bazel/ts_project:index.bzl", "strict_deps_test")
55

@@ -109,6 +109,7 @@ def ts_project(
109109
# TODO: Switch this flag as we no longer depend on `interop_deps`.
110110
ignore_strict_deps = True,
111111
enable_runtime_rnjs_interop = True,
112+
rule_impl = _ts_project,
112113
**kwargs):
113114
# Pull in the `rules_nodejs` variants of dependencies we know are "hybrid". This
114115
# is necessary as we can't mix `npm/node_modules` from RNJS with the pnpm-style
@@ -133,17 +134,12 @@ def ts_project(
133134
testonly = testonly,
134135
)
135136

136-
_ts_project(
137+
rule_impl(
137138
name = "%s_rjs" % name,
138139
testonly = testonly,
139140
declaration = True,
140141
tsconfig = tsconfig,
141142
visibility = visibility,
142-
# Use the worker from our own Angular rules, as the default worker
143-
# from `rules_ts` is incompatible with TS5+ and abandoned. We need
144-
# worker for efficient and fast DX.
145-
supports_workers = 1,
146-
tsc_worker = "@rules_angular//worker:worker_vanilla_ts",
147143
deps = [":%s_interop_deps" % name] + deps,
148144
**kwargs
149145
)

tools/defaults2.bzl

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ load("@aspect_rules_jasmine//jasmine:defs.bzl", _jasmine_test = "jasmine_test")
22
load("//tools/bazel:ts_project_interop.bzl", _ts_project = "ts_project")
33
load("//tools/bazel:module_name.bzl", "compute_module_name")
44
load("@aspect_rules_js//npm:defs.bzl", _npm_package = "npm_package")
5+
load("@rules_angular//src/ng_project:index.bzl", _ng_project = "ng_project")
56

67
def npm_package(**kwargs):
78
_npm_package(**kwargs)
@@ -23,6 +24,24 @@ def ts_project(
2324
# if False and not testonly:
2425
# _make_tsec_test(kwargs["name"])
2526

27+
def ng_project(
28+
name,
29+
source_map = True,
30+
testonly = False,
31+
**kwargs):
32+
_ts_project(
33+
name,
34+
source_map = source_map,
35+
module_name = compute_module_name(testonly),
36+
rule_impl = _ng_project,
37+
testonly = testonly,
38+
**kwargs
39+
)
40+
41+
# TODO(devversion): Partner with ISE team to support `rules_js` here.
42+
# if False and not testonly:
43+
# _make_tsec_test(kwargs["name"])
44+
2645
def jasmine_test(data = [], args = [], **kwargs):
2746
# Create relative path to root, from current package dir. Necessary as
2847
# we change the `chdir` below to the package directory.

0 commit comments

Comments
 (0)