Skip to content

Commit e072b8d

Browse files
committed
fixup! build: use worker for ts_project to enable fast DX and avoid no-sandbox issues
ds
1 parent 12e745c commit e072b8d

File tree

3 files changed

+26
-15
lines changed

3 files changed

+26
-15
lines changed

WORKSPACE

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ register_toolchains(
88
"//tools:windows_tar_system_toolchain",
99
)
1010

11-
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
11+
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive", "http_file")
1212

1313
http_archive(
1414
name = "bazel_skylib",
@@ -217,17 +217,8 @@ rules_ts_dependencies(
217217
ts_version = "5.6.2",
218218
)
219219

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",
220+
http_file(
221+
name = "tsc_worker",
222+
sha256 = "04641af22566899361ab2b9c50f87bce04bf71df86efac3d7fa61f849c6efc24",
223+
urls = ["https://raw.githubusercontent.com/devversion/rules_angular/fc7712f2579581e9d0aa5d0c674cda20197b6c98/dist/worker.mjs"],
225224
)
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/BUILD.bazel

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
load("@aspect_bazel_lib//lib/private:tar_toolchain.bzl", "tar_toolchain")
2+
load("@aspect_rules_js//js:defs.bzl", "js_binary")
3+
load("@bazel_skylib//rules:copy_file.bzl", "copy_file")
24

35
# Copyright Google Inc. All Rights Reserved.
46
#
@@ -42,4 +44,22 @@ toolchain(
4244
toolchain = ":system_tar_exec",
4345
toolchain_type = "@aspect_bazel_lib//lib:tar_toolchain_type",
4446
)
47+
48+
# TODO(devversion): Improve this by potentially sharing this common block.
49+
copy_file(
50+
name = "copy_worker_js",
51+
src = "@tsc_worker//file",
52+
out = "ts_worker.mjs",
53+
)
54+
55+
js_binary(
56+
name = "vanilla_ts_worker",
57+
data = [
58+
":copy_worker_js",
59+
"//:root_modules/@angular/compiler-cli",
60+
"//:root_modules/typescript",
61+
],
62+
entry_point = ":copy_worker_js",
63+
fixed_args = ["--vanilla-ts"],
64+
)
4565
# @external_end

tools/interop.bzl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ def ts_project(name, module_name = None, interop_deps = [], deps = [], testonly
9898
# from `rules_ts` is incompatible with TS5+ and abandoned. We need
9999
# worker for efficient, fast DX and avoiding Windows no-sandbox issues.
100100
supports_workers = 1,
101-
tsc_worker = "@rules_angular//worker:worker_vanilla_ts",
101+
tsc_worker = "//tools:vanilla_ts_worker",
102102
deps = ["%s_interop_deps" % name] + deps,
103103
**kwargs
104104
)

0 commit comments

Comments
 (0)