summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErwin Jansen <jansene@google.com>2024-05-08 10:35:29 -0700
committerErwin Jansen <jansene@google.com>2024-05-08 11:14:16 -0700
commit5789b08c6142c7f2db8b612f940e1455b312ed51 (patch)
tree289bf54ab8f1bf53523ad1e44c31a95f5e30cb97
parent3eda90c4d9b067889d2f60236204cd901eca1901 (diff)
downloadgoldfish-5789b08c6142c7f2db8b612f940e1455b312ed51.tar.gz
Add rust crate build files
This contains all the build files for rust packages that we need to compile rutabaga. Theyh live here since: - The Rust team does not explicitly support bazel: - There are no automated tools that convert Cargo -> Bazel (as there is for android.bp) - The Rust team does not have the bandwidth to support bazel directly - The emulator team takes ownership of the crate to bazel translation. That is if the crates in aosp are updated, and it breaks the emulator build, the emulator team will update the bazel build to make them work - No other team will take dependencies on these build files. Bug: 335734830 Change-Id: I8de6d677272dd1073fc4687eeb015e2f3b1521be
-rw-r--r--third_party/rust/crates/BUILD13
-rw-r--r--third_party/rust/crates/BUILD.bitflags36
-rw-r--r--third_party/rust/crates/BUILD.byteorder37
-rw-r--r--third_party/rust/crates/BUILD.cfg-if36
-rw-r--r--third_party/rust/crates/BUILD.libc53
-rw-r--r--third_party/rust/crates/BUILD.log57
-rw-r--r--third_party/rust/crates/BUILD.once_cell36
-rw-r--r--third_party/rust/crates/BUILD.proc-macro259
-rw-r--r--third_party/rust/crates/BUILD.quote45
-rw-r--r--third_party/rust/crates/BUILD.remain52
-rw-r--r--third_party/rust/crates/BUILD.syn59
-rw-r--r--third_party/rust/crates/BUILD.thiserror72
-rw-r--r--third_party/rust/crates/BUILD.thiserror-impl48
-rw-r--r--third_party/rust/crates/BUILD.unicode-ident36
-rw-r--r--third_party/rust/crates/BUILD.zerocopy51
-rw-r--r--third_party/rust/crates/BUILD.zerocopy-derive46
16 files changed, 736 insertions, 0 deletions
diff --git a/third_party/rust/crates/BUILD b/third_party/rust/crates/BUILD
new file mode 100644
index 0000000..2a707c2
--- /dev/null
+++ b/third_party/rust/crates/BUILD
@@ -0,0 +1,13 @@
+# This directory contains a set of bazel build files
+# that enable the compilation of packages that are found
+# in /external/rust/crates/...
+#
+# Here is the rationale behind the bazel build files living here:
+#
+# - The Rust team does not explicitly support bazel:
+# - There are no automated tools that convert Cargo -> Bazel (as there is for android.bp)
+# - The Rust team does not have the bandwidth to support bazel directly
+# - The emulator team takes ownership of the crate to bazel translation. That is if the crates
+# in aosp are updated, and it breaks the emulator build, the emulator team will update the bazel build
+# to make them work
+# - No other team will take dependencies on these build files.
diff --git a/third_party/rust/crates/BUILD.bitflags b/third_party/rust/crates/BUILD.bitflags
new file mode 100644
index 0000000..156cf27
--- /dev/null
+++ b/third_party/rust/crates/BUILD.bitflags
@@ -0,0 +1,36 @@
+load("@rules_license//rules:license.bzl", "license")
+load("@rules_license//rules:license_kind.bzl", "license_kind")
+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 = "",
+)
+
+rust_library(
+ name = "bitflags",
+ srcs = glob(["**/*.rs"]),
+ edition = "2021",
+)
diff --git a/third_party/rust/crates/BUILD.byteorder b/third_party/rust/crates/BUILD.byteorder
new file mode 100644
index 0000000..8340446
--- /dev/null
+++ b/third_party/rust/crates/BUILD.byteorder
@@ -0,0 +1,37 @@
+load("@rules_license//rules:license.bzl", "license")
+load("@rules_license//rules:license_kind.bzl", "license_kind")
+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 = "",
+)
+
+rust_library(
+ name = "byteorder",
+ srcs = glob(["**/*.rs"]),
+ edition = "2021",
+ visibility = ["//visibility:public"],
+)
diff --git a/third_party/rust/crates/BUILD.cfg-if b/third_party/rust/crates/BUILD.cfg-if
new file mode 100644
index 0000000..d3289e1
--- /dev/null
+++ b/third_party/rust/crates/BUILD.cfg-if
@@ -0,0 +1,36 @@
+load("@rules_license//rules:license.bzl", "license")
+load("@rules_license//rules:license_kind.bzl", "license_kind")
+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 = "",
+)
+
+rust_library(
+ name = "cfg-if",
+ srcs = glob(["**/*.rs"]),
+ edition = "2018",
+)
diff --git a/third_party/rust/crates/BUILD.libc b/third_party/rust/crates/BUILD.libc
new file mode 100644
index 0000000..cb0528e
--- /dev/null
+++ b/third_party/rust/crates/BUILD.libc
@@ -0,0 +1,53 @@
+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",
+ "extra_traits",
+ "std",
+]
+
+rust_library(
+ name = "libc",
+ srcs = glob(["src/**/*.rs"]),
+ edition = "2015",
+ deps = [":libc_build_script"],
+)
+
+cargo_build_script(
+ name = "libc_build_script",
+ srcs = glob(["**/*.rs"]),
+ crate_features = CRATE_FEATURES,
+ crate_root = "build.rs",
+ edition = "2015",
+ visibility = ["//visibility:private"],
+)
diff --git a/third_party/rust/crates/BUILD.log b/third_party/rust/crates/BUILD.log
new file mode 100644
index 0000000..a6cf703
--- /dev/null
+++ b/third_party/rust/crates/BUILD.log
@@ -0,0 +1,57 @@
+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 = [
+ "std",
+ ]
+
+rust_library(
+ name = "log",
+ srcs = [
+ "src/lib.rs",
+ ],
+ crate_features = CRATE_FEATURES,
+ edition = "2021",
+ deps = [
+ ":log_build_script",
+ "@cfg-if"
+ ],
+)
+
+cargo_build_script(
+ name = "log_build_script",
+ srcs = glob(["**/*.rs"]),
+ crate_features = CRATE_FEATURES,
+ crate_root = "build.rs",
+ edition = "2021",
+ visibility = ["//visibility:private"],
+)
diff --git a/third_party/rust/crates/BUILD.once_cell b/third_party/rust/crates/BUILD.once_cell
new file mode 100644
index 0000000..0912c57
--- /dev/null
+++ b/third_party/rust/crates/BUILD.once_cell
@@ -0,0 +1,36 @@
+load("@rules_license//rules:license.bzl", "license")
+load("@rules_license//rules:license_kind.bzl", "license_kind")
+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 = "",
+)
+
+rust_library(
+ name = "once_cell",
+ srcs = glob(["**/*.rs"]),
+ edition = "2015",
+)
diff --git a/third_party/rust/crates/BUILD.proc-macro2 b/third_party/rust/crates/BUILD.proc-macro2
new file mode 100644
index 0000000..7d96008
--- /dev/null
+++ b/third_party/rust/crates/BUILD.proc-macro2
@@ -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"],
+)
diff --git a/third_party/rust/crates/BUILD.quote b/third_party/rust/crates/BUILD.quote
new file mode 100644
index 0000000..d02d8cb
--- /dev/null
+++ b/third_party/rust/crates/BUILD.quote
@@ -0,0 +1,45 @@
+load("@rules_license//rules:license.bzl", "license")
+load("@rules_license//rules:license_kind.bzl", "license_kind")
+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 = "",
+)
+
+rust_library(
+ name = "quote",
+ srcs = glob(["**/*.rs"]),
+ crate_features = [
+ "default",
+ "proc-macro",
+ ],
+ edition = "2018",
+ deps = [
+ # This should map to repo checked out from Android third party project
+ # "platform/external/rust/crates/proc-macro2".
+ "@proc-macro2",
+ ],
+)
diff --git a/third_party/rust/crates/BUILD.remain b/third_party/rust/crates/BUILD.remain
new file mode 100644
index 0000000..aca3331
--- /dev/null
+++ b/third_party/rust/crates/BUILD.remain
@@ -0,0 +1,52 @@
+load("@rules_license//rules:license.bzl", "license")
+load("@rules_license//rules:license_kind.bzl", "license_kind")
+load("@rules_rust//rust:defs.bzl", "rust_proc_macro")
+
+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 = "",
+)
+
+rust_proc_macro(
+ name = "remain",
+ srcs = glob(
+ include = ["**/*.rs"],
+ exclude = [
+ "tests/compiletest.rs",
+ "tests/order.rs",
+ "tests/stable.rs",
+ "tests/unstable.rs",
+ ],
+ ),
+ edition = "2018",
+ rustc_flags = [
+ "--cap-lints=allow",
+ ],
+ deps = [
+ "@proc-macro2",
+ "@quote",
+ "@syn",
+ ],
+)
diff --git a/third_party/rust/crates/BUILD.syn b/third_party/rust/crates/BUILD.syn
new file mode 100644
index 0000000..93e54c7
--- /dev/null
+++ b/third_party/rust/crates/BUILD.syn
@@ -0,0 +1,59 @@
+load("@rules_license//rules:license.bzl", "license")
+load("@rules_license//rules:license_kind.bzl", "license_kind")
+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 = "",
+)
+
+rust_library(
+ name = "syn",
+ srcs = glob(["**/*.rs"]),
+ crate_features = [
+ "clone-impls",
+ "default",
+ "derive",
+ "extra-traits",
+ "full",
+ "parsing",
+ "printing",
+ "proc-macro",
+ "quote",
+ "visit",
+ "visit-mut",
+ ],
+ edition = "2021",
+ deps = [
+ # This should map to repo checked out from Android third party project
+ # "platform/external/rust/crates/proc-macro2". Similar for the rest of the dependencies
+ # below.
+ "@proc-macro2",
+ # Map to project repo "platform/external/rust/crates/quote".
+ "@quote",
+ # Map to project repo "platform/external/rust/crates/unicode-ident".
+ "@unicode-ident",
+ ],
+)
diff --git a/third_party/rust/crates/BUILD.thiserror b/third_party/rust/crates/BUILD.thiserror
new file mode 100644
index 0000000..f274852
--- /dev/null
+++ b/third_party/rust/crates/BUILD.thiserror
@@ -0,0 +1,72 @@
+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 = "",
+)
+
+cargo_build_script(
+ name = "thiserror_build_script",
+ srcs = ["build.rs"],
+ edition = "2021",
+ version = "1.0.57",
+ visibility = ["//visibility:private"],
+)
+
+rust_library(
+ name = "thiserror",
+ srcs = glob(
+ include = ["**/*.rs"],
+ exclude = [
+ "build.rs",
+ "tests/compiletest.rs",
+ "tests/test_backtrace.rs",
+ "tests/test_deprecated.rs",
+ "tests/test_display.rs",
+ "tests/test_error.rs",
+ "tests/test_expr.rs",
+ "tests/test_from.rs",
+ "tests/test_generics.rs",
+ "tests/test_lints.rs",
+ "tests/test_option.rs",
+ "tests/test_path.rs",
+ "tests/test_source.rs",
+ "tests/test_transparent.rs",
+ ],
+ ),
+ edition = "2021",
+ proc_macro_deps = [
+ "@thiserror-impl",
+ ],
+ rustc_flags = [
+ "--cap-lints=allow",
+ ],
+ deps = [
+ ":thiserror_build_script",
+ ],
+)
diff --git a/third_party/rust/crates/BUILD.thiserror-impl b/third_party/rust/crates/BUILD.thiserror-impl
new file mode 100644
index 0000000..d95bdda
--- /dev/null
+++ b/third_party/rust/crates/BUILD.thiserror-impl
@@ -0,0 +1,48 @@
+load("@rules_license//rules:license.bzl", "license")
+load("@rules_license//rules:license_kind.bzl", "license_kind")
+load("@rules_rust//rust:defs.bzl", "rust_proc_macro")
+
+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 = "",
+)
+
+rust_proc_macro(
+ name = "thiserror-impl",
+ srcs = glob(
+ include = ["**/*.rs"],
+ exclude = [
+ ],
+ ),
+ edition = "2021",
+ rustc_flags = [
+ "--cap-lints=allow",
+ ],
+ deps = [
+ "@proc-macro2",
+ "@quote",
+ "@syn",
+ ],
+)
diff --git a/third_party/rust/crates/BUILD.unicode-ident b/third_party/rust/crates/BUILD.unicode-ident
new file mode 100644
index 0000000..1a285be
--- /dev/null
+++ b/third_party/rust/crates/BUILD.unicode-ident
@@ -0,0 +1,36 @@
+load("@rules_license//rules:license.bzl", "license")
+load("@rules_license//rules:license_kind.bzl", "license_kind")
+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 = "",
+)
+
+rust_library(
+ name = "unicode-ident",
+ srcs = glob(["**/*.rs"]),
+ edition = "2018",
+)
diff --git a/third_party/rust/crates/BUILD.zerocopy b/third_party/rust/crates/BUILD.zerocopy
new file mode 100644
index 0000000..ea2a7b5
--- /dev/null
+++ b/third_party/rust/crates/BUILD.zerocopy
@@ -0,0 +1,51 @@
+load("@rules_license//rules:license.bzl", "license")
+load("@rules_license//rules:license_kind.bzl", "license_kind")
+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 = "",
+)
+
+rust_library(
+ name = "zerocopy",
+ srcs = glob(["**/*.rs"]),
+ crate_features = [
+ "byteorder",
+ "derive",
+ "simd",
+ "zerocopy-derive",
+ ],
+ edition = "2021",
+ proc_macro_deps = [
+ # This should map to repo checked out from Android third party project
+ # "platform/external/rust/crates/zerocopy-derive".
+ "@zerocopy-derive",
+ ],
+ deps = [
+ # Map to project repo "platform/external/rust/crates/byteorder".
+ "@byteorder",
+ ],
+)
diff --git a/third_party/rust/crates/BUILD.zerocopy-derive b/third_party/rust/crates/BUILD.zerocopy-derive
new file mode 100644
index 0000000..b05c589
--- /dev/null
+++ b/third_party/rust/crates/BUILD.zerocopy-derive
@@ -0,0 +1,46 @@
+load("@rules_license//rules:license.bzl", "license")
+load("@rules_license//rules:license_kind.bzl", "license_kind")
+load("@rules_rust//rust:defs.bzl", "rust_proc_macro")
+
+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 = "",
+)
+
+rust_proc_macro(
+ name = "zerocopy-derive",
+ srcs = glob(["**/*.rs"]),
+ edition = "2018",
+ deps = [
+ # This should map to repo checked out from Android third party project
+ # "platform/external/rust/crates/proc-macro2". Similar for the rest of the dependencies
+ # below.
+ "@proc-macro2",
+ # Map to project repo "platform/external/rust/crates/quote".
+ "@quote",
+ # Map to project repo "platform/external/rust/crates/syn".
+ "@syn",
+ ],
+)