forked from MaterializeInc/materialize
-
Notifications
You must be signed in to change notification settings - Fork 0
/
WORKSPACE
720 lines (631 loc) · 29 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
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
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
# Copyright Materialize, Inc. and contributors. All rights reserved.
#
# Use of this software is governed by the Business Source License
# included in the LICENSE file.
#
# As of the Change Date specified in that file, in accordance with
# the Business Source License, use of this software will be governed
# by the Apache License, Version 2.0.
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe")
"""
Materialize's Bazel Workspace.
This `WORKSPACE` file defines all of the rule sets and remote repositories that
we depend on. It's important to note that ordering matters. If an object is
declared more than once it's the _first_ invocation that gets used. This can be
especially tricky when rule sets have their own dependencies, generally
included by calling a `*_dependencies()` macro.
"""
# `bazel-lib`/`bazel-skylib`
#
# Provides generic rules for Bazel to help make things fit together.
#
# For example, Rust build scripts might require files live in a certain
# location, but the dependent `c_library` can't specify an output location.
# `bazel-lib` provides rules to copy files into a new directory that we can
# then provide to the Rust rule.
#
# Note: In an ideal world the two rule sets would be combined into one.
BAZEL_SKYLIB_VERSION = "1.6.1"
BAZEL_SKYLIB_INTEGRITY = "sha256-nziIakBUjG6WwQa3UvJCEw7hGqoGila6flb0UR8z5PI="
maybe(
http_archive,
name = "bazel_skylib",
integrity = BAZEL_SKYLIB_INTEGRITY,
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/releases/download/{0}/bazel-skylib-{0}.tar.gz".format(BAZEL_SKYLIB_VERSION),
"https://github.com/bazelbuild/bazel-skylib/releases/download/{0}/bazel-skylib-{0}.tar.gz".format(BAZEL_SKYLIB_VERSION),
],
)
ASPECT_BAZEL_LIB_VERSION = "2.7.0"
ASPECT_BAZEL_LIB_INTEGRITY = "sha256-NX2tnSEjJ8NdkkQZDvAQqtMV5z/6G+0aKeIMNy+co0Y="
maybe(
http_archive,
name = "aspect_bazel_lib",
integrity = ASPECT_BAZEL_LIB_INTEGRITY,
strip_prefix = "bazel-lib-{0}".format(ASPECT_BAZEL_LIB_VERSION),
url = "https://github.com/aspect-build/bazel-lib/releases/download/v{0}/bazel-lib-v{0}.tar.gz".format(ASPECT_BAZEL_LIB_VERSION),
)
load("@aspect_bazel_lib//lib:repositories.bzl", "aspect_bazel_lib_dependencies", "aspect_bazel_lib_register_toolchains")
# Required bazel-lib dependencies
aspect_bazel_lib_dependencies()
# Register bazel-lib toolchains
aspect_bazel_lib_register_toolchains()
# `rules_cc`
#
# Rules for building C/C++ projects. These are slowly being upstreamed into the
# Bazel source tree, but some projects (e.g. protobuf) still depend on this
# rule set.
RULES_CC_VERSION = "0.0.9"
RULES_CC_INTEGRITY = "sha256-IDeHW5pEVtzkp50RKorohbvEqtlo5lh9ym5k86CQDN8="
maybe(
http_archive,
name = "rules_cc",
integrity = RULES_CC_INTEGRITY,
strip_prefix = "rules_cc-{0}".format(RULES_CC_VERSION),
urls = [
"https://github.com/bazelbuild/rules_cc/releases/download/{0}/rules_cc-{0}.tar.gz".format(RULES_CC_VERSION),
],
)
# `rules_pkg`
#
# Rules for building archives, e.g. `tar` or `zip`, for packages.
RULES_PKG_VERSION = "0.7.0"
RULES_PKG_INTEGRITY = "sha256-iimOgydi7aGDBZfWT+fbWBeKqEzVkm121bdE1lWJQcI="
maybe(
http_archive,
name = "rules_pkg",
integrity = RULES_PKG_INTEGRITY,
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/rules_pkg/releases/download/{0}/rules_pkg-{0}.tar.gz".format(RULES_PKG_VERSION),
"https://github.com/bazelbuild/rules_pkg/releases/download/{0}/rules_pkg-{0}.tar.gz".format(RULES_PKG_VERSION),
],
)
# `rules_foreign_cc`
#
# Rules for building C/C++ projects that use foreign build systems, e.g. Make. One case that we use
# this for is building `openssl`.
#
# TODO(parkmycar): We maintain a fork with the following fixes applied to the `mz-fixes` branch:
#
# 1. Versions of `make` >4.3 are buggy and have a segfault, we hit this segfault when building jemalloc.
# See: <https://github.com/bazelbuild/rules_foreign_cc/issues/898>
# See: <https://github.com/MaterializeInc/rules_foreign_cc/commit/8e28ba0bbbf7e73d70333b625bfec4a65114d8be>
#
# 2. Some libraries, e.g. jemalloc, preprocess and compile code in two separate steps, so we need
# to make sure the sysroot is provided in CPPFLAGS, if it's set in CFLAGS.
# See: <https://github.com/bazelbuild/rules_foreign_cc/pull/1023>
# See: <https://github.com/MaterializeInc/rules_foreign_cc/commit/2199b1c304140fa959c3703b0b7e9cbf7d39c4c2>
#
# 3. Specify the AR tool to use when bootstrapping `make`. On macOS explicitly set the path to
# be llvm-ar which we know exists in our toolchain.
# See: <https://github.com/MaterializeInc/rules_foreign_cc/commit/e94986f05edf95fff025b6aeb995e09be8889b89>
#
# 4. `make` 4.2 fails to compile on Linux because of unrecognized symbols so we patch the source.
# See: <https://github.com/MaterializeInc/rules_foreign_cc/commit/de4a79280f54d8796e86b7ab0b631939b7b44d05>
#
# 5. Mirror the GNU source code for `make` from the `MaterializeInc/toolchains` repository. We've
# previously seen the upstream GNU FTP server go down which causes CI to break.
# See: <https://github.com/MaterializeInc/rules_foreign_cc/commit/c994a0d6a86480d274dc1937d8861a56e6011cf0>
RULES_FOREIGN_CC_VERSION = "c994a0d6a86480d274dc1937d8861a56e6011cf0"
RULES_FOREIGN_CC_INTEGRITY = "sha256-kFSk41S84sVupSj7p+OxlHV5wXKoo67PvBy2vlXiQsg="
maybe(
http_archive,
name = "rules_foreign_cc",
integrity = RULES_FOREIGN_CC_INTEGRITY,
strip_prefix = "rules_foreign_cc-{0}".format(RULES_FOREIGN_CC_VERSION),
url = "https://github.com/MaterializeInc/rules_foreign_cc/archive/{0}.tar.gz".format(RULES_FOREIGN_CC_VERSION),
)
load("@rules_foreign_cc//foreign_cc:repositories.bzl", "rules_foreign_cc_dependencies")
rules_foreign_cc_dependencies(make_version = "4.2")
# `clang`/`llvm`
#
# Normally Bazel will use the system's version of clang as the default C
# toolchain. This prevents the builds from being hermetic though so we include
# our own.
#
# All of the clang related tools are provided under the `@llvm_toolchain_llvm`
# repo. To see what's available run `bazel query @llvm_toolchain_llvm//...`.
# Version of the "toolchains_llvm" rule set, _not_ the version of clang/llvm.
TOOLCHAINS_LLVM_VERSION = "1.0.0"
TOOLCHAINS_LLVM_INTEGRITY = "sha256-6RxDYfmQEaVIFOGvvlxDbg0ymHEUajzVjCOitK+1Bzc="
# System roots that we use, this is where clang will search for things like libc.
_SYSROOT_DARWIN_BUILD_FILE = """
filegroup(
name = "sysroot",
srcs = glob(
include = ["**"],
exclude = ["**/*:*"],
),
visibility = ["//visibility:public"],
)
"""
DARWIN_SYSROOT_VERSION = "14.5"
DARWIN_SYSROOT_INTEGRITY = "sha256-JCleYWOca1Z/B4Li1iwDKGEP/IkWWgKqXoygtJXyNTU="
http_archive(
name = "sysroot_darwin_universal",
build_file_content = _SYSROOT_DARWIN_BUILD_FILE,
integrity = DARWIN_SYSROOT_INTEGRITY,
strip_prefix = "MacOSX{0}.sdk-min".format(DARWIN_SYSROOT_VERSION),
urls = ["https://github.com/MaterializeInc/toolchains/releases/download/macos-sysroot-sdk-{0}-1/MacOSX{0}.sdk-min.tar.zst".format(DARWIN_SYSROOT_VERSION)],
)
_LINUX_SYSROOT_BUILD_FILE = """
filegroup(
name = "sysroot",
srcs = glob(["*/**"]),
visibility = ["//visibility:public"],
)
"""
# Format is <KERNEL_VERSION-GLIBC_VERSION-LIBSTDCXX_VERSION>
LINUX_SYSROOT_VERSION = "5_10-2_35-11_4_0"
LINUX_SYSROOT_X86_64_INTEGRITY = "sha256-H2q1ti0l6vETl6QBOIvwuizpAJrvKCMObTuw/0Gedy0="
http_archive(
name = "linux_sysroot-x86_64",
build_file_content = _LINUX_SYSROOT_BUILD_FILE,
integrity = LINUX_SYSROOT_X86_64_INTEGRITY,
strip_prefix = "sysroot",
urls = ["https://github.com/MaterializeInc/toolchains/releases/download/linux-sysroot-{0}/linux-sysroot-x86_64.tar.zst".format(LINUX_SYSROOT_VERSION)],
)
LINUX_SYSROOT_AARCH64_INTEGRITY = "sha256-kUasOepnmvdoJlI2JHm9T5o3alaS17xS4avwKDyaxMQ="
http_archive(
name = "linux_sysroot-aarch64",
build_file_content = _LINUX_SYSROOT_BUILD_FILE,
integrity = LINUX_SYSROOT_AARCH64_INTEGRITY,
strip_prefix = "sysroot",
urls = ["https://github.com/MaterializeInc/toolchains/releases/download/linux-sysroot-{0}/linux-sysroot-aarch64.tar.zst".format(LINUX_SYSROOT_VERSION)],
)
# Version of clang/llvm we use.
#
# We build our own clang toolchain, see the <https://github.com/MaterializeInc/toolchains> repository.
LLVM_VERSION = "18.1.8"
# We have a few variants of our clang toolchain, either improving how it's built or adding new tools.
LLVM_VERSION_SUFFIX = "4"
maybe(
http_archive,
name = "toolchains_llvm",
canonical_id = "{0}".format(TOOLCHAINS_LLVM_VERSION),
integrity = TOOLCHAINS_LLVM_INTEGRITY,
strip_prefix = "toolchains_llvm-{0}".format(TOOLCHAINS_LLVM_VERSION),
url = "https://github.com/bazel-contrib/toolchains_llvm/releases/download/{0}/toolchains_llvm-{0}.tar.gz".format(TOOLCHAINS_LLVM_VERSION),
)
load("@toolchains_llvm//toolchain:deps.bzl", "bazel_toolchain_dependencies")
bazel_toolchain_dependencies()
load("@toolchains_llvm//toolchain:rules.bzl", "llvm_toolchain")
llvm_toolchain(
name = "llvm_toolchain",
llvm_version = LLVM_VERSION,
sha256 = {
"darwin-aarch64": "41d8dea52d18c4e8b90c4fcd31965f9f297df9f40a38a33d60748dbe7f8330b8",
"darwin-x86_64": "291b8dd844aa896b98393c5d3beaee57f294768039eacdf9ef5e96ed9d3f62d7",
"linux-aarch64": "fe8f9e283ab43e963daf9ffb18742e134ad239b56078d61ef9a289ff642784ed",
"linux-x86_64": "8b725ec14e48bc1cb3698309506e29cd94ff3b823976ebb306e9c3ef84480c16",
},
sysroot = {
"darwin-aarch64": "@sysroot_darwin_universal//:sysroot",
"darwin-x86_64": "@sysroot_darwin_universal//:sysroot",
"linux-x86_64": "@linux_sysroot-x86_64//:sysroot",
"linux-aarch64": "@linux_sysroot-aarch64//:sysroot",
},
urls = {
"darwin-aarch64": ["https://github.com/MaterializeInc/toolchains/releases/download/clang-{0}-{1}/darwin_aarch64.tar.zst".format(LLVM_VERSION, LLVM_VERSION_SUFFIX)],
"darwin-x86_64": ["https://github.com/MaterializeInc/toolchains/releases/download/clang-{0}-{1}/darwin_x86_64.tar.zst".format(LLVM_VERSION, LLVM_VERSION_SUFFIX)],
"linux-aarch64": ["https://github.com/MaterializeInc/toolchains/releases/download/clang-{0}-{1}/linux_aarch64.tar.zst".format(LLVM_VERSION, LLVM_VERSION_SUFFIX)],
"linux-x86_64": ["https://github.com/MaterializeInc/toolchains/releases/download/clang-{0}-{1}/linux_x86_64.tar.zst".format(LLVM_VERSION, LLVM_VERSION_SUFFIX)],
},
)
load("@llvm_toolchain//:toolchains.bzl", "llvm_register_toolchains")
llvm_register_toolchains()
# `rules_perl`
#
# Provides a `perl` toolchain which is required to build some libraries (e.g. openssl).
RULES_PERL_VERISON = "0.1.0"
RULES_PERL_INTEGRITY = "sha256-XO+tvypJvzQh7eAJ8sWiyYNquueSYg7S/5kYQTN1UyU="
maybe(
http_archive,
name = "rules_perl",
integrity = RULES_PERL_INTEGRITY,
strip_prefix = "rules_perl-{0}".format(RULES_PERL_VERISON),
urls = [
"https://github.com/bazelbuild/rules_perl/archive/refs/tags/{0}.tar.gz".format(RULES_PERL_VERISON),
],
)
load("@rules_perl//perl:deps.bzl", "perl_register_toolchains", "perl_rules_dependencies")
perl_rules_dependencies()
perl_register_toolchains()
# Extra setup.
#
# Some libraries (e.g. protobuf) require bespoke rule sets. Because they're
# specific to a single library we move their definitions into separate files
# to avoid cluter.
load("//misc/bazel/c_deps:extra_setup.bzl", "protoc_setup")
protoc_setup()
# C Repositories
#
# Loads all of the C dependencies that we rely on.
load("//misc/bazel/c_deps:repositories.bzl", "c_repositories")
c_repositories()
# `rules_rust`
#
# Rules for building Rust crates, and several convienence macros for building all transitive
# dependencies.
RULES_RUST_VERSION = "0.53.0"
RULES_RUST_INTEGRITY = "sha256-heIBNyerJvsiq9/+SyrAwnotW2KWFnumPY9uExQPUfk="
maybe(
http_archive,
name = "rules_rust",
integrity = RULES_RUST_INTEGRITY,
urls = [
"https://github.com/bazelbuild/rules_rust/releases/download/{0}/rules_rust-v{0}.tar.gz".format(RULES_RUST_VERSION),
"https://mirror.bazel.build/bazelbuild/rules_rust/releases/download/{0}/rules_rust-v{0}.tar.gz".format(RULES_RUST_VERSION),
],
)
load("@rules_rust//rust:repositories.bzl", "rules_rust_dependencies")
rules_rust_dependencies()
# `rustc`
#
# Fetch and register the relevant Rust toolchains. We use a custom macro that
# depends on `rules_rust` but cuts down on bloat from their defaults.
RUST_VERSION = "1.80.1"
RUST_NIGHTLY_VERSION = "nightly/2024-08-01"
load("//misc/bazel/toolchains:rust.bzl", "rust_toolchains")
rust_toolchains(
[
RUST_VERSION,
RUST_NIGHTLY_VERSION,
],
{
"aarch64-apple-darwin": {
"stable": {
"rustc": "ada84b7c4521b10f54ab73d34916cb45fb68cc928b16c9e1be39f89406b84c86",
"clippy": "f1f6772c917008d170e4cdc7ae10e370cfbe11da6105bf5913a1b43ea126b0f1",
"cargo": "4649742a7bfc4a46036e47ea057d60bf8301c0299054c9785ee37947b2d1294c",
"llvm-tools": "725bb2381dd287fb070a05eb6092fc5b4000ba69eb2cb27790c0f40fd248a56a",
"rust-std": "ddd123723fe4576a155ce0190da5f16a2c067cbd5b1a2c23b301592568e5752d",
},
"nightly": {
"rustc": "16a8eefc8121633bc1d80342975cc5299a3da4c11d28e3a134ce376eafea4784",
"clippy": "341b35b68ab14d0de0b6cece0042ae91b640a66b6fbc71ff6a4e021c2a1cea18",
"cargo": "e633472e33eb97d2886d3149968b27956b91efa8da5cded10399c7a1f0ede481",
"llvm-tools": "2cf35c331fff0034301fb0cbef221c3203f23ab4c6780e20a70c92d76b1bf7f5",
"rust-std": "f0742c7371383c1ea2849440b8d5f631be2aa7211b3e150a41cca552dcd92ddd",
},
},
"aarch64-unknown-linux-gnu": {
"stable": {
"rustc": "4ca87875f8a23ef1f23d60a958a0dc798e2b8e97bf6782b2ec534026181fa72c",
"clippy": "fcda253a6704f612310696f25f161c880f16ec8be6b640ccf5fe26245c822efc",
"cargo": "6973b542f54ade0215becd34a06d011e4c35a8091a27ac667d0438ebc45a935e",
"llvm-tools": "2574807dcf8a1d68adc57c42c4caa812ac3d54f376b16b536c8073c60877c680",
"rust-std": "07238d367cfba20bf80150f725234b877b11bc3ab82d04ed0ccc95375e9cedd8",
},
"nightly": {
"rustc": "d21d28f3b81637070004f486c5267989381ad763e7d4c9084d2d226aa46cd308",
"clippy": "58a022177e2cb99f40ddd4e4dacd4b5580af9920829a873bbbd92d91cb934979",
"cargo": "4b56caba8ccd3101cbae3b2093b0858ae9045534c7378fc16150285d0f3c082f",
"llvm-tools": "52cf02c11e64b320d05ca1df8d1104a757080a3088e397bd1f752f5bd0b6b258",
"rust-std": "6ad1dc3b4aa3f78a7ead87ecc475299b35e884778ecc99a057a3178fa1c332b5",
},
},
"x86_64-unknown-linux-gnu": {
"stable": {
"rustc": "5c7fce7a0323b8669b4e17ec370b38a5f207fcdcd5c66b83c877b72e252d561e",
"clippy": "39253ce4ecb036977686f5a8cc183de295cf280766678201f919c5655e3dd063",
"cargo": "863c016fc458b1fa8809d7b66dcccd272f8b6b2e8a42c89b7dff4b619f3d3940",
"llvm-tools": "86e441024b0e538ed69fa0098be48592caae6fc28097f7630b906be276c79622",
"rust-std": "e7b766fce1cd89c02bde33f8cc3a81f341c52677258a546df2bee1c7090e9fc5",
},
"nightly": {
"rustc": "10bf2f8f95cf934bf1f3e0f7d507b615c6a329bedb78adaa1d3bdf75532d7d36",
"clippy": "692f4550bf4e2f3a783f97a3706ed0c557258b885a6c166830e4b4e40bc8ba06",
"cargo": "10cc2e832b8ac2386eb0fbd2f1eb3583ff6f9468332619f6bb1324b27fe6451f",
"llvm-tools": "45b11ccde9ec167c4d741ade55fdab958db01a938a6e2b437f93733aa2bfa036",
"rust-std": "8a8bf9b1d4f93ca2a162a28d0f478ac7bc73aab241befecdf9a1dbf27d86f68f",
},
},
"x86_64-apple-darwin": {
"stable": {
"rustc": "f0adfff86a9d5055f537dab26f6d0b7a81efe087f90b7e16c42698d58af0ffca",
"clippy": "5b6e393a7784839a1554188df2d87481696a0e0be242d1d2982e442b43199c08",
"cargo": "e3d03157061987be0c7cddf1e708f376929273779a65459a9b3a7ebc6ccadaae",
"llvm-tools": "3c443d068464c95a0a02072082bff6661cee5568dbbedbb82dcb6737147f3d6c",
"rust-std": "c9e366e76ee470d11afadbd70b200976ef4b34e626b568f19e429d4d23dead86",
},
"nightly": {
"rustc": "9ea43d51a690240f2c505ba62f1705de3c1329d7b3399ce462f4ecd242dbd87a",
"clippy": "058e05278fe37789a54ad603691e06b35c7ff345b1dbad82d13552c2409f0ff0",
"cargo": "fe5c735fec5c8d05de922ad4ec1296f2115cf3e2cc0617420104586d020efe6d",
"llvm-tools": "8a3f90b01ec1ae47dbe33fbb5329a8457da1252a07c2bbfac0d297cb4f031b88",
"rust-std": "a2d70b9f21a69639b61c87273495de579a32d197015e4a76dabf6cd417a6a12f",
},
},
},
)
# Load all dependencies for crate_universe.
load("@rules_rust//crate_universe:repositories.bzl", "crate_universe_dependencies")
crate_universe_dependencies()
load("@rules_rust//crate_universe:defs.bzl", "crate", "crates_repository")
crates_repository(
name = "crates_io",
annotations = {
# `crates_repository` fails to automatically add the depenency on `tracing` when
# `tokio_unstable` is enabled, so we manually specify it.
"tokio": [
crate.annotation(
rustc_flags = ["--cfg=tokio_unstable"],
deps = ["@crates_io//:tracing"],
),
],
"decnumber-sys": [crate.annotation(
additive_build_file = "@//misc/bazel/c_deps:rust-sys/BUILD.decnumber.bazel",
gen_build_script = False,
# Note: This is a target we add from the additive build file above.
deps = [":decnumber"],
)],
"librocksdb-sys": [crate.annotation(
additive_build_file = "@//misc/bazel/c_deps:rust-sys/BUILD.rocksdb.bazel",
# Note: The below targets are from the additive build file.
#
# HACK(parkmycar): The `librocksdb-sys` build script runs bindgen for us, and to
# support cross compiling we need to provide the sysroot to the build script so
# bindgen can find it. Providing the sysroot and relying on the raw paths is quite
# fragile, the fix is to use `@rules_rust//bindgen/...` rules with our Clang toolchain.
build_script_data = [
":rocksdb_lib",
":rocksdb_include",
":snappy_lib",
"@linux_sysroot-aarch64//:sysroot",
"@linux_sysroot-x86_64//:sysroot",
],
build_script_env = {
"ROCKSDB_STATIC": "true",
"ROCKSDB_LIB_DIR": "$(execpath :rocksdb_lib)",
"ROCKSDB_INCLUDE_DIR": "$(execpath :rocksdb_include)",
"SNAPPY_STATIC": "true",
"SNAPPY_LIB_DIR": "$(execpath :snappy_lib)",
"BINDGEN_EXTRA_CLANG_ARGS_aarch64-unknown-linux-gnu": "--sysroot=external/linux_sysroot-aarch64",
"BINDGEN_EXTRA_CLANG_ARGS_x86_64-unknown-linux-gnu": "--sysroot=external/linux_sysroot-x86_64",
},
compile_data = [
":rocksdb_lib",
":rocksdb_include",
":snappy_lib",
],
)],
"tikv-jemalloc-sys": [crate.annotation(
gen_build_script = False,
deps = ["@jemalloc"],
)],
"rdkafka-sys": [crate.annotation(
additive_build_file = "@//misc/bazel/c_deps:rust-sys/BUILD.librdkafka.bazel",
gen_build_script = False,
# Note: This is a target we add from the additive build file above.
deps = [":librdkafka"],
)],
"libz-sys": [crate.annotation(
gen_build_script = False,
deps = ["@zlib"],
)],
"openssl-sys": [crate.annotation(
build_script_data = [
"@openssl//:openssl_lib",
"@openssl//:openssl_include",
],
build_script_data_glob = ["build/**/*.c"],
build_script_env = {
"OPENSSL_STATIC": "true",
"OPENSSL_NO_VENDOR": "1",
"OPENSSL_LIB_DIR": "$(execpath @openssl//:openssl_lib)",
"OPENSSL_INCLUDE_DIR": "$(execpath @openssl//:openssl_include)",
},
compile_data = ["@openssl//:openssl_lib"],
)],
"protobuf-src": [crate.annotation(
# Note: We shouldn't ever depend on protobuf-src, but if we do, don't try to bootstrap
# `protoc`.
gen_build_script = False,
rustc_env = {"INSTALL_DIR": "fake"},
)],
"protobuf-native": [crate.annotation(
additive_build_file = "@//misc/bazel/c_deps:rust-sys/BUILD.protobuf-native.bazel",
gen_build_script = False,
deps = [":protobuf-native-bridge"],
)],
"psm": [crate.annotation(
additive_build_file = "@//misc/bazel/c_deps:rust-sys/BUILD.psm.bazel",
gen_build_script = False,
# Note: All of the targets we build for support switching stacks, if we ever want to
# support Windows we'll have to revist this.
rustc_flags = [
"--check-cfg=cfg(switchable_stack,asm,link_asm)",
"--cfg=asm",
"--cfg=link_asm",
"--cfg=switchable_stack",
],
# Note: This is a target we add from the additive build file above.
deps = ["psm_s"],
)],
"launchdarkly-server-sdk": [crate.annotation(
build_script_env = {
"CARGO_PKG_AUTHORS": "LaunchDarkly",
"CARGO_PKG_DESCRIPTION": "",
"CARGO_PKG_HOMEPAGE": "https://docs.launchdarkly.com/sdk/server-side/rust",
"CARGO_PKG_LICENSE": "Apache-2.0",
"CARGO_PKG_REPOSITORY": "https://github.com/launchdarkly/rust-server-sdk",
"RUSTDOC": "",
},
)],
# Compile the backtrace crate and its dependencies with all optimizations, even in dev
# builds, since otherwise backtraces can take 20s+ to symbolize. With optimizations
# enabled, symbolizing a backtrace takes less than 1s.
"addr2line": [crate.annotation(rustc_flags = ["-Copt-level=3"])],
"adler": [crate.annotation(rustc_flags = ["-Copt-level=3"])],
"backtrace": [crate.annotation(rustc_flags = ["-Copt-level=3"])],
"gimli": [crate.annotation(rustc_flags = ["-Copt-level=3"])],
"miniz_oxide": [crate.annotation(rustc_flags = ["-Copt-level=3"])],
"object": [crate.annotation(rustc_flags = ["-Copt-level=3"])],
"rustc-demangle": [crate.annotation(rustc_flags = ["-Copt-level=3"])],
},
cargo_config = "//:.cargo/config.toml",
cargo_lockfile = "//:Cargo.lock",
# When `isolated` is true, Bazel will create a new `$CARGO_HOME`, i.e. it
# won't use `~/.cargo`, when re-pinning. This is nice but not totally
# necessary, and it makes re-pinning painfully slow, so we disable it.
isolated = False,
manifests = [
"//:Cargo.toml",
"//:src/adapter-types/Cargo.toml",
"//:src/adapter/Cargo.toml",
"//:src/alloc-default/Cargo.toml",
"//:src/alloc/Cargo.toml",
"//:src/arrow-util/Cargo.toml",
"//:src/audit-log/Cargo.toml",
"//:src/avro/Cargo.toml",
"//:src/aws-secrets-controller/Cargo.toml",
"//:src/aws-util/Cargo.toml",
"//:src/balancerd/Cargo.toml",
"//:src/build-info/Cargo.toml",
"//:src/build-tools/Cargo.toml",
"//:src/catalog-debug/Cargo.toml",
"//:src/catalog/Cargo.toml",
"//:src/ccsr/Cargo.toml",
"//:src/cloud-api/Cargo.toml",
"//:src/cloud-resources/Cargo.toml",
"//:src/cluster-client/Cargo.toml",
"//:src/cluster/Cargo.toml",
"//:src/clusterd/Cargo.toml",
"//:src/compute-client/Cargo.toml",
"//:src/compute-types/Cargo.toml",
"//:src/compute/Cargo.toml",
"//:src/controller-types/Cargo.toml",
"//:src/controller/Cargo.toml",
"//:src/durable-cache/Cargo.toml",
"//:src/dyncfg/Cargo.toml",
"//:src/dyncfg-launchdarkly/Cargo.toml",
"//:src/dyncfgs/Cargo.toml",
"//:src/environmentd/Cargo.toml",
"//:src/expr-parser/Cargo.toml",
"//:src/expr-test-util/Cargo.toml",
"//:src/expr/Cargo.toml",
"//:src/fivetran-destination/Cargo.toml",
"//:src/frontegg-auth/Cargo.toml",
"//:src/frontegg-client/Cargo.toml",
"//:src/frontegg-mock/Cargo.toml",
"//:src/http-util/Cargo.toml",
"//:src/interchange/Cargo.toml",
"//:src/kafka-util/Cargo.toml",
"//:src/lowertest-derive/Cargo.toml",
"//:src/lowertest/Cargo.toml",
"//:src/lsp-server/Cargo.toml",
"//:src/materialized/Cargo.toml",
"//:src/metabase/Cargo.toml",
"//:src/metrics/Cargo.toml",
"//:src/mysql-util/Cargo.toml",
"//:src/mz/Cargo.toml",
"//:src/npm/Cargo.toml",
"//:src/orchestrator-kubernetes/Cargo.toml",
"//:src/orchestrator-process/Cargo.toml",
"//:src/orchestrator-tracing/Cargo.toml",
"//:src/orchestratord/Cargo.toml",
"//:src/orchestrator/Cargo.toml",
"//:src/ore-proc/Cargo.toml",
"//:src/ore/Cargo.toml",
"//:src/persist-cli/Cargo.toml",
"//:src/persist-client/Cargo.toml",
"//:src/persist-proc/Cargo.toml",
"//:src/persist-types/Cargo.toml",
"//:src/persist/Cargo.toml",
"//:src/pgcopy/Cargo.toml",
"//:src/pgrepr-consts/Cargo.toml",
"//:src/pgrepr/Cargo.toml",
"//:src/pgtest/Cargo.toml",
"//:src/pgtz/Cargo.toml",
"//:src/pgwire-common/Cargo.toml",
"//:src/pgwire/Cargo.toml",
"//:src/postgres-client/Cargo.toml",
"//:src/postgres-util/Cargo.toml",
"//:src/prof-http/Cargo.toml",
"//:src/prof/Cargo.toml",
"//:src/proto/Cargo.toml",
"//:src/regexp/Cargo.toml",
"//:src/repr-test-util/Cargo.toml",
"//:src/repr/Cargo.toml",
"//:src/rocksdb-types/Cargo.toml",
"//:src/rocksdb/Cargo.toml",
"//:src/s3-datagen/Cargo.toml",
"//:src/secrets/Cargo.toml",
"//:src/segment/Cargo.toml",
"//:src/server-core/Cargo.toml",
"//:src/service/Cargo.toml",
"//:src/sql-lexer/Cargo.toml",
"//:src/sql-parser/Cargo.toml",
"//:src/sql-pretty/Cargo.toml",
"//:src/sql/Cargo.toml",
"//:src/sqllogictest/Cargo.toml",
"//:src/ssh-util/Cargo.toml",
"//:src/storage-client/Cargo.toml",
"//:src/storage-controller/Cargo.toml",
"//:src/storage-operators/Cargo.toml",
"//:src/storage-types/Cargo.toml",
"//:src/storage/Cargo.toml",
"//:src/testdrive/Cargo.toml",
"//:src/timely-util/Cargo.toml",
"//:src/timestamp-oracle/Cargo.toml",
"//:src/tls-util/Cargo.toml",
"//:src/tracing/Cargo.toml",
"//:src/transform/Cargo.toml",
"//:src/txn-wal/Cargo.toml",
"//:src/walkabout/Cargo.toml",
"//:src/workspace-hack/Cargo.toml",
"//:test/metabase/smoketest/Cargo.toml",
"//:test/test-util/Cargo.toml",
"//:misc/bazel/cargo-gazelle/Cargo.toml",
],
rust_version = RUST_VERSION,
# Restricting the set of platform triples we support _greatly_ reduces the
# time it takes to "Splice Cargo Workspace" because it reduces the amount
# of metadata that needs to be collected.
#
# Feel free to add more targets if need be but try to keep this list small.
supported_platform_triples = [
"aarch64-unknown-linux-gnu",
"x86_64-unknown-linux-gnu",
"aarch64-apple-darwin",
"x86_64-apple-darwin",
"wasm32-unknown-unknown",
],
# Only used if developing rules_rust.
# generator = "@cargo_bazel_bootstrap//:cargo-bazel",
)
load("@crates_io//:defs.bzl", "crate_repositories")
crate_repositories()
crate_universe_dependencies()
# Third-Party Rust Tools
#
# A few crates bind to an external C/C++ library using `cxx`. To build these
# with Bazel we need to include the `cxx` command line binary.
load("//misc/bazel/rust_deps:repositories.bzl", "rust_repositories")
rust_repositories()
# Load and include any dependencies the third-party Rust binaries require.
#
# Ideally we would call `load(...)` from `rust_repositories()`, but load
# statements can only be called from the top-level WORKSPACE, so we must do it
# here.
#
# TODO(parkmycar): This should get better when we switch to bzlmod.
load("@cxxbridge//:defs.bzl", cxxbridge_cmd_deps = "crate_repositories")
cxxbridge_cmd_deps()
# git Submodules
#
# We include any git Submodules as local Bazel repositories so we can access
# their contents or build them.
new_local_repository(
name = "fivetran_sdk",
build_file = "//misc/bazel:git_submodules/BUILD.fivetran_sdk.bazel",
path = "misc/fivetran-sdk",
)
# tools
#
# Extra non-critical tools (e.g. linters or formatters) that are used as part of the development
# cycle.
load("//misc/bazel/tools:repositories.bzl", "tools_repositories")
tools_repositories()