xref: /aosp_15_r20/external/bazelbuild-rules_rust/examples/crate_universe/WORKSPACE.bazel (revision d4726bddaa87cc4778e7472feed243fa4b6c267f)
1workspace(name = "examples")
2
3local_repository(
4    name = "rules_rust",
5    path = "../../",
6)
7
8load("@rules_rust//rust:repositories.bzl", "rules_rust_dependencies", "rust_register_toolchains")
9
10rules_rust_dependencies()
11
12rust_register_toolchains(
13    edition = "2018",
14)
15
16load("@rules_rust//crate_universe:repositories.bzl", "crate_universe_dependencies")
17
18crate_universe_dependencies(bootstrap = True)
19
20load("@rules_rust//crate_universe:defs.bzl", "crate", "crates_repository", "render_config", "splicing_config")
21
22###############################################################################
23# A L I A S   R U L E
24###############################################################################
25
26crates_repository(
27    name = "alias_rule_global_alias_annotation_none",
28    annotations = {
29        "test_data_passing_crate": [crate.annotation(
30            alias_rule = None,
31        )],
32    },
33    cargo_lockfile = "//alias_rule:Cargo.Bazel.lock",
34    # `generator` is not necessary in official releases.
35    # See load satement for `cargo_bazel_bootstrap`.
36    generator = "@cargo_bazel_bootstrap//:cargo-bazel",
37    lockfile = "//alias_rule:cargo-bazel-lock_global_alias_annotation_none.json",
38    packages = {
39        "test_data_passing_crate": crate.spec(
40            version = "0.1.0",
41        ),
42    },
43    render_config = render_config(
44        default_alias_rule = "alias",
45    ),
46)
47
48load(
49    "@alias_rule_global_alias_annotation_none//:defs.bzl",
50    alias_rule_global_alias_annotation_none_crate_repositories = "crate_repositories",
51)
52
53alias_rule_global_alias_annotation_none_crate_repositories()
54
55crates_repository(
56    name = "alias_rule_global_alias_annotation_opt",
57    annotations = {
58        "test_data_passing_crate": [crate.annotation(
59            alias_rule = "opt",
60        )],
61    },
62    cargo_lockfile = "//alias_rule:Cargo.Bazel.lock",
63    # `generator` is not necessary in official releases.
64    # See load satement for `cargo_bazel_bootstrap`.
65    generator = "@cargo_bazel_bootstrap//:cargo-bazel",
66    lockfile = "//alias_rule:cargo-bazel-lock_global_alias_annotation_opt.json",
67    packages = {
68        "test_data_passing_crate": crate.spec(
69            version = "0.1.0",
70        ),
71    },
72    render_config = render_config(
73        default_alias_rule = "alias",
74    ),
75)
76
77load(
78    "@alias_rule_global_alias_annotation_opt//:defs.bzl",
79    alias_rule_global_alias_annotation_opt_crate_repositories = "crate_repositories",
80)
81
82alias_rule_global_alias_annotation_opt_crate_repositories()
83
84crates_repository(
85    name = "alias_rule_global_opt_annotation_none",
86    annotations = {
87        "test_data_passing_crate": [crate.annotation(
88            alias_rule = None,
89        )],
90    },
91    cargo_lockfile = "//alias_rule:Cargo.Bazel.lock",
92    # `generator` is not necessary in official releases.
93    # See load satement for `cargo_bazel_bootstrap`.
94    generator = "@cargo_bazel_bootstrap//:cargo-bazel",
95    lockfile = "//alias_rule:cargo-bazel-lock_global_opt_annotation_none.json",
96    packages = {
97        "test_data_passing_crate": crate.spec(
98            version = "0.1.0",
99        ),
100    },
101    render_config = render_config(
102        default_alias_rule = "opt",
103    ),
104)
105
106load(
107    "@alias_rule_global_opt_annotation_none//:defs.bzl",
108    alias_rule_global_opt_annotation_none_crate_repositories = "crate_repositories",
109)
110
111alias_rule_global_opt_annotation_none_crate_repositories()
112
113crates_repository(
114    name = "alias_rule_global_opt_annotation_alias",
115    annotations = {
116        "test_data_passing_crate": [crate.annotation(
117            alias_rule = "alias",
118        )],
119    },
120    cargo_lockfile = "//alias_rule:Cargo.Bazel.lock",
121    # `generator` is not necessary in official releases.
122    # See load satement for `cargo_bazel_bootstrap`.
123    generator = "@cargo_bazel_bootstrap//:cargo-bazel",
124    lockfile = "//alias_rule:cargo-bazel-lock_global_opt_annotation_alias.json",
125    packages = {
126        "test_data_passing_crate": crate.spec(
127            version = "0.1.0",
128        ),
129    },
130    render_config = render_config(
131        default_alias_rule = "opt",
132    ),
133)
134
135load(
136    "@alias_rule_global_opt_annotation_alias//:defs.bzl",
137    alias_rule_global_opt_annotation_alias_crate_repositories = "crate_repositories",
138)
139
140alias_rule_global_opt_annotation_alias_crate_repositories()
141
142crates_repository(
143    name = "alias_rule_global_opt_annotation_dbg",
144    annotations = {
145        "test_data_passing_crate": [crate.annotation(
146            alias_rule = "dbg",
147        )],
148    },
149    cargo_lockfile = "//alias_rule:Cargo.Bazel.lock",
150    # `generator` is not necessary in official releases.
151    # See load satement for `cargo_bazel_bootstrap`.
152    generator = "@cargo_bazel_bootstrap//:cargo-bazel",
153    lockfile = "//alias_rule:cargo-bazel-lock_global_opt_annotation_dbg.json",
154    packages = {
155        "test_data_passing_crate": crate.spec(
156            version = "0.1.0",
157        ),
158    },
159    render_config = render_config(
160        default_alias_rule = "opt",
161    ),
162)
163
164load(
165    "@alias_rule_global_opt_annotation_dbg//:defs.bzl",
166    alias_rule_global_opt_annotation_dbg_crate_repositories = "crate_repositories",
167)
168
169alias_rule_global_opt_annotation_dbg_crate_repositories()
170
171crates_repository(
172    name = "alias_rule_global_dbg_annotation_fastbuild",
173    annotations = {
174        "test_data_passing_crate": [crate.annotation(
175            alias_rule = "fastbuild",
176        )],
177    },
178    cargo_lockfile = "//alias_rule:Cargo.Bazel.lock",
179    # `generator` is not necessary in official releases.
180    # See load satement for `cargo_bazel_bootstrap`.
181    generator = "@cargo_bazel_bootstrap//:cargo-bazel",
182    lockfile = "//alias_rule:cargo-bazel-lock_global_dbg_annotation_fastbuild.json",
183    packages = {
184        "test_data_passing_crate": crate.spec(
185            version = "0.1.0",
186        ),
187    },
188    render_config = render_config(
189        default_alias_rule = "dbg",
190    ),
191)
192
193load(
194    "@alias_rule_global_dbg_annotation_fastbuild//:defs.bzl",
195    alias_rule_global_dbg_annotation_fastbuild_crate_repositories = "crate_repositories",
196)
197
198alias_rule_global_dbg_annotation_fastbuild_crate_repositories()
199
200crates_repository(
201    name = "alias_rule_global_custom_annotation_none",
202    annotations = {
203        "test_data_passing_crate": [crate.annotation(
204            alias_rule = None,
205        )],
206    },
207    cargo_lockfile = "//alias_rule:Cargo.Bazel.lock",
208    # `generator` is not necessary in official releases.
209    # See load satement for `cargo_bazel_bootstrap`.
210    generator = "@cargo_bazel_bootstrap//:cargo-bazel",
211    lockfile = "//alias_rule:cargo-bazel-lock_global_custom_annotation_none.json",
212    packages = {
213        "test_data_passing_crate": crate.spec(
214            version = "0.1.0",
215        ),
216    },
217    render_config = render_config(
218        default_alias_rule = "@//alias_rule:alias_rules.bzl:alias_rule",
219    ),
220)
221
222load(
223    "@alias_rule_global_custom_annotation_none//:defs.bzl",
224    alias_rule_global_custom_annotation_none_crate_repositories = "crate_repositories",
225)
226
227alias_rule_global_custom_annotation_none_crate_repositories()
228
229###############################################################################
230# C A R G O   A L I A S E S
231###############################################################################
232
233crates_repository(
234    name = "cargo_aliases",
235    annotations = {
236        "names": [crate.annotation(
237            shallow_since = "1646516410 -0700",
238            version = "0.12.1-dev",
239        )],
240    },
241    cargo_lockfile = "//cargo_aliases:Cargo.Bazel.lock",
242    # `generator` is not necessary in official releases.
243    # See load satement for `cargo_bazel_bootstrap`.
244    generator = "@cargo_bazel_bootstrap//:cargo-bazel",
245    lockfile = "//cargo_aliases:cargo-bazel-lock.json",
246    manifests = ["//cargo_aliases:Cargo.toml"],
247)
248
249load(
250    "@cargo_aliases//:defs.bzl",
251    cargo_aliases_crate_repositories = "crate_repositories",
252)
253
254cargo_aliases_crate_repositories()
255
256###############################################################################
257# C A R G O   B I N D E P S
258###############################################################################
259
260crates_repository(
261    name = "crate_index_cargo_bindeps",
262    cargo_lockfile = "//cargo_bindeps:Cargo.lock",
263    generate_binaries = True,
264    # `generator` is not necessary in official releases.
265    # See load satement for `cargo_bazel_bootstrap`.
266    generator = "@cargo_bazel_bootstrap//:cargo-bazel",
267    manifests = ["//cargo_bindeps:Cargo.toml"],
268    rust_version = "nightly",
269)
270
271load(
272    "@crate_index_cargo_bindeps//:defs.bzl",
273    cargo_bindeps_crate_repositories = "crate_repositories",
274)
275
276cargo_bindeps_crate_repositories()
277
278###############################################################################
279# C A R G O   L O C A L
280###############################################################################
281
282crates_repository(
283    name = "crate_index_cargo_local",
284    cargo_lockfile = "//cargo_local:Cargo.lock",
285    # `generator` is not necessary in official releases.
286    # See load satement for `cargo_bazel_bootstrap`.
287    generator = "@cargo_bazel_bootstrap//:cargo-bazel",
288    manifests = ["//cargo_local:Cargo.toml"],
289)
290
291load(
292    "@crate_index_cargo_local//:defs.bzl",
293    cargo_local_crate_repositories = "crate_repositories",
294)
295
296cargo_local_crate_repositories()
297
298###############################################################################
299# C A R G O   R E M O T E
300###############################################################################
301
302load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
303
304http_archive(
305    name = "names",
306    build_file = "//cargo_remote:BUILD.names.bazel",
307    sha256 = "eab40caca5805624ba31d028913931c3d054b22daafff6f43e3435cfa9fb761e",
308    strip_prefix = "names-0.13.0",
309    urls = ["https://github.com/fnichol/names/archive/refs/tags/v0.13.0.zip"],
310)
311
312crates_repository(
313    name = "crate_index_cargo_remote",
314    cargo_lockfile = "@names//:Cargo.lock",
315    # `generator` is not necessary in official releases.
316    # See load satement for `cargo_bazel_bootstrap`.
317    generator = "@cargo_bazel_bootstrap//:cargo-bazel",
318    manifests = ["@names//:Cargo.toml"],
319)
320
321load(
322    "@crate_index_cargo_remote//:defs.bzl",
323    cargo_remote_crate_repositories = "crate_repositories",
324)
325
326cargo_remote_crate_repositories()
327
328###############################################################################
329# C A R G O   W O R K S P A C E
330###############################################################################
331
332crates_repository(
333    name = "crate_index_cargo_workspace",
334    cargo_config = "//cargo_workspace:.cargo/config.toml",
335    cargo_lockfile = "//cargo_workspace:Cargo.Bazel.lock",
336    # `generator` is not necessary in official releases.
337    # See load satement for `cargo_bazel_bootstrap`.
338    generator = "@cargo_bazel_bootstrap//:cargo-bazel",
339    lockfile = "//cargo_workspace:cargo-bazel-lock.json",
340    manifests = [
341        "//cargo_workspace:Cargo.toml",
342        "//cargo_workspace/num_printer:Cargo.toml",
343        "//cargo_workspace/printer:Cargo.toml",
344        "//cargo_workspace/rng:Cargo.toml",
345    ],
346)
347
348load(
349    "@crate_index_cargo_workspace//:defs.bzl",
350    cargo_workspace_crate_repositories = "crate_repositories",
351)
352
353cargo_workspace_crate_repositories()
354
355###############################################################################
356# C A R G O   C O N D I T I O N A L   D E P S
357###############################################################################
358
359crates_repository(
360    name = "crate_index_cargo_conditional_deps",
361    cargo_lockfile = "//cargo_conditional_deps:Cargo.Bazel.lock",
362    # `generator` is not necessary in official releases.
363    # See load satement for `cargo_bazel_bootstrap`.
364    generator = "@cargo_bazel_bootstrap//:cargo-bazel",
365    lockfile = "//cargo_conditional_deps:cargo-bazel-lock.json",
366    manifests = [
367        "//cargo_conditional_deps:Cargo.toml",
368    ],
369)
370
371load(
372    "@crate_index_cargo_conditional_deps//:defs.bzl",
373    cargo_conditional_deps_crate_repositories = "crate_repositories",
374)
375
376cargo_conditional_deps_crate_repositories()
377
378###############################################################################
379# M U L T I   P A C K A G E
380###############################################################################
381
382# The name here needs to be short to avoid long path issues on windows
383# when running the `libnghttp2-sys` build script.
384multi_pkg_example_name = "m_pkgs"
385
386crates_repository(
387    name = multi_pkg_example_name,
388    annotations = {
389        "curl-sys": [crate.annotation(
390            gen_build_script = False,
391            deps = [
392                "@m_pkgs__curl//:curl",
393            ],
394        )],
395        "httpmock": [crate.annotation(
396            shallow_since = "1673473097 +0100",
397        )],
398        "isahc": [crate.annotation(
399            shallow_since = "1667787880 -0600",
400        )],
401        "libnghttp2-sys": [crate.annotation(
402            build_script_data_glob = ["nghttp2/**"],
403            data_glob = ["nghttp2/**"],
404        )],
405        "wepoll-ffi": [crate.annotation(
406            build_script_data_glob = ["vendor/**"],
407        )],
408    },
409    cargo_lockfile = "//multi_package:Cargo.Bazel.lock",
410    # `generator` is not necessary in official releases.
411    # See load satement for `cargo_bazel_bootstrap`.
412    generator = "@cargo_bazel_bootstrap//:cargo-bazel",
413    lockfile = "//multi_package:cargo-bazel-lock.json",
414    manifests = [
415        "//multi_package/pkg_a:Cargo.toml",
416        "//multi_package/sub_pkgs/pkg_b:Cargo.toml",
417        "//multi_package/sub_pkgs/pkg_c:Cargo.toml",
418    ],
419)
420
421load("//multi_package/3rdparty:third_party_deps.bzl", "third_party_deps")
422
423third_party_deps(
424    prefix = multi_pkg_example_name,
425)
426
427load(
428    "@m_pkgs//:defs.bzl",
429    multi_pkg_crate_repositories = "crate_repositories",
430)
431
432multi_pkg_crate_repositories()
433
434###############################################################################
435# N O   C A R G O   M A N I F E S T S
436###############################################################################
437
438crates_repository(
439    name = "no_cargo",
440    annotations = {
441        "axum": [crate.annotation(
442            compile_data_glob = ["**/*.md"],
443        )],
444    },
445    cargo_lockfile = "//no_cargo_manifests:Cargo.Bazel.lock",
446    # `generator` is not necessary in official releases.
447    # See load satement for `cargo_bazel_bootstrap`.
448    generator = "@cargo_bazel_bootstrap//:cargo-bazel",
449    lockfile = "//no_cargo_manifests:cargo-bazel-lock.json",
450    packages = {
451        "axum": crate.spec(
452            version = "0.4.0",
453        ),
454        "hyper": crate.spec(
455            features = ["full"],
456            version = "0.14.22",
457        ),
458        "mime": crate.spec(
459            version = "0.3",
460        ),
461        "serde_json": crate.spec(
462            version = "1.0",
463        ),
464        # TODO: This dependency is added and pinned forward due to the
465        # following issue: https://github.com/hyperium/hyper/issues/3038
466        "socket2": crate.spec(
467            features = ["all"],
468            version = "0.4.7",
469        ),
470        "tokio": crate.spec(
471            features = ["full"],
472            version = "1.17.0",
473        ),
474        "tower": crate.spec(
475            features = ["util"],
476            version = "0.4",
477        ),
478        "tower-http": crate.spec(
479            features = ["trace"],
480            version = "0.2.1",
481        ),
482        "tracing": crate.spec(
483            version = "0.1",
484        ),
485        "tracing-subscriber": crate.spec(
486            version = "0.3",
487        ),
488    },
489    splicing_config = splicing_config(
490        resolver_version = "2",
491    ),
492)
493
494load(
495    "@no_cargo//:defs.bzl",
496    no_cargo_crate_repositories = "crate_repositories",
497)
498
499no_cargo_crate_repositories()
500
501###############################################################################
502# U S I N G   C X X   C R A T E
503###############################################################################
504
505# CXX crate is a bit different since there are C++ headers provided.
506
507crates_repository(
508    name = "using_cxx",
509    cargo_lockfile = "//using_cxx:Cargo.Bazel.lock",
510    # `generator` is not necessary in official releases.
511    # See load satement for `cargo_bazel_bootstrap`.
512    generator = "@cargo_bazel_bootstrap//:cargo-bazel",
513    lockfile = "//using_cxx:cargo-bazel-lock.json",
514    packages = {
515        "cxx": crate.spec(
516            version = "1.0.109",
517        ),
518    },
519    splicing_config = splicing_config(
520        resolver_version = "2",
521    ),
522)
523
524load(
525    "@using_cxx//:defs.bzl",
526    using_cxx_crate_repositories = "crate_repositories",
527)
528
529using_cxx_crate_repositories()
530
531# The codegen tool needed by cxx.
532http_archive(
533    name = "cxxbridge-cmd",
534    build_file_content = """
535load("@rules_rust//rust:defs.bzl", "rust_binary")
536load("@cxxbridge_cmd_deps//:defs.bzl", "aliases", "all_crate_deps")
537
538rust_binary(
539    name = "cxxbridge-cmd",
540    srcs = glob(["src/**/*.rs"]),
541    aliases = aliases(),
542    data = [
543        "src/gen/include/cxx.h",
544    ],
545    edition = "2021",
546    visibility = ["//visibility:public"],
547    deps = all_crate_deps(
548        normal = True,
549    ),
550)
551    """,
552    sha256 = "d93600487d429c8bf013ee96719af4e62e809ac57fc4cac24f17cf58e4526009",
553    strip_prefix = "cxxbridge-cmd-1.0.109",
554    type = "tar.gz",
555    urls = ["https://static.crates.io/crates/cxxbridge-cmd/cxxbridge-cmd-1.0.109.crate"],
556)
557
558crates_repository(
559    name = "cxxbridge_cmd_deps",
560    cargo_lockfile = "//using_cxx:cxxbridge-cmd.Cargo.lock",
561    # `generator` is not necessary in official releases.
562    # See load satement for `cargo_bazel_bootstrap`.
563    generator = "@cargo_bazel_bootstrap//:cargo-bazel",
564    lockfile = "//using_cxx:cxxbridge-cmd.Cargo.Bazel.lock",
565    manifests = ["@cxxbridge-cmd//:Cargo.toml"],
566    splicing_config = splicing_config(
567        resolver_version = "2",
568    ),
569)
570
571load("@cxxbridge_cmd_deps//:defs.bzl", cxxbridge_cmd_deps = "crate_repositories")
572
573cxxbridge_cmd_deps()
574
575###############################################################################
576# V E N D O R   E X T E R N A L
577###############################################################################
578
579http_archive(
580    name = "names_external",
581    build_file = "//cargo_remote:BUILD.names.bazel",
582    sha256 = "eab40caca5805624ba31d028913931c3d054b22daafff6f43e3435cfa9fb761e",
583    strip_prefix = "names-0.13.0",
584    urls = ["https://github.com/fnichol/names/archive/refs/tags/v0.13.0.zip"],
585)
586
587load(
588    "//vendor_external/crates:crates.bzl",
589    crates_vendor_external_repositories = "crate_repositories",
590)
591
592crates_vendor_external_repositories()
593
594###############################################################################
595# V E N D O R   R E M O T E   M A N I F E S T S
596###############################################################################
597
598load(
599    "//vendor_remote_manifests/crates:crates.bzl",
600    crates_vendor_manifests_repositories = "crate_repositories",
601)
602
603crates_vendor_manifests_repositories()
604
605###############################################################################
606# V E N D O R   R E M O T E   P A C K A G E S
607###############################################################################
608
609load(
610    "//vendor_remote_pkgs/crates:crates.bzl",
611    crates_vendor_packages_repositories = "crate_repositories",
612)
613
614crates_vendor_packages_repositories()
615
616###############################################################################
617# C O M P L I C A T E D   D E P E N D E N C I E S
618###############################################################################
619
620http_archive(
621    name = "rules_foreign_cc",
622    sha256 = "1eee5d216a3cec7a4c731f71ed731ac353290b1db61ab68b79440655bcb9acaa",
623    strip_prefix = "rules_foreign_cc-7ce62009557d73da9aa0d2a1ca7eded49078b3cf",
624    # Pulls in https://github.com/bazelbuild/rules_foreign_cc/pull/1163 and https://github.com/bazelbuild/rules_foreign_cc/pull/1199 which aren't currently in a release.
625    url = "https://github.com/bazelbuild/rules_foreign_cc/archive/7ce62009557d73da9aa0d2a1ca7eded49078b3cf.tar.gz",
626)
627
628load("@rules_foreign_cc//foreign_cc:repositories.bzl", "rules_foreign_cc_dependencies")
629
630rules_foreign_cc_dependencies()
631
632http_archive(
633    name = "aspect_bazel_lib",
634    sha256 = "f5ea76682b209cc0bd90d0f5a3b26d2f7a6a2885f0c5f615e72913f4805dbb0d",
635    strip_prefix = "bazel-lib-2.5.0",
636    url = "https://github.com/aspect-build/bazel-lib/releases/download/v2.5.0/bazel-lib-v2.5.0.tar.gz",
637)
638
639load("@aspect_bazel_lib//lib:repositories.bzl", "aspect_bazel_lib_dependencies", "aspect_bazel_lib_register_toolchains")
640
641aspect_bazel_lib_dependencies()
642
643aspect_bazel_lib_register_toolchains()
644
645load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")
646
647git_repository(
648    name = "boringssl",
649    commit = "44b3df6f03d85c901767250329c571db405122d5",
650    patch_args = ["-p1"],
651    patches = [
652        "//complicated_dependencies:boringssl-filegroup.patch",
653        # On the macOS bazelci builders, there's a system-installed openssl, and that takes priority over -isystem flags, which is what cc_library.includes uses.
654        # This forces our local system-includes to be chosen with higher priority, which avoids conflicts.
655        "//complicated_dependencies:boringssl-system-includes.patch",
656    ],
657    remote = "https://github.com/google/boringssl.git",
658)
659
660crates_repository(
661    name = "complicated_dependencies",
662    annotations = {
663        # boringssl natively builds with Bazel, but boring-sys tries to build it with cmake.
664        # We could pass boring-sys a cmake binary it can invoke, but the boring-sys build script wouldn't get to exploit the caching and parallelism of full Bazel builds of boringssl.
665        # Instead, we use the build script env var hooks to point the build script at the output of Bazel building boringssl.
666        "boring-sys": [
667            crate.annotation(
668                build_script_data = [
669                    "@//complicated_dependencies:boringssl_gen_dir",
670                    "@boringssl//:headers",
671                ],
672                build_script_env = {
673                    # Ideally this would use an execpath macro, but we need to point at a directory and that's fiddly. We could probably copy the directory somewhere and point at that... For now, this works.
674                    "BORING_BSSL_INCLUDE_PATH": "$${pwd}/external/boringssl/src/include",
675                    "BORING_BSSL_PATH": "$(execpath @//complicated_dependencies:boringssl_gen_dir)",
676                },
677                compile_data = [
678                    "@//complicated_dependencies:boringssl_gen_dir",
679                    "@boringssl//:headers",
680                ],
681            ),
682        ],
683        # zlib-ng-sys's build script invokes cmake, so we need to make cmake available.
684        # Fortunately, rules_foreign_cc has a cmake toolchain we can use.
685        "libz-ng-sys": [crate.annotation(
686            # Setting build_script_data makes the files available on disk when the rule runs.
687            build_script_data = ["@rules_foreign_cc//toolchains:current_cmake_toolchain"],
688            build_script_env = {
689                # The toolchain supplies a value of $(CMAKE) which is an execroot-relative path, so we need to prefix it with $${pwd}/ because build scripts don't typically run in the execroot unlike most bazel rules, for improved compatibility with Cargo.
690                "CMAKE": "$${pwd}/$(CMAKE)",
691            },
692            # Setting build_script_toolchains makes makefile variable substitution work so that we can reference $(CNAME) in attributes.
693            build_script_toolchains = ["@rules_foreign_cc//toolchains:current_cmake_toolchain"],
694        )],
695    },
696    cargo_lockfile = "//complicated_dependencies:Cargo.Bazel.lock",
697    # `generator` is not necessary in official releases.
698    # See load satement for `cargo_bazel_bootstrap`.
699    generator = "@cargo_bazel_bootstrap//:cargo-bazel",
700    lockfile = "//complicated_dependencies:cargo-bazel-lock.json",
701    packages = {
702        "boring": crate.spec(
703            version = "3.0.4",
704        ),
705        "libz-ng-sys": crate.spec(
706            version = "=1.1.15",
707        ),
708    },
709    splicing_config = splicing_config(
710        resolver_version = "2",
711    ),
712)
713
714load(
715    "@complicated_dependencies//:defs.bzl",
716    complicated_dependencies_crate_repositories = "crate_repositories",
717)
718
719complicated_dependencies_crate_repositories()
720
721###############################################################################
722# O V E R R I D E  T A R G E T
723###############################################################################
724
725crates_repository(
726    name = "override_target",
727    annotations = {
728        "foo": [crate.annotation(
729            override_targets = {"lib": "@//override_target:foo"},
730        )],
731    },
732    cargo_lockfile = "//override_target:Cargo.Bazel.lock",
733    # `generator` is not necessary in official releases.
734    # See load satement for `cargo_bazel_bootstrap`.
735    generator = "@cargo_bazel_bootstrap//:cargo-bazel",
736    lockfile = "//override_target:cargo-bazel-lock.json",
737    packages = {
738        "foo": crate.spec(
739            version = "0.0.0",
740        ),
741    },
742    splicing_config = splicing_config(
743        resolver_version = "2",
744    ),
745)
746
747load(
748    "@override_target//:defs.bzl",
749    override_target_crate_repositories = "crate_repositories",
750)
751
752override_target_crate_repositories()
753
754###############################################################################
755
756# Used for Bazel CI
757http_archive(
758    name = "bazelci_rules",
759    sha256 = "eca21884e6f66a88c358e580fd67a6b148d30ab57b1680f62a96c00f9bc6a07e",
760    strip_prefix = "bazelci_rules-1.0.0",
761    url = "https://github.com/bazelbuild/continuous-integration/releases/download/rules-1.0.0/bazelci_rules-1.0.0.tar.gz",
762)
763
764load("@bazelci_rules//:rbe_repo.bzl", "rbe_preconfig")
765
766# Creates a default toolchain config for RBE.
767# Use this as is if you are using the rbe_ubuntu16_04 container,
768# otherwise refer to RBE docs.
769rbe_preconfig(
770    name = "buildkite_config",
771    toolchain = "ubuntu1804-bazel-java11",
772)
773