• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1load("@bazel_skylib//:bzl_library.bzl", "bzl_library")
2load("//bindgen:repositories.bzl", "BINDGEN_VERSION")
3load("//crate_universe:defs.bzl", "crate", "crates_vendor")
4
5_BINDGEN_CLI_PACKAGES = {
6    "clap": crate.spec(
7        version = "4.3.3",
8    ),
9    "clap_complete": crate.spec(
10        version = "4.3.1",
11    ),
12    "env_logger": crate.spec(
13        version = "0.10.0",
14    ),
15}
16
17crates_vendor(
18    name = "crates_vendor",
19    annotations = {
20        "bindgen": [crate.annotation(
21            gen_build_script = True,
22        )],
23        "clang-sys": [crate.annotation(
24            gen_build_script = True,
25        )],
26        "libc": [crate.annotation(
27            gen_build_script = True,
28        )],
29        "rustix": [crate.annotation(
30            gen_build_script = True,
31        )],
32        "winapi": [crate.annotation(
33            gen_build_script = True,
34        )],
35    },
36    cargo_lockfile = "Cargo.Bazel.lock",
37    generate_build_scripts = False,
38    mode = "remote",
39    packages = dict({
40        "bindgen": crate.spec(
41            default_features = False,
42            features = ["runtime"],
43            version = BINDGEN_VERSION,
44        ),
45        "bindgen-cli": crate.spec(
46            default_features = False,
47            features = ["runtime"],
48            version = BINDGEN_VERSION,
49        ),
50        "clang-sys": crate.spec(
51            # Should match the version of llvm-project being used.
52            features = ["clang_14_0"],
53        ),
54    }.items() + _BINDGEN_CLI_PACKAGES.items()),
55    repository_name = "rules_rust_bindgen",
56    tags = ["manual"],
57)
58
59alias(
60    name = "bindgen",
61    actual = "@rules_rust_bindgen__bindgen-cli-{}//:bindgen-cli".format(BINDGEN_VERSION),
62    tags = ["manual"],
63    visibility = ["//visibility:public"],
64)
65
66bzl_library(
67    name = "bzl_lib",
68    srcs = [
69        "//bindgen/3rdparty/crates:crates.bzl",
70        "//bindgen/3rdparty/crates:defs.bzl",
71    ],
72    visibility = ["//bindgen:__pkg__"],
73)
74