xref: /aosp_15_r20/external/bazelbuild-rules_rust/tools/rust_analyzer/BUILD.bazel (revision d4726bddaa87cc4778e7472feed243fa4b6c267f)
1*d4726bddSHONG Yifanload("@bazel_skylib//:bzl_library.bzl", "bzl_library")
2*d4726bddSHONG Yifanload("//rust:defs.bzl", "rust_binary", "rust_clippy", "rust_library", "rust_test")
3*d4726bddSHONG Yifanload("//tools:tool_utils.bzl", "aspect_repository")
4*d4726bddSHONG Yifan
5*d4726bddSHONG Yifanrust_binary(
6*d4726bddSHONG Yifan    name = "gen_rust_project",
7*d4726bddSHONG Yifan    srcs = ["main.rs"],
8*d4726bddSHONG Yifan    edition = "2018",
9*d4726bddSHONG Yifan    rustc_env = {
10*d4726bddSHONG Yifan        "ASPECT_REPOSITORY": aspect_repository(),
11*d4726bddSHONG Yifan    },
12*d4726bddSHONG Yifan    visibility = ["//visibility:public"],
13*d4726bddSHONG Yifan    deps = [
14*d4726bddSHONG Yifan        ":gen_rust_project_lib",
15*d4726bddSHONG Yifan        "//tools/rust_analyzer/3rdparty/crates:anyhow",
16*d4726bddSHONG Yifan        "//tools/rust_analyzer/3rdparty/crates:clap",
17*d4726bddSHONG Yifan        "//tools/rust_analyzer/3rdparty/crates:env_logger",
18*d4726bddSHONG Yifan        "//tools/rust_analyzer/3rdparty/crates:log",
19*d4726bddSHONG Yifan        "//util/label",
20*d4726bddSHONG Yifan    ],
21*d4726bddSHONG Yifan)
22*d4726bddSHONG Yifan
23*d4726bddSHONG Yifanrust_library(
24*d4726bddSHONG Yifan    name = "gen_rust_project_lib",
25*d4726bddSHONG Yifan    srcs = glob(
26*d4726bddSHONG Yifan        ["**/*.rs"],
27*d4726bddSHONG Yifan        exclude = ["main.rs"],
28*d4726bddSHONG Yifan    ),
29*d4726bddSHONG Yifan    data = [
30*d4726bddSHONG Yifan        "//rust/private:rust_analyzer_detect_sysroot",
31*d4726bddSHONG Yifan    ],
32*d4726bddSHONG Yifan    edition = "2018",
33*d4726bddSHONG Yifan    deps = [
34*d4726bddSHONG Yifan        "//tools/runfiles",
35*d4726bddSHONG Yifan        "//tools/rust_analyzer/3rdparty/crates:anyhow",
36*d4726bddSHONG Yifan        "//tools/rust_analyzer/3rdparty/crates:log",
37*d4726bddSHONG Yifan        "//tools/rust_analyzer/3rdparty/crates:serde",
38*d4726bddSHONG Yifan        "//tools/rust_analyzer/3rdparty/crates:serde_json",
39*d4726bddSHONG Yifan    ],
40*d4726bddSHONG Yifan)
41*d4726bddSHONG Yifan
42*d4726bddSHONG Yifanrust_test(
43*d4726bddSHONG Yifan    name = "gen_rust_project_lib_test",
44*d4726bddSHONG Yifan    crate = ":gen_rust_project_lib",
45*d4726bddSHONG Yifan    deps = [
46*d4726bddSHONG Yifan        "//tools/rust_analyzer/3rdparty/crates:itertools",
47*d4726bddSHONG Yifan    ],
48*d4726bddSHONG Yifan)
49*d4726bddSHONG Yifan
50*d4726bddSHONG Yifanrust_clippy(
51*d4726bddSHONG Yifan    name = "gen_rust_project_clippy",
52*d4726bddSHONG Yifan    testonly = True,
53*d4726bddSHONG Yifan    visibility = ["//visibility:private"],
54*d4726bddSHONG Yifan    deps = [
55*d4726bddSHONG Yifan        ":gen_rust_project",
56*d4726bddSHONG Yifan    ],
57*d4726bddSHONG Yifan)
58*d4726bddSHONG Yifan
59*d4726bddSHONG Yifanbzl_library(
60*d4726bddSHONG Yifan    name = "bzl_lib",
61*d4726bddSHONG Yifan    srcs = glob(["**/*.bzl"]),
62*d4726bddSHONG Yifan    visibility = ["//visibility:public"],
63*d4726bddSHONG Yifan    deps = ["//tools/rust_analyzer/3rdparty:bzl_lib"],
64*d4726bddSHONG Yifan)
65