Skip to content

Commit 29aa0ae

Browse files
committed
build: use worker for ts_project to enable fast DX and avoid no-sandbox issues
For the `rules_js` migration we are introducing a new ruleset for Angular rules. These rules are not used here by the CLI as we don't use `ng_module`, but we are building the rules in a way where we expose a worker binary that can also work with vanilla TS. The worker significantly speeds up compilations, bringing them to equivalent speeds of `ts_library`, and **importantly** fixes/avoids issues when actions are executing outside sandbox. E.g. on Windows where the tsc compilation currently can see many other files that aren't action inputs; and accidentally picks them up.
1 parent 59e9ccf commit 29aa0ae

File tree

2 files changed

+23
-3
lines changed

2 files changed

+23
-3
lines changed

WORKSPACE

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@ build_bazel_rules_nodejs_dependencies()
3737

3838
http_archive(
3939
name = "aspect_rules_js",
40-
sha256 = "75c25a0f15a9e4592bbda45b57aa089e4bf17f9176fd735351e8c6444df87b52",
41-
strip_prefix = "rules_js-2.1.0",
42-
url = "https://github.com/aspect-build/rules_js/releases/download/v2.1.0/rules_js-v2.1.0.tar.gz",
40+
sha256 = "3388abe9b9728ef68ea8d8301f932b11b2c9a271d74741ddd5f3b34d1db843ac",
41+
strip_prefix = "rules_js-2.1.1",
42+
url = "https://github.com/aspect-build/rules_js/releases/download/v2.1.1/rules_js-v2.1.1.tar.gz",
4343
)
4444

4545
load("@aspect_rules_js//js:repositories.bzl", "rules_js_dependencies")
@@ -216,3 +216,18 @@ rules_ts_dependencies(
216216
# TODO: Support in https://github.com/aspect-build/rules_ts/blob/main/ts/private/npm_repositories.bzl
217217
ts_version = "5.6.2",
218218
)
219+
220+
http_archive(
221+
name = "rules_angular",
222+
sha256 = "88b22d3bcf35d39d9c43f58061bb0b729e4c9d624d1b3409dca6a5d6301296e6",
223+
strip_prefix = "rules_angular-431051dc6232f247e2f37a2fbcb51989c6a75a5b",
224+
url = "https://github.com/devversion/rules_angular/archive/431051dc6232f247e2f37a2fbcb51989c6a75a5b.zip",
225+
)
226+
227+
load("@rules_angular//:repo_fetch.bzl", "rules_angular_deps_fetch")
228+
229+
rules_angular_deps_fetch()
230+
231+
load("@rules_angular//:repo_init.bzl", "rules_angular_deps_init")
232+
233+
rules_angular_deps_init()

tools/interop.bzl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,11 @@ def ts_project(name, module_name = None, interop_deps = [], deps = [], testonly
9494
testonly = testonly,
9595
tsconfig = "//:test-tsconfig" if testonly else "//:build-tsconfig",
9696
declaration = True,
97+
# Use the worker from our own Angular rules, as the default worker
98+
# from `rules_ts` is incompatible with TS5+ and abandoned. We need
99+
# worker for efficient, fast DX and avoiding Windows no-sandbox issues.
100+
supports_workers = 1,
101+
tsc_worker = "@rules_angular//worker:worker_vanilla_ts",
97102
deps = ["%s_interop_deps" % name] + deps,
98103
**kwargs
99104
)

0 commit comments

Comments
 (0)