xref: /aosp_15_r20/external/bazelbuild-rules_rust/proto/prost/defs.bzl (revision d4726bddaa87cc4778e7472feed243fa4b6c267f)
1"""Rules for building proto libraries in Rust."""
2
3load(
4    "//proto/prost/private:prost.bzl",
5    _rust_prost_library = "rust_prost_library",
6    _rust_prost_toolchain = "rust_prost_toolchain",
7)
8
9def rust_prost_library(name, **kwargs):
10    """A rule for generating a Rust library using Prost.
11
12    Args:
13        name (str): The name of the target.
14        **kwargs (dict): Additional keyword arguments for the underlying
15            `rust_prost_library` rule.
16    """
17
18    # Clippy and Rustfmt will attempt to run on these targets.
19    # This is not correct and likely a bug in target detection.
20    tags = kwargs.pop("tags", [])
21    if "no-clippy" not in tags:
22        tags.append("no-clippy")
23    if "no-rustfmt" not in tags:
24        tags.append("no-rustfmt")
25
26    _rust_prost_library(
27        name = name,
28        tags = tags,
29        **kwargs
30    )
31
32rust_prost_toolchain = _rust_prost_toolchain
33