Convert cts libs to Android.bp

See build/soong/README.md for more information.

Also remove lib and -host suffixes from host libraries that have
been converted to Soong java_libary modules with host_supported: true.

Test: m checkbuild
Test: atest CtsLibcoreApiEvolutionTestCases
Change-Id: I72d2b3ec80ee532203b015db4de973d100b01ac0
diff --git a/common/Android.mk b/common/Android.mk
deleted file mode 100644
index a8b6af7..0000000
--- a/common/Android.mk
+++ /dev/null
@@ -1,15 +0,0 @@
-# Copyright (C) 2014 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-include $(call all-subdir-makefiles)
diff --git a/common/device-side/Android.mk b/common/device-side/Android.mk
deleted file mode 100644
index a8b6af7..0000000
--- a/common/device-side/Android.mk
+++ /dev/null
@@ -1,15 +0,0 @@
-# Copyright (C) 2014 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-include $(call all-subdir-makefiles)
diff --git a/common/device-side/device-info/Android.bp b/common/device-side/device-info/Android.bp
new file mode 100644
index 0000000..583bc85
--- /dev/null
+++ b/common/device-side/device-info/Android.bp
@@ -0,0 +1,41 @@
+// Copyright (C) 2015 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+java_library {
+    name: "compatibility-device-info",
+
+    srcs: ["src/**/*.java"],
+
+    static_libs: [
+        "compatibility-device-util",
+        "android-support-test",
+        "junit",
+    ],
+
+    libs: [
+        "android.test.base.stubs",
+        "framework-stub-for-compatibility-device-info",
+    ],
+
+    sdk_version: "test_current",
+}
+
+java_library {
+    // This stub library provides some internal APIs (SystemProperties, VintfObject, etc.)
+    // to compatibility-device-info library.
+    name: "framework-stub-for-compatibility-device-info",
+    srcs: ["src_stub/**/*.java"],
+
+    sdk_version: "current",
+}
diff --git a/common/device-side/device-info/Android.mk b/common/device-side/device-info/Android.mk
deleted file mode 100644
index df95d9a..0000000
--- a/common/device-side/device-info/Android.mk
+++ /dev/null
@@ -1,48 +0,0 @@
-# Copyright (C) 2015 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-LOCAL_PATH:= $(call my-dir)
-
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_STATIC_JAVA_LIBRARIES := \
-    compatibility-device-util \
-    android-support-test \
-    junit
-
-LOCAL_JAVA_LIBRARIES := \
-    android.test.base.stubs \
-    framework-stub-for-compatibility-device-info
-
-LOCAL_MODULE := compatibility-device-info
-
-LOCAL_SDK_VERSION := current
-
-include $(BUILD_STATIC_JAVA_LIBRARY)
-
-include $(CLEAR_VARS)
-# This stub library provides some internal APIs (SystemProperties, VintfObject, etc.)
-# to compatibility-device-info library.
-LOCAL_MODULE := framework-stub-for-compatibility-device-info
-LOCAL_SRC_FILES := $(call all-java-files-under, src_stub)
-LOCAL_MODULE_TAGS := optional
-LOCAL_SDK_VERSION := current
-LOCAL_UNINSTALLABLE_MODULE := true
-include $(BUILD_JAVA_LIBRARY)
-
-include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/common/device-side/device-info/tests/Android.bp b/common/device-side/device-info/tests/Android.bp
new file mode 100644
index 0000000..10f42da
--- /dev/null
+++ b/common/device-side/device-info/tests/Android.bp
@@ -0,0 +1,31 @@
+// Copyright (C) 2015 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+java_test {
+    name: "compatibility-device-info-tests",
+
+    srcs: ["src/**/*.java"],
+
+    static_libs: [
+        "compatibility-device-info",
+        "junit",
+    ],
+
+    libs: [
+        "android.test.runner.stubs",
+        "android.test.base.stubs",
+    ],
+
+    sdk_version: "test_current",
+}
diff --git a/common/device-side/device-info/tests/Android.mk b/common/device-side/device-info/tests/Android.mk
deleted file mode 100644
index cd05796..0000000
--- a/common/device-side/device-info/tests/Android.mk
+++ /dev/null
@@ -1,31 +0,0 @@
-# Copyright (C) 2015 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-LOCAL_PATH := $(call my-dir)
-
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_STATIC_JAVA_LIBRARIES := compatibility-device-info junit
-
-LOCAL_JAVA_LIBRARIES := android.test.runner.stubs android.test.base.stubs
-
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_MODULE := compatibility-device-info-tests
-
-LOCAL_SDK_VERSION := current
-
-include $(BUILD_STATIC_JAVA_LIBRARY)
diff --git a/common/device-side/nativetesthelper/Android.bp b/common/device-side/nativetesthelper/Android.bp
new file mode 100644
index 0000000..216fb33
--- /dev/null
+++ b/common/device-side/nativetesthelper/Android.bp
@@ -0,0 +1,21 @@
+// Copyright (C) 2017 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+java_library {
+    name: "nativetesthelper",
+
+    srcs: ["src/**/*.java"],
+    static_libs: ["compatibility-common-util-devicesidelib"],
+    sdk_version: "current",
+}
diff --git a/common/device-side/nativetesthelper/Android.mk b/common/device-side/nativetesthelper/Android.mk
deleted file mode 100644
index 63b81e1..0000000
--- a/common/device-side/nativetesthelper/Android.mk
+++ /dev/null
@@ -1,26 +0,0 @@
-# Copyright (C) 2017 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-LOCAL_PATH := $(call my-dir)
-
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-LOCAL_STATIC_JAVA_LIBRARIES := compatibility-common-util-devicesidelib
-LOCAL_MODULE := nativetesthelper
-LOCAL_SDK_VERSION := current
-
-include $(BUILD_STATIC_JAVA_LIBRARY)
-
-include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/common/device-side/nativetesthelper/jni/Android.bp b/common/device-side/nativetesthelper/jni/Android.bp
new file mode 100644
index 0000000..91eb0ac
--- /dev/null
+++ b/common/device-side/nativetesthelper/jni/Android.bp
@@ -0,0 +1,32 @@
+// Copyright (C) 2017 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+//
+// This is the shared library included by the JNI test app.
+//
+
+cc_library_static {
+    name: "libnativetesthelper_jni",
+
+    srcs: ["gtest_wrapper.cpp"],
+
+    shared_libs: ["libnativehelper_compat_libc++"],
+    whole_static_libs: ["libgtest_ndk_c++"],
+    sdk_version: "current",
+    stl: "c++_static",
+    cflags: [
+        "-Wall",
+        "-Werror",
+    ],
+}
diff --git a/common/device-side/nativetesthelper/jni/Android.mk b/common/device-side/nativetesthelper/jni/Android.mk
deleted file mode 100644
index f970e8c..0000000
--- a/common/device-side/nativetesthelper/jni/Android.mk
+++ /dev/null
@@ -1,36 +0,0 @@
-# Copyright (C) 2017 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-#
-# This is the shared library included by the JNI test app.
-#
-
-LOCAL_PATH:= $(call my-dir)
-
-include $(CLEAR_VARS)
-
-LOCAL_MODULE := libnativetesthelper_jni
-
-LOCAL_SRC_FILES := \
-        gtest_wrapper.cpp
-
-LOCAL_SHARED_LIBRARIES := libnativehelper_compat_libc++
-LOCAL_WHOLE_STATIC_LIBRARIES := libgtest_ndk_c++
-LOCAL_EXPORT_STATIC_LIBRARY_HEADERS := libgtest_ndk_c++
-LOCAL_SDK_VERSION := current
-LOCAL_NDK_STL_VARIANT := c++_static
-LOCAL_CFLAGS := -Wall -Werror
-LOCAL_MULTILIB := both
-
-include $(BUILD_STATIC_LIBRARY)
diff --git a/common/device-side/preconditions/Android.bp b/common/device-side/preconditions/Android.bp
new file mode 100644
index 0000000..64f0ab0
--- /dev/null
+++ b/common/device-side/preconditions/Android.bp
@@ -0,0 +1,23 @@
+// Copyright (C) 2015 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+java_library {
+    name: "compatibility-device-preconditions",
+
+    srcs: ["src/**/*.java"],
+
+    static_libs: ["compatibility-common-util-devicesidelib"],
+
+    sdk_version: "current",
+}
diff --git a/common/device-side/preconditions/Android.mk b/common/device-side/preconditions/Android.mk
deleted file mode 100644
index 75c981b..0000000
--- a/common/device-side/preconditions/Android.mk
+++ /dev/null
@@ -1,31 +0,0 @@
-# Copyright (C) 2015 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-LOCAL_PATH := $(call my-dir)
-
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_STATIC_JAVA_LIBRARIES := compatibility-common-util-devicesidelib
-
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_MODULE := compatibility-device-preconditions
-
-LOCAL_SDK_VERSION := current
-
-include $(BUILD_STATIC_JAVA_LIBRARY)
-
-include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/common/device-side/test-app/Android.bp b/common/device-side/test-app/Android.bp
new file mode 100644
index 0000000..a4e39e9
--- /dev/null
+++ b/common/device-side/test-app/Android.bp
@@ -0,0 +1,38 @@
+// Copyright (C) 2015 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// Build an APK which contains the device-side libraries and their tests,
+// this then gets instrumented in order to test the aforementioned libraries.
+
+android_test {
+    name: "CompatibilityTestApp",
+
+    dex_preopt: {
+        enabled: false,
+    },
+    optimize: {
+        enabled: false,
+    },
+
+    static_libs: [
+        "android-support-test",
+        "compatibility-common-util-devicesidelib",
+        "compatibility-device-info-tests",
+        "compatibility-device-info",
+        "compatibility-device-util-tests",
+        "compatibility-device-util",
+    ],
+
+    sdk_version: "test_current",
+}
diff --git a/common/device-side/test-app/Android.mk b/common/device-side/test-app/Android.mk
deleted file mode 100755
index 6adce97..0000000
--- a/common/device-side/test-app/Android.mk
+++ /dev/null
@@ -1,40 +0,0 @@
-# Copyright (C) 2015 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-# Build an APK which contains the device-side libraries and their tests,
-# this then gets instrumented in order to test the aforementioned libraries.
-
-LOCAL_PATH:= $(call my-dir)
-
-include $(CLEAR_VARS)
-
-LOCAL_DEX_PREOPT := false
-LOCAL_PROGUARD_ENABLED := disabled
-# don't include this package in any target
-LOCAL_MODULE_TAGS := optional
-# and when built explicitly put it in the data partition
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test\
-    compatibility-common-util-devicesidelib\
-    compatibility-device-info-tests\
-    compatibility-device-info\
-    compatibility-device-util-tests\
-    compatibility-device-util
-
-LOCAL_PACKAGE_NAME := CompatibilityTestApp
-
-LOCAL_SDK_VERSION := current
-
-include $(BUILD_PACKAGE)
diff --git a/common/device-side/util/Android.mk b/common/device-side/util/Android.mk
deleted file mode 100644
index a8b6af7..0000000
--- a/common/device-side/util/Android.mk
+++ /dev/null
@@ -1,15 +0,0 @@
-# Copyright (C) 2014 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-include $(call all-subdir-makefiles)
diff --git a/common/device-side/util/tests/Android.bp b/common/device-side/util/tests/Android.bp
new file mode 100644
index 0000000..e38f0f4
--- /dev/null
+++ b/common/device-side/util/tests/Android.bp
@@ -0,0 +1,26 @@
+// Copyright (C) 2015 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+java_test {
+    name: "compatibility-device-util-tests",
+
+    srcs: ["src/**/*.java"],
+
+    static_libs: [
+        "compatibility-device-util",
+        "junit",
+    ],
+
+    sdk_version: "test_current",
+}
diff --git a/common/device-side/util/tests/Android.mk b/common/device-side/util/tests/Android.mk
deleted file mode 100644
index a073b9a..0000000
--- a/common/device-side/util/tests/Android.mk
+++ /dev/null
@@ -1,29 +0,0 @@
-# Copyright (C) 2015 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-LOCAL_PATH:= $(call my-dir)
-
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_STATIC_JAVA_LIBRARIES := compatibility-device-util junit
-
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_MODULE := compatibility-device-util-tests
-
-LOCAL_SDK_VERSION := current
-
-include $(BUILD_STATIC_JAVA_LIBRARY)
diff --git a/hostsidetests/api/Android.mk b/hostsidetests/api/Android.mk
index 63cb700..b26fab0 100644
--- a/hostsidetests/api/Android.mk
+++ b/hostsidetests/api/Android.mk
@@ -23,7 +23,7 @@
 LOCAL_SRC_FILES := $(call all-java-files-under, src)
 LOCAL_SDK_VERSION := current
 LOCAL_JAVA_LIBRARIES := cts-tradefed tradefed compatibility-host-util
-LOCAL_STATIC_JAVA_LIBRARIES := dexlib2 doclava jsilver guavalib antlr-runtime host-jdk-tools-prebuilt \
+LOCAL_STATIC_JAVA_LIBRARIES := dexlib2 doclava jsilver guava antlr-runtime host-jdk-tools-prebuilt \
     compatibility-host-util
 
 # These are list of api txt files that are considered as approved APIs
diff --git a/hostsidetests/compilation/Android.mk b/hostsidetests/compilation/Android.mk
index 09c8507..c63c341 100644
--- a/hostsidetests/compilation/Android.mk
+++ b/hostsidetests/compilation/Android.mk
@@ -29,7 +29,7 @@
 
 LOCAL_JAVA_LIBRARIES := cts-tradefed tradefed compatibility-host-util
 
-LOCAL_STATIC_JAVA_LIBRARIES := guavalib
+LOCAL_STATIC_JAVA_LIBRARIES := guava
 
 include $(BUILD_HOST_JAVA_LIBRARY)
 
diff --git a/hostsidetests/inputmethodservice/common/Android.mk b/hostsidetests/inputmethodservice/common/Android.mk
index 94b59c9..a118474 100644
--- a/hostsidetests/inputmethodservice/common/Android.mk
+++ b/hostsidetests/inputmethodservice/common/Android.mk
@@ -41,7 +41,7 @@
 include $(CLEAR_VARS)
 
 LOCAL_SRC_FILES := $(call all-java-files-under, src)
-LOCAL_JAVA_LIBRARIES := junit-host
+LOCAL_JAVA_LIBRARIES := junit
 
 LOCAL_MODULE_TAGS := tests
 
diff --git a/libs/Android.mk b/libs/Android.mk
deleted file mode 100644
index 4343259..0000000
--- a/libs/Android.mk
+++ /dev/null
@@ -1,17 +0,0 @@
-#
-# Copyright (C) 2010 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-include $(call all-subdir-makefiles)
diff --git a/libs/json/Android.bp b/libs/json/Android.bp
new file mode 100644
index 0000000..59a9f3a
--- /dev/null
+++ b/libs/json/Android.bp
@@ -0,0 +1,28 @@
+//
+// Copyright (C) 2010 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+java_library {
+    name: "json",
+    host_supported: true,
+    srcs: ["src/**/*.java"],
+    sdk_version: "current",
+}
+
+// Compatibility version of host library
+java_library_host {
+    name: "jsonlib",
+    static_libs: ["json"],
+}
diff --git a/libs/json/Android.mk b/libs/json/Android.mk
deleted file mode 100644
index d1b2051..0000000
--- a/libs/json/Android.mk
+++ /dev/null
@@ -1,39 +0,0 @@
-#
-# Copyright (C) 2010 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-LOCAL_PATH:= $(call my-dir)
-
-# Build the host library
-# ======================
-include $(CLEAR_VARS)
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_MODULE := jsonlib
-LOCAL_MODULE_TAGS := optional
-
-include $(BUILD_HOST_JAVA_LIBRARY)
-
-# Build the target library
-# =======================
-include $(CLEAR_VARS)
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_MODULE := json
-LOCAL_MODULE_TAGS := optional
-LOCAL_SDK_VERSION := current
-
-include $(BUILD_STATIC_JAVA_LIBRARY)
-
diff --git a/libs/runner/Android.bp b/libs/runner/Android.bp
new file mode 100644
index 0000000..5ec51ef
--- /dev/null
+++ b/libs/runner/Android.bp
@@ -0,0 +1,22 @@
+// Copyright (C) 2012 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+java_library {
+    name: "ctstestrunner",
+
+    static_libs: ["cts-test-runner"],
+
+    sdk_version: "current",
+
+}
diff --git a/libs/runner/Android.mk b/libs/runner/Android.mk
deleted file mode 100644
index 15f64a3..0000000
--- a/libs/runner/Android.mk
+++ /dev/null
@@ -1,27 +0,0 @@
-# Copyright (C) 2012 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-LOCAL_PATH:= $(call my-dir)
-
-include $(CLEAR_VARS)
-
-LOCAL_STATIC_JAVA_LIBRARIES := cts-test-runner
-
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_MODULE := ctstestrunner
-
-LOCAL_SDK_VERSION := current
-
-include $(BUILD_STATIC_JAVA_LIBRARY)
diff --git a/libs/testserver/Android.bp b/libs/testserver/Android.bp
new file mode 100644
index 0000000..14b9ed4
--- /dev/null
+++ b/libs/testserver/Android.bp
@@ -0,0 +1,22 @@
+// Copyright (C) 2012 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+java_library {
+    name: "ctstestserver",
+
+    srcs: ["src/**/*.java"],
+
+    sdk_version: "16",
+
+}
diff --git a/libs/testserver/Android.mk b/libs/testserver/Android.mk
deleted file mode 100644
index 488af53..0000000
--- a/libs/testserver/Android.mk
+++ /dev/null
@@ -1,27 +0,0 @@
-# Copyright (C) 2012 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-LOCAL_PATH:= $(call my-dir)
-
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_MODULE := ctstestserver
-
-LOCAL_SDK_VERSION := 16
-
-include $(BUILD_STATIC_JAVA_LIBRARY)
diff --git a/libs/view/Android.bp b/libs/view/Android.bp
new file mode 100644
index 0000000..c58c3ca
--- /dev/null
+++ b/libs/view/Android.bp
@@ -0,0 +1,24 @@
+//
+// Copyright (C) 2015 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+java_library {
+    name: "cts-view-lib",
+
+    srcs: ["src/**/*.java"],
+
+    sdk_version: "current",
+
+}
diff --git a/libs/view/Android.mk b/libs/view/Android.mk
deleted file mode 100644
index 0b121da..0000000
--- a/libs/view/Android.mk
+++ /dev/null
@@ -1,25 +0,0 @@
-#
-# Copyright (C) 2015 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-LOCAL_MODULE := cts-view-lib
-LOCAL_MODULE_TAGS := optional
-LOCAL_SDK_VERSION := current
-
-include $(BUILD_STATIC_JAVA_LIBRARY)
diff --git a/libs/vogar-expect/Android.bp b/libs/vogar-expect/Android.bp
new file mode 100644
index 0000000..6a48828
--- /dev/null
+++ b/libs/vogar-expect/Android.bp
@@ -0,0 +1,33 @@
+//
+// Copyright (C) 2010 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+java_library {
+    name: "vogarexpect",
+    host_supported: true,
+    srcs: ["src/**/*.java"],
+
+    sdk_version: "current",
+
+    static_libs: [
+        "guava",
+        "json",
+    ],
+}
+
+java_library_host {
+    name: "vogarexpectlib",
+    static_libs: ["vogarexpect"],
+}
diff --git a/libs/vogar-expect/Android.mk b/libs/vogar-expect/Android.mk
deleted file mode 100644
index f888d26..0000000
--- a/libs/vogar-expect/Android.mk
+++ /dev/null
@@ -1,39 +0,0 @@
-#
-# Copyright (C) 2010 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-LOCAL_PATH:= $(call my-dir)
-
-# Build the host library
-# ======================
-include $(CLEAR_VARS)
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-LOCAL_MODULE := vogarexpectlib
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_STATIC_JAVA_LIBRARIES := guavalib jsonlib
-include $(BUILD_HOST_JAVA_LIBRARY)
-
-# Build the target library
-# =======================
-include $(CLEAR_VARS)
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-LOCAL_MODULE := vogarexpect
-LOCAL_MODULE_TAGS := optional
-LOCAL_SDK_VERSION := current
-
-LOCAL_STATIC_JAVA_LIBRARIES := guava json
-include $(BUILD_STATIC_JAVA_LIBRARY)
-
diff --git a/tests/core/runner/Android.bp b/tests/core/runner/Android.bp
new file mode 100644
index 0000000..de3d724
--- /dev/null
+++ b/tests/core/runner/Android.bp
@@ -0,0 +1,48 @@
+// Copyright (C) 2009 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+//==========================================================
+// Build the core runner.
+//==========================================================
+
+// Build library
+java_library {
+    name: "cts-core-test-runner",
+
+    srcs: ["src/**/*.java"],
+    static_libs: [
+        "compatibility-device-util",
+        "android-support-test",
+        "vogarexpect",
+        "testng",
+    ],
+
+    libs: ["android.test.runner.stubs"],
+    sdk_version: "test_current",
+
+}
+
+//==========================================================
+// Build the run listener
+//==========================================================
+
+// Build library
+java_library {
+    name: "cts-test-runner",
+
+    srcs: ["src/com/android/cts/runner/**/*.java"],
+    static_libs: ["android-support-test"],
+    sdk_version: "current",
+
+}
diff --git a/tests/core/runner/Android.mk b/tests/core/runner/Android.mk
deleted file mode 100644
index e2d5047..0000000
--- a/tests/core/runner/Android.mk
+++ /dev/null
@@ -1,51 +0,0 @@
-# Copyright (C) 2009 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-LOCAL_PATH:= $(call my-dir)
-
-#==========================================================
-# Build the core runner.
-#==========================================================
-
-# Build library
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := optional
-LOCAL_SRC_FILES := $(call all-java-files-under,src)
-LOCAL_MODULE := cts-core-test-runner
-LOCAL_STATIC_JAVA_LIBRARIES := \
-    compatibility-device-util \
-    android-support-test \
-    vogarexpect \
-    testng
-
-LOCAL_JAVA_LIBRARIES := android.test.runner.stubs
-LOCAL_SDK_VERSION := current
-
-include $(BUILD_STATIC_JAVA_LIBRARY)
-
-#==========================================================
-# Build the run listener
-#==========================================================
-
-# Build library
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := optional
-LOCAL_SRC_FILES := $(call all-java-files-under,src/com/android/cts/runner)
-LOCAL_MODULE := cts-test-runner
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test
-LOCAL_SDK_VERSION := current
-
-include $(BUILD_STATIC_JAVA_LIBRARY)
diff --git a/tests/jdwp/runner/host-side/Android.mk b/tests/jdwp/runner/host-side/Android.mk
index 32abf79..5fb12a2 100644
--- a/tests/jdwp/runner/host-side/Android.mk
+++ b/tests/jdwp/runner/host-side/Android.mk
@@ -22,7 +22,7 @@
 
 LOCAL_JAVA_LIBRARIES := cts-tradefed tradefed compatibility-host-util
 
-LOCAL_STATIC_JAVA_LIBRARIES := vogarexpectlib
+LOCAL_STATIC_JAVA_LIBRARIES := vogarexpect
 
 # don't include these packages in any target
 LOCAL_MODULE_TAGS := optional
diff --git a/tools/utils/Android.mk b/tools/utils/Android.mk
index 6b01e57..e2ce007 100644
--- a/tools/utils/Android.mk
+++ b/tools/utils/Android.mk
@@ -24,7 +24,7 @@
 
 LOCAL_CLASSPATH := $(HOST_JDK_TOOLS_JAR)
 
-LOCAL_JAVA_LIBRARIES := junit-host tradefed
-LOCAL_STATIC_JAVA_LIBRARIES := compatibility-host-util vogarexpectlib
+LOCAL_JAVA_LIBRARIES := junit tradefed
+LOCAL_STATIC_JAVA_LIBRARIES := compatibility-host-util vogarexpect
 
 include $(BUILD_HOST_JAVA_LIBRARY)
diff --git a/tools/vm-tests-tf/Android.mk b/tools/vm-tests-tf/Android.mk
index 539582f..34a81de 100644
--- a/tools/vm-tests-tf/Android.mk
+++ b/tools/vm-tests-tf/Android.mk
@@ -43,7 +43,7 @@
 LOCAL_MODULE_CLASS := JAVA_LIBRARIES
 LOCAL_MODULE_TAGS := optional
 
-LOCAL_JAVA_LIBRARIES := dx dasm junit-host jsr305lib d8 smali
+LOCAL_JAVA_LIBRARIES := dx dasm junit jsr305 d8 smali
 
 LOCAL_CLASSPATH := $(HOST_JDK_TOOLS_JAR)
 
@@ -72,7 +72,7 @@
 vmteststf_dep_jars := \
     $(HOST_JDK_TOOLS_JAR) \
     $(cts-tf-dalvik-lib.jar) \
-    $(addprefix $(HOST_OUT_JAVA_LIBRARIES)/, cts-tf-dalvik-buildutil.jar dx.jar junit-host.jar d8.jar smali.jar) \
+    $(addprefix $(HOST_OUT_JAVA_LIBRARIES)/, cts-tf-dalvik-buildutil.jar dx.jar junit.jar d8.jar smali.jar) \
     $(call intermediates-dir-for,JAVA_LIBRARIES,cts-vmtests-dot,HOST,COMMON)/classes.jar
 
 vmtests_generated_resources_jar := \