Migrate the Rust system property bindings from bionic.
This mostly just migrates the existing code with a few minor changes
(renaming targets, using // for license comments).
It also adds a toplevel lib.rs and moves the .h file into a subfolder
to make it easier to add more libraries the future.
Bug: 182498247
Test: Build this and dependent libraries.
Change-Id: I3556b11bdd8edd8bd2cd91ce4c841615b27c721b
diff --git a/Android.bp b/Android.bp
new file mode 100644
index 0000000..66606d4
--- /dev/null
+++ b/Android.bp
@@ -0,0 +1,30 @@
+rust_library {
+ name: "librustutils",
+ crate_name: "rustutils",
+ srcs: [
+ "lib.rs",
+ ],
+ rustlibs: [
+ "libanyhow",
+ "libsystem_properties_bindgen",
+ "libthiserror",
+ ],
+ shared_libs: [
+ "libbase",
+ ],
+}
+
+rust_bindgen {
+ name: "libsystem_properties_bindgen",
+ wrapper_src: "bindgen/system_properties.h",
+ crate_name: "system_properties_bindgen",
+ source_stem: "bindings",
+
+ bindgen_flags: [
+ "--size_t-is-usize",
+ "--allowlist-function=__system_property_find",
+ "--allowlist-function=__system_property_read_callback",
+ "--allowlist-function=__system_property_set",
+ "--allowlist-function=__system_property_wait",
+ ],
+}