-
Notifications
You must be signed in to change notification settings - Fork 88
Expand file tree
/
Copy pathMODULE.bazel
More file actions
462 lines (429 loc) · 10.6 KB
/
MODULE.bazel
File metadata and controls
462 lines (429 loc) · 10.6 KB
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
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
module(
name = "rules_haskell_tests",
version = "1.0",
)
bazel_dep(
name = "rules_nixpkgs_core",
version = "0.13.0",
)
bazel_dep(
name = "rules_haskell_nix",
version = "1.0",
)
bazel_dep(
name = "rules_haskell",
version = "1.0",
)
bazel_dep(
name = "rules_license",
version = "1.0.0",
)
bazel_dep(
name = "rules_nixpkgs_cc",
version = "0.13.0",
)
bazel_dep(
name = "rules_nixpkgs_python",
version = "0.13.0",
)
bazel_dep(
name = "rules_python",
version = "0.21.0",
)
bazel_dep(
name = "rules_nixpkgs_go",
version = "0.13.0",
)
bazel_dep(
name = "rules_nixpkgs_posix",
version = "0.13.0",
)
bazel_dep(
name = "rules_nixpkgs_nodejs",
version = "0.13.0",
)
bazel_dep(
name = "platforms",
version = "1.0.0",
)
bazel_dep(
name = "rules_cc",
version = "0.0.9",
)
bazel_dep(
name = "rules_sh",
version = "0.5.0",
)
bazel_dep(
name = "bazel_skylib",
version = "1.8.2",
)
bazel_dep(
name = "rules_java",
version = "6.5.2",
)
bazel_dep(
name = "rules_nodejs",
version = "5.8.5",
)
bazel_dep(
name = "aspect_rules_js",
version = "1.42.3",
)
bazel_dep(
name = "aspect_bazel_lib",
version = "2.20.0",
)
bazel_dep(
name = "rules_proto",
version = "6.0.2",
)
bazel_dep(
name = "protobuf",
version = "21.7",
repo_name = "com_google_protobuf",
)
bazel_dep(
name = "zlib",
version = "1.3.1.bcr.8",
)
bazel_dep(
name = "rules_bazel_integration_test",
version = "0.27.0",
dev_dependency = True,
)
bazel_dep(name = "cgrindel_bazel_starlib", version = "0.21.0")
bazel_dep(name = "rules_shell", version = "0.6.1")
ghc_version = use_extension("@rules_haskell//extensions:ghc_version.bzl", "ghc_default_version")
use_repo(
ghc_version,
"rules_haskell_ghc_version",
)
non_module_deps = use_extension("//:non_module_deps.bzl", "non_module_deps")
use_repo(
non_module_deps,
"c2hs_repo",
"com_github_bazelbuild_buildtools",
"haskell_package_repository_dummy",
"library_repo",
"os_info",
"zlib.hs",
)
non_modules_deps_1 = use_extension("//:non_module_deps_1.bzl", "non_module_deps_1")
use_repo(
non_modules_deps_1,
"asterius_bundle_linux_amd64",
"bazel_6",
"bazel_7",
"build_bazel_bazel_6_3_2",
"build_bazel_bazel_6_5_0",
"build_bazel_bazel_7_1_0",
"glibc_locales",
"linux_amd64_asterius-toolchain",
"nixpkgs_config_cc",
"nixpkgs_config_cc_info",
"nixpkgs_config_cc_toolchains",
"nixpkgs_default",
"nixpkgs_go_sdk",
"nixpkgs_go_sdk_toolchains",
"nixpkgs_lz4",
"nixpkgs_python_toolchain",
"toolchains_libraries",
"zlib.dev",
)
register_toolchains(
"@nixpkgs_config_cc_toolchains//:all",
"@nixpkgs_go_sdk_toolchains//:all",
"@linux_amd64_asterius-toolchain//:toolchain",
"@linux_amd64_asterius-toolchain//:asterius_toolchain",
"@linux_amd64_asterius-toolchain//:wasm_cc_toolchain",
"@nixpkgs_python_toolchain//:toolchain",
)
non_module_deps_2 = use_extension("//:non_module_deps_2.bzl", "non_module_deps_2")
use_repo(
non_module_deps_2,
"Cabal",
"alex",
"ghcide",
"ghcide-exe",
"rules_haskell_stack",
"rules_haskell_stack_update",
"stackage-pinning-test",
"stackage-pinning-test-unpinned",
"stackage-zlib",
"stackage-zlib-unpinned",
"stackage_asterius",
"stackage_asterius-unpinned",
)
non_modules_deps_bzlmod = use_extension(
"//:non_module_deps_bzlmod.bzl",
"non_module_deps_bzlmod",
)
[
(
use_repo(
non_modules_deps_bzlmod,
"nixpkgs_nodejs_{}_{}_toolchain".format(os, arch),
),
register_toolchains("@nixpkgs_nodejs_{}_{}_toolchain//:all".format(os, arch)),
)
for os in [
"linux",
"darwin",
]
for arch in [
"amd64",
"arm64",
]
]
register_toolchains(
"//tests:c2hs-toolchain",
"//tests:doctest-toolchain",
"//tests:protobuf-toolchain",
"//tests:protobuf-toolchain-osx_arm64",
)
# To test accessing runfiles with a library in another module
bazel_dep(
name = "other_module",
version = "0.0.1",
)
local_path_override(
module_name = "other_module",
path = "tests/bzlmod_runfiles/other_module",
)
# Go setup for buildifieR
bazel_dep(
name = "rules_go",
version = "0.54.1",
repo_name = "io_bazel_rules_go",
)
go_sdk = use_extension("@io_bazel_rules_go//go:extensions.bzl", "go_sdk")
go_sdk.download(
version = "1.19.7",
)
bazel_dep(
name = "gazelle",
version = "0.44.0",
)
go_deps = use_extension("@gazelle//:extensions.bzl", "go_deps")
go_deps.module(
path = "github.com/gogo/protobuf",
sum = "h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q=",
version = "v1.3.2",
)
use_repo(
go_deps,
"com_github_gogo_protobuf",
)
# Java dependencies for the //tests/java_classpath test
bazel_dep(
name = "rules_jvm_external",
version = "5.3",
)
maven = use_extension("@rules_jvm_external//:extensions.bzl", "maven")
maven.install(
name = "rules_haskell_tests_maven",
artifacts = ["org.apache.spark:spark-core_2.10:1.6.0"],
)
use_repo(maven, "rules_haskell_tests_maven")
# Bring some dependencies declared by rules_haskell module extensions into scope
asterius = use_extension("@rules_haskell//haskell/asterius:extension.bzl", "rules_haskell_asterius")
use_repo(
asterius,
"rules_haskell_asterius_build_setting",
"rules_haskell_asterius_webpack",
)
haskell_toolchains = use_extension(
"@rules_haskell//extensions:haskell_toolchains.bzl",
"haskell_toolchains",
)
test_ghc_version = "9.4.8"
test_ghcopts = [
"-XStandaloneDeriving", # Flag used at compile time
"-threaded", # Flag used at link time
# Used by `tests/repl-flags`
"-DTESTS_TOOLCHAIN_COMPILER_FLAGS",
# this is the default, so it does not harm other tests
"-XNoOverloadedStrings",
]
test_haddock_flags = ["-U"]
test_repl_ghci_args = [
# The repl test will need this flag, but set by the local
# `repl_ghci_args`.
"-UTESTS_TOOLCHAIN_REPL_FLAGS",
# The repl test will need OverloadedString
"-XOverloadedStrings",
]
test_cabalopts = [
# Used by `tests/cabal-toolchain-flags`
"--ghc-option=-DTESTS_TOOLCHAIN_CABALOPTS",
"--haddock-option=--optghc=-DTESTS_TOOLCHAIN_CABALOPTS",
]
cabalopts_windows = test_cabalopts + [
# To avoid ghcide linking errors with heapsize on Windows of the form
#
# unknown symbol `heap_view_closurePtrs'
#
# See https://github.com/haskell/ghcide/pull/954
"--disable-library-for-ghci",
]
haskell_toolchains.bindists(
cabalopts = test_cabalopts,
dist = {
"linux_amd64": "deb10",
},
ghcopts = test_ghcopts,
haddock_flags = test_haddock_flags,
repl_ghci_args = test_repl_ghci_args,
)
# We cannot configure cabalopts depending on the platform before calling haskell_toolchains.bindists:
# https://github.com/bazelbuild/bazel/issues/17880
# So we add toolchains for windows separately, they take precedence over the one generated by
# haskell_toolchains.bindists and use the `cabalopts_windows` variable.
[
haskell_toolchains.bindist(
cabalopts = cabalopts_windows,
ghcopts = test_ghcopts,
haddock_flags = test_haddock_flags,
repl_ghci_args = test_repl_ghci_args,
target = target,
version = test_ghc_version,
)
for target in [
"windows_amd64",
"windows_arm64",
]
]
nix_haskell_toolchains = use_extension(
"@rules_haskell_nix//extensions:nix_haskell_toolchains.bzl",
"nix_haskell_toolchains",
)
nix_haskell_toolchains.new(
attribute_path = "",
cabalopts = test_cabalopts,
ghcopts = test_ghcopts,
haddock_flags = test_haddock_flags,
nix_file_content = "with import <nixpkgs> {{}}; haskell.packages.ghc{}.ghc".format(test_ghc_version.replace(".", "")),
repl_ghci_args = test_repl_ghci_args,
repository = "@nixpkgs_default",
version = test_ghc_version,
)
stack_snapshot = use_extension(
"@rules_haskell//extensions:stack_snapshot.bzl",
"stack_snapshot",
)
use_repo(
stack_snapshot,
"stackage",
"stackage-exe",
"stackage-unpinned",
)
stack_snapshot.snapshot(local_snapshot = "//:stackage_snapshot.yaml")
stack_snapshot.package(
name = "ghc-paths",
vendored = "@rules_haskell//tools/ghc-paths",
)
stack_snapshot.package(
name = "proto-lens-protoc",
components = [
"lib",
"exe",
],
setup_deps = ["@Cabal//:Cabal"],
)
[
stack_snapshot.package(
name = package,
)
for package in [
"array",
"base",
"bytestring",
"cabal-doctest",
"conduit",
"conduit-extra",
"containers",
"data-default-class",
"deepseq",
"directory",
"filepath",
"ghc-check",
"ghc-heap",
"language-c",
"lens-family",
"lens-family-core",
"mtl",
"network",
"optparse-applicative",
"process",
"profunctors",
"proto-lens",
"safe-exceptions",
"streaming",
"temporary",
"text",
"text-show",
"vector",
"void",
]
]
stack_snapshot.package(
name = "polysemy",
setup_deps = ["@stackage//:cabal-doctest"],
)
[
stack_snapshot.package(
name = package,
# See https://github.com/tweag/rules_haskell/issues/1871
setup_deps = ["@Cabal//:Cabal"],
)
for package in [
"bifunctors",
"call-stack",
"c2hs",
"doctest",
"HUnit",
"happy",
"hspec",
"hspec-core",
"hspec-discover",
"hspec-expectations",
"proto-lens-runtime",
"quickcheck-io",
"transformers-compat",
"type-errors",
]
]
stack_snapshot.package(
name = "attoparsec",
components =
[
# attoparsec contains an internal library which is not exposed publicly,
# but required to build the public library, hence the declaration of
# those 2 components, as well as the explicit declaration of the
# dependency between them.
"lib",
"lib:attoparsec-internal",
],
components_dependencies = {
"lib:attoparsec": ["lib:attoparsec-internal"],
},
)
# This is not required, as `stack_snapshot` would build alex
# automatically, however it is used as a test for user provided
# `tools`. We also override alex's components to avoid building it
# twice.
stack_snapshot.tools(
labels = ["@alex"],
)
stack_snapshot.package(
name = "alex",
components = [],
)
stack_snapshot.stack_snapshot_json(
label = "//:stackage_snapshot.json",
os = [
"linux",
"mac",
],
)