-
-
Notifications
You must be signed in to change notification settings - Fork 108
/
WORKSPACE
269 lines (216 loc) · 9.76 KB
/
WORKSPACE
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
workspace(name = "aspect_rules_js")
# buildifier: disable=bzl-visibility
load("//js/private:dev_deps.bzl", "rules_js_dev_dependencies")
rules_js_dev_dependencies()
load("@aspect_rules_js//js:repositories.bzl", "rules_js_dependencies")
rules_js_dependencies()
load("@aspect_rules_js//js:toolchains.bzl", "rules_js_register_toolchains")
rules_js_register_toolchains(node_version = "16.14.2")
load("@aspect_bazel_lib//lib:repositories.bzl", "register_expand_template_toolchains")
register_expand_template_toolchains()
load("@rules_nodejs//nodejs:repositories.bzl", "nodejs_register_toolchains")
# Alternate toolchains for testing across versions
nodejs_register_toolchains(
name = "node16",
node_version = "16.13.1",
)
nodejs_register_toolchains(
name = "node18",
node_version = "18.13.0",
)
nodejs_register_toolchains(
name = "node20",
node_version = "20.11.1",
)
load("@bazel_skylib//lib:unittest.bzl", "register_unittest_toolchains")
register_unittest_toolchains()
load("@aspect_bazel_lib//lib:host_repo.bzl", "host_repo")
host_repo(name = "aspect_bazel_lib_host")
############################################
# Gazelle, for generating bzl_library targets
load("@bazel_gazelle//:deps.bzl", "gazelle_dependencies")
load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains", "go_rules_dependencies")
go_rules_dependencies()
go_register_toolchains(version = "1.20.5")
gazelle_dependencies()
############################################
# Example npm dependencies
load("@aspect_rules_js//npm:repositories.bzl", "npm_import", "npm_translate_lock")
npm_translate_lock(
name = "npm",
bins = {
# derived from "bin" attribute in node_modules/typescript/package.json
"typescript": {
"tsc": "./bin/tsc",
"tsserver": "./bin/tsserver",
},
},
custom_postinstalls = {
"@aspect-test/c": "echo moo > cow.txt",
"@aspect-test/c@2.0.2": "echo mooo >> cow.txt",
},
data = [
"//:examples/npm_deps/patches/meaning-of-life@1.0.0-pnpm.patch",
"//:package.json",
"//:pnpm-workspace.yaml",
"//examples/js_binary:package.json",
"//examples/linked_consumer:package.json",
"//examples/linked_empty_node_modules:package.json",
"//examples/linked_lib:package.json",
"//examples/linked_pkg:package.json",
"//examples/macro:package.json",
"//examples/npm_deps:package.json",
"//examples/npm_package/libs/lib_a:package.json",
"//examples/npm_package/packages/pkg_a:package.json",
"//examples/npm_package/packages/pkg_b:package.json",
"//examples/npm_package/packages/pkg_d:package.json",
"//examples/npm_package/packages/pkg_e:package.json",
"//examples/runfiles:package.json",
"//examples/webpack_cli:package.json",
"//js/private/coverage/bundle:package.json",
"//js/private/image:package.json",
"//js/private/test/image:package.json",
"//js/private/test/js_run_devserver:package.json",
"//js/private/worker/src:package.json",
"//npm/private/test:package.json",
"//npm/private/test:vendored/lodash-4.17.21.tgz",
"//npm/private/test/npm_package:package.json",
"//npm/private/test/npm_package_publish:package.json",
"//npm/private/test/vendored/is-odd:package.json",
"//npm/private/test/vendored/semver-max:package.json",
],
generate_bzl_library_targets = True,
lifecycle_hooks = {
# We fetch @kubernetes/client-node from source and it has a `prepare` lifecycle hook that needs to be run
# which runs the `build` package.json script: https://github.com/kubernetes-client/javascript/blob/fc681991e61c6808dd26012a2331f83671a11218/package.json#L28.
# Here we run run build so we just run `tsc` instead of `npm run build` which ends up just running `tsc`.
"@kubernetes/client-node": ["build"],
# 'install' hook fails as it assumes the following path to `node-pre-gyp`: ./node_modules/.bin/node-pre-gyp
# https://github.com/stultuss/protoc-gen-grpc-ts/blob/53d52a9d0e1fe3cbe930dec5581eca89b3dde807/package.json#L28
"protoc-gen-grpc@2.0.3": [],
},
lifecycle_hooks_execution_requirements = {
"*": [
"no-sandbox",
],
# If @kubernetes/client-node is not sandboxed, will fail with
# ```
# src/azure_auth.ts(97,43): error TS2575: No overload expects 2 arguments, but overloads do exist that expect either 1 or 4 arguments.
# src/azure_auth.ts(98,34): error TS2575: No overload expects 2 arguments, but overloads do exist that expect either 1 or 4 arguments.
# src/gcp_auth.ts(93,43): error TS2575: No overload expects 2 arguments, but overloads do exist that expect either 1 or 4 arguments.
# src/gcp_auth.ts(94,34): error TS2575: No overload expects 2 arguments, but overloads do exist that expect either 1 or 4 arguments.
# ```
# since a `jsonpath-plus@7.2.0` that is newer then the transitive dep `jsonpath-plus@0.19.0` is found outside of the sandbox that
# includes typings that don't match the 0.19.0 "any" usage.
"@kubernetes/client-node": [],
"@figma/nodegit": [
"no-sandbox",
"requires-network",
],
"esbuild": [
"no-sandbox",
"requires-network",
],
"segfault-handler": [
"no-sandbox",
"requires-network",
],
"puppeteer": [
"no-sandbox",
"requires-network",
],
},
npmrc = "//:.npmrc",
package_visibility = {
"unused": ["//visibility:private"],
"@mycorp/pkg-a": ["//examples:__subpackages__"],
},
pnpm_lock = "//:pnpm-lock.yaml",
# Use a version that's not vendored into rules_js by providing a (version, integrity) tuple.
# curl --silent https://registry.npmjs.org/pnpm | jq '.versions["8.6.11"].dist.integrity'
pnpm_version = ("8.6.11", "sha512-jqknppuj45tDzJsLcLqkAxytBHZXIx9JTYkGNq0/7pSRggpio9wRxTDj4NA2ilOHPlJ5BVjB5Ij5dx65woMi5A=="),
public_hoist_packages = {
# Instructs the linker to hoist the ms@2.1.3 npm package to `node_modules/ms` in the `examples/npm_deps` package.
# Similar to adding `public-hoist-pattern[]=ms` in .npmrc but with control over which version to hoist and where
# to hoist it. This hoisted package can be referenced by the label `//examples/npm_deps:node_modules/ms` same as
# other direct dependencies in the `examples/npm_deps/package.json`.
"ms@2.1.3": ["examples/npm_deps"],
},
update_pnpm_lock = True,
verify_node_modules_ignored = "//:.bazelignore",
verify_patches = "//examples/npm_deps/patches:patches",
)
load("@npm//:repositories.bzl", "npm_repositories")
# Declares npm_import rules from the pnpm-lock.yaml file
npm_repositories()
# As an example, manually import a package using explicit coordinates.
# Just a demonstration of the syntax de-sugaring.
npm_import(
name = "acorn__8.4.0",
bins = {"acorn": "./bin/acorn"},
integrity = "sha512-ULr0LDaEqQrMFGyQ3bhJkLsbtrQ8QibAseGZeaSUiT/6zb9IvIkomWHJIvgvwad+hinRAgsI51JcWk2yvwyL+w==",
package = "acorn",
# Root package where to link the package store
root_package = "",
version = "8.4.0",
)
############################################
# Stardoc
load("@io_bazel_stardoc//:setup.bzl", "stardoc_repositories")
stardoc_repositories()
load("@rules_jvm_external//:repositories.bzl", "rules_jvm_external_deps")
rules_jvm_external_deps()
load("@rules_jvm_external//:setup.bzl", "rules_jvm_external_setup")
rules_jvm_external_setup()
load("@io_bazel_stardoc//:deps.bzl", "stardoc_external_deps")
stardoc_external_deps()
load("@bazel_features//:deps.bzl", "bazel_features_deps")
bazel_features_deps()
load("@stardoc_maven//:defs.bzl", stardoc_pinned_maven_install = "pinned_maven_install")
stardoc_pinned_maven_install()
# Buildifier
load("@buildifier_prebuilt//:deps.bzl", "buildifier_prebuilt_deps")
buildifier_prebuilt_deps()
load("@buildifier_prebuilt//:defs.bzl", "buildifier_prebuilt_register_toolchains")
buildifier_prebuilt_register_toolchains()
# rules_lint
load(
"@aspect_rules_lint//format:repositories.bzl",
"rules_lint_dependencies",
)
rules_lint_dependencies()
load("@rules_multitool//multitool:multitool.bzl", "multitool")
multitool(
name = "multitool",
lockfiles = [
"@aspect_rules_lint//format:multitool.lock.json",
"@aspect_rules_lint//lint:multitool.lock.json",
],
)
load("@com_grail_bazel_toolchain//toolchain:deps.bzl", "bazel_toolchain_dependencies")
bazel_toolchain_dependencies()
load("@com_grail_bazel_toolchain//toolchain:rules.bzl", "llvm_toolchain")
llvm_toolchain(
name = "llvm_toolchain",
llvm_version = "14.0.0",
sha256 = {
"darwin-aarch64": "1b8975db6b638b308c1ee437291f44cf8f67a2fb926eb2e6464efd180e843368",
"linux-x86_64": "564fcbd79c991e93fdf75f262fa7ac6553ec1dd04622f5d7db2a764c5dc7fac6",
},
strip_prefix = {
"darwin-aarch64": "clang+llvm-14.0.0-arm64-apple-darwin",
"linux-x86_64": "clang+llvm-14.0.0-x86_64-linux-gnu",
},
sysroot = {
"linux-aarch64": "@org_chromium_sysroot_linux_arm64//:sysroot",
"linux-x86_64": "@org_chromium_sysroot_linux_x86_64//:sysroot",
"darwin-aarch64": "@sysroot_darwin_universal//:sysroot",
"darwin-x86_64": "@sysroot_darwin_universal//:sysroot",
},
urls = {
"darwin-aarch64": ["https://github.com/aspect-forks/llvm-project/releases/download/aspect-release-14.0.0/clang+llvm-14.0.0-arm64-apple-darwin.tar.xz"],
"linux-x86_64": ["https://github.com/aspect-forks/llvm-project/releases/download/aspect-release-14.0.0/clang+llvm-14.0.0-x86_64-linux-gnu.tar.xz"],
},
)
load("@llvm_toolchain//:toolchains.bzl", "llvm_register_toolchains")
llvm_register_toolchains()