Use flexible dependencies to simplify the sysroot

We no longer need duplicate configurations, rustlibs can take care of
that.

Test: mma
Bug: 143217452
Change-Id: I512ee35fcbedf3066e85912ec39516dff1a387c6
diff --git a/Android.bp b/Android.bp
index f6f0e90..4cc6513 100644
--- a/Android.bp
+++ b/Android.bp
@@ -332,7 +332,7 @@
 }
 
 // Top level sysroot libraries are available both as static and dynamic
-rust_library_dylib {
+rust_library {
     name: "libstd",
     crate_name: "std",
     host_supported: true,
@@ -368,48 +368,7 @@
     native_coverage: false,
 }
 
-// libstd does not actually need a separate .static version, as it statically
-// links its dependencies whether compiled as rlib or dylib.
-// However, since libterm and libtest do need a separate .static version
-// until we have dynamic selection included, I'm splitting libstd for symmetry
-
-rust_library_rlib {
-    name: "libstd.static",
-    crate_name: "std",
-    edition: "2018",
-    host_supported: true,
-    target: {
-        linux_glibc_x86_64: {
-            enabled: false,
-        },
-        darwin: {
-            enabled: false,
-        },
-    },
-    srcs: [rustc + "/src/libstd/lib.rs"],
-    features: [
-        "default",
-        "std_detect_dlsym_getauxval",
-        "std_detect_file_io",
-        "profiler",
-    ],
-    no_stdlibs: true,
-    rlibs: [
-        "libbacktrace_rs.rust_sysroot",
-        "libcompiler_builtins.rust_sysroot",
-        "libcore.rust_sysroot",
-        "liblibc.rust_sysroot",
-        "libcfg_if.rust_sysroot",
-        "liballoc.rust_sysroot",
-        "libhashbrown.rust_sysroot",
-        "libunwind.rust_sysroot",
-        "libpanic_unwind.rust_sysroot",
-        "libprofiler_builtins.rust_sysroot",
-    ],
-    native_coverage: false,
-}
-
-rust_library_dylib {
+rust_library {
     name: "libterm",
     host_supported: true,
     target: {
@@ -423,31 +382,12 @@
     crate_name: "term",
     srcs: [rustc + "/src/libterm/lib.rs"],
     no_stdlibs: true,
-    dylibs: ["libstd"],
+    rustlibs: ["libstd"],
     edition: "2018",
     native_coverage: false,
 }
 
-rust_library_rlib {
-    name: "libterm.static",
-    crate_name: "term",
-    host_supported: true,
-    target: {
-        linux_glibc_x86_64: {
-            enabled: false,
-        },
-        darwin: {
-            enabled: false,
-        },
-    },
-    srcs: [rustc + "/src/libterm/lib.rs"],
-    no_stdlibs: true,
-    rlibs: ["libstd.static"],
-    edition: "2018",
-    native_coverage: false,
-}
-
-rust_library_dylib {
+rust_library {
     name: "libgetopts",
     crate_name: "getopts",
     host_supported: true,
@@ -460,34 +400,9 @@
         },
     },
     srcs: [rustc + "/vendor/getopts/src/lib.rs"],
-    dylibs: ["libstd"],
-    // libunicode_width is a no_std crate. This means it can't build into a
-    // shared object without explicit eh_personality etc. items which it
-    // doesn't have. Link it in statically.
+    no_stdlibs: true,
     rlibs: ["libunicode_width.rust_sysroot"],
-    no_stdlibs: true,
-    edition: "2015",
-    native_coverage: false,
-}
-
-rust_library_rlib {
-    name: "libgetopts.static",
-    crate_name: "getopts",
-    host_supported: true,
-    target: {
-        linux_glibc_x86_64: {
-            enabled: false,
-        },
-        darwin: {
-            enabled: false,
-        },
-    },
-    srcs: [rustc + "/vendor/getopts/src/lib.rs"],
-    rlibs: [
-        "libunicode_width.static",
-        "libstd.static",
-    ],
-    no_stdlibs: true,
+    rustlibs: ["libstd"],
     edition: "2015",
     native_coverage: false,
 }
@@ -511,26 +426,7 @@
     native_coverage: false,
 }
 
-rust_library_rlib {
-    name: "libunicode_width.static",
-    crate_name: "unicode_width",
-    host_supported: true,
-    target: {
-        linux_glibc_x86_64: {
-            enabled: false,
-        },
-        darwin: {
-            enabled: false,
-        },
-    },
-    srcs: [rustc + "/vendor/unicode-width/src/lib.rs"],
-    rlibs: ["libstd.static"],
-    no_stdlibs: true,
-    edition: "2015",
-    native_coverage: false,
-}
-
-rust_library_dylib {
+rust_library {
     name: "libtest",
     crate_name: "test",
     host_supported: true,
@@ -543,7 +439,7 @@
         },
     },
     srcs: [rustc + "/src/libtest/lib.rs"],
-    dylibs: [
+    rustlibs: [
         "libterm",
         "libgetopts",
         "libstd",
@@ -557,30 +453,6 @@
 }
 
 rust_library_rlib {
-    name: "libtest.static",
-    crate_name: "test",
-    host_supported: true,
-    target: {
-        linux_glibc_x86_64: {
-            enabled: false,
-        },
-        darwin: {
-            enabled: false,
-        },
-    },
-    srcs: [rustc + "/src/libtest/lib.rs"],
-    rlibs: [
-        "liblibc.rust_sysroot",
-        "libterm.static",
-        "libgetopts.static",
-        "libstd.static",
-    ],
-    no_stdlibs: true,
-    edition: "2018",
-    native_coverage: false,
-}
-
-rust_library_rlib {
     name: "libprofiler_builtins.rust_sysroot",
     crate_name: "profiler_builtins",
     host_supported: true,