• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1load("@rules_license//rules:license.bzl", "license")
2load("@rules_license//rules:license_kind.bzl", "license_kind")
3load("@rules_rust//cargo:defs.bzl", "cargo_build_script")
4load("@rules_rust//rust:defs.bzl", "rust_library")
5
6package(
7    default_applicable_licenses = [":license"],
8    default_visibility = ["//visibility:public"],
9)
10
11license(
12    name = "license",
13    license_kinds = [
14        ":SPDX-license-identifier-Apache-2.0",
15        ":SPDX-license-identifier-MIT",
16    ],
17    license_text = "LICENSE-APACHE",
18    visibility = [":__subpackages__"],
19)
20
21license_kind(
22    name = "SPDX-license-identifier-Apache-2.0",
23    conditions = ["notice"],
24    url = "https://spdx.org/licenses/Apache-2.0.html",
25)
26
27license_kind(
28    name = "SPDX-license-identifier-MIT",
29    conditions = ["notice"],
30    url = "",
31)
32
33CRATE_FEATURES = [
34    "default",
35    "proc-macro",
36    "span-locations",
37]
38
39rust_library(
40    name = "proc-macro2",
41    srcs = glob(["**/*.rs"]),
42    crate_features = CRATE_FEATURES,
43    edition = "2021",
44    deps = [
45        ":proc-macro2_build_script",
46        # This should map to repo checked out from Android third party project
47        # "platform/external/rust/crates/unicode-ident".
48        "@unicode-ident",
49    ],
50)
51
52cargo_build_script(
53    name = "proc-macro2_build_script",
54    srcs = glob(["**/*.rs"]),
55    crate_features = CRATE_FEATURES,
56    crate_root = "build.rs",
57    edition = "2021",
58    visibility = ["//visibility:private"],
59)
60