Add librusb_platform variant am: 56e2703977
Original change: https://android-review.googlesource.com/c/platform/external/rust/crates/rusb/+/3375753
Change-Id: Ib9af3e1d855bf2b754e5db555fad4a2e322b5c28
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
diff --git a/Android.bp b/Android.bp
index 7c51c84..ccc9354 100644
--- a/Android.bp
+++ b/Android.bp
@@ -31,3 +31,27 @@
],
vendor_available: true,
}
+
+rust_library {
+ name: "librusb_platform",
+ host_supported: true,
+ crate_name: "rusb",
+ cargo_env_compat: true,
+ cargo_pkg_version: "0.9.4",
+ crate_root: "src/lib.rs",
+ edition: "2018",
+ rustlibs: [
+ "liblibc",
+ "liblibusb1_sys_platform",
+ ],
+ apex_available: [
+ "//apex_available:platform",
+ "//apex_available:anyapex",
+ ],
+ vendor_available: true,
+ // The 'librusb_platform' rust_library should be depended upon only
+ // by programs running on Android at OS level (e.g. Android platform
+ // services). The reason is that it has a transitive dependency on
+ // "libusb_platform" and all programs using this library must have
+ // permission to access netlink sockets.,
+}
diff --git a/cargo_embargo.json b/cargo_embargo.json
index 311c48a..5fd4473 100644
--- a/cargo_embargo.json
+++ b/cargo_embargo.json
@@ -1,5 +1,18 @@
{
- "tests": false,
"run_cargo": false,
- "product_available": false
+ "product_available": false,
+ "variants": [
+ {},
+ {
+ "module_name_overrides": {
+ "librusb": "librusb_platform",
+ "liblibusb1_sys": "liblibusb1_sys_platform"
+ },
+ "package" : {
+ "rusb": {
+ "add_module_block": "module_block_platform.bp.fragment"
+ }
+ }
+ }
+ ]
}
diff --git a/module_block_platform.bp.fragment b/module_block_platform.bp.fragment
new file mode 100644
index 0000000..1579332
--- /dev/null
+++ b/module_block_platform.bp.fragment
@@ -0,0 +1,5 @@
+// The 'librusb_platform' rust_library should be depended upon only
+// by programs running on Android at OS level (e.g. Android platform
+// services). The reason is that it has a transitive dependency on
+// "libusb_platform" and all programs using this library must have
+// permission to access netlink sockets.
\ No newline at end of file