aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYecheng Zhao <zyecheng@google.com>2023-10-09 22:23:11 +0000
committerYecheng Zhao <zyecheng@google.com>2023-10-09 22:38:10 +0000
commitd3a23639db2b5ef4f45a9619a3cb1d26a8a7ac76 (patch)
treee2d80a78b17bdf0c3cd9a9a106157793ddd26cc2
parent4801c12b7f567aff78a70876ee252d920a849dbd (diff)
downloadproc-macro2-d3a23639db2b5ef4f45a9619a3cb1d26a8a7ac76.tar.gz
Add BUILD file for proc-macro2 kleaf build
Test: touch external/rust/crates/unicode-ident/WORKSPACE && \ touch external/rust/crates/proc-macro2/WORKSPACE && \ b build @proc-macro2 \ --override_repository=unicode-ident=external/rust/crates/unicode-ident/ \ --override_repository=proc-macro2=external/rust/crates/proc-macro2/ Bug: 304282799 Change-Id: If577c7b605f4415c95eabeafe007134c5d45671b
-rw-r--r--BUILD59
1 files changed, 59 insertions, 0 deletions
diff --git a/BUILD b/BUILD
new file mode 100644
index 0000000..7d96008
--- /dev/null
+++ b/BUILD
@@ -0,0 +1,59 @@
+load("@rules_license//rules:license.bzl", "license")
+load("@rules_license//rules:license_kind.bzl", "license_kind")
+load("@rules_rust//cargo:defs.bzl", "cargo_build_script")
+load("@rules_rust//rust:defs.bzl", "rust_library")
+
+package(
+ default_applicable_licenses = [":license"],
+ default_visibility = ["//visibility:public"],
+)
+
+license(
+ name = "license",
+ license_kinds = [
+ ":SPDX-license-identifier-Apache-2.0",
+ ":SPDX-license-identifier-MIT",
+ ],
+ license_text = "LICENSE-APACHE",
+ visibility = [":__subpackages__"],
+)
+
+license_kind(
+ name = "SPDX-license-identifier-Apache-2.0",
+ conditions = ["notice"],
+ url = "https://spdx.org/licenses/Apache-2.0.html",
+)
+
+license_kind(
+ name = "SPDX-license-identifier-MIT",
+ conditions = ["notice"],
+ url = "",
+)
+
+CRATE_FEATURES = [
+ "default",
+ "proc-macro",
+ "span-locations",
+]
+
+rust_library(
+ name = "proc-macro2",
+ srcs = glob(["**/*.rs"]),
+ crate_features = CRATE_FEATURES,
+ edition = "2021",
+ deps = [
+ ":proc-macro2_build_script",
+ # This should map to repo checked out from Android third party project
+ # "platform/external/rust/crates/unicode-ident".
+ "@unicode-ident",
+ ],
+)
+
+cargo_build_script(
+ name = "proc-macro2_build_script",
+ srcs = glob(["**/*.rs"]),
+ crate_features = CRATE_FEATURES,
+ crate_root = "build.rs",
+ edition = "2021",
+ visibility = ["//visibility:private"],
+)