Fix debug/release dependencies on libartbase

We load both the debug and release build when running tests.
The different builds have different layout of some classes,
which can currently result in random native heap corruptions.

Fix the build dependencies to avoid the double loading,
and add runtime check to avoid it in the future again.

Test: test.py -b --host --64
Test: test.py -r --target -t 001-HelloWorld
Change-Id: Ie62f91dc06209c91e25ba5f11c9d61243ac7579d
diff --git a/dexlayout/Android.bp b/dexlayout/Android.bp
index 838510b..7313405 100644
--- a/dexlayout/Android.bp
+++ b/dexlayout/Android.bp
@@ -29,29 +29,20 @@
     target: {
         android: {
             shared_libs: [
-                "libartbase",
                 "libartpalette",
-                "libdexfile",
-                "libprofile",
                 "libbase",
             ],
         },
         not_windows: {
             shared_libs: [
-                "libartbase",
                 "libartpalette",
-                "libdexfile",
-                "libprofile",
                 "libbase",
             ],
         },
         windows: {
             cflags: ["-Wno-thread-safety"],
             static_libs: [
-                "libartbase",
                 "libartpalette",
-                "libdexfile",
-                "libprofile",
                 "libbase",
             ],
         },
@@ -78,12 +69,29 @@
             lto: {
                  thin: true,
             },
+            shared_libs: [
+                "libartbase",
+                "libdexfile",
+                "libprofile",
+            ],
+        },
+        not_windows: {
+            shared_libs: [
+                "libartbase",
+                "libdexfile",
+                "libprofile",
+            ],
         },
         windows: {
             enabled: true,
             shared: {
                 enabled: false,
             },
+            static_libs: [
+                "libartbase",
+                "libdexfile",
+                "libprofile",
+            ],
         },
     },
 }
@@ -105,11 +113,29 @@
       "libart-dexlayout-defaults",
       "art_debug_defaults",
     ],
-    shared_libs: [
-        "libdexfiled",
-        "libartbased",
-        "libprofiled",
-    ],
+    target: {
+        android: {
+            shared_libs: [
+                "libartbased",
+                "libdexfiled",
+                "libprofiled",
+            ],
+        },
+        not_windows: {
+            shared_libs: [
+                "libartbased",
+                "libdexfiled",
+                "libprofiled",
+            ],
+        },
+        windows: {
+            static_libs: [
+                "libartbased",
+                "libdexfiled",
+                "libprofiled",
+            ],
+        },
+    },
 }
 
 cc_defaults {