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