Convert to Android.bp

See build/soong/README.md for more information

Test: mmma hardware/libhardware
Change-Id: Ibb7e2af9d55f581e951d8996cea5e52cd0766b04
diff --git a/tests/Android.mk b/tests/Android.mk
deleted file mode 100644
index 5053e7d..0000000
--- a/tests/Android.mk
+++ /dev/null
@@ -1 +0,0 @@
-include $(call all-subdir-makefiles)
diff --git a/tests/camera3/Android.bp b/tests/camera3/Android.bp
new file mode 100644
index 0000000..55486ba
--- /dev/null
+++ b/tests/camera3/Android.bp
@@ -0,0 +1,16 @@
+cc_test {
+    name: "camera3_tests",
+    srcs: ["camera3tests.cpp"],
+
+    shared_libs: [
+        "liblog",
+        "libhardware",
+        "libcamera_metadata",
+    ],
+
+    cflags: [
+        "-Wall",
+        "-Wextra",
+        "-Werror",
+    ],
+}
diff --git a/tests/camera3/Android.mk b/tests/camera3/Android.mk
deleted file mode 100644
index fbfde68..0000000
--- a/tests/camera3/Android.mk
+++ /dev/null
@@ -1,20 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES:= \
-    camera3tests.cpp \
-
-LOCAL_SHARED_LIBRARIES := \
-    liblog \
-    libhardware \
-    libcamera_metadata \
-
-LOCAL_C_INCLUDES += \
-    system/media/camera/include \
-
-LOCAL_CFLAGS += -Wall -Wextra -Werror
-
-LOCAL_MODULE:= camera3_tests
-LOCAL_MODULE_TAGS := tests
-
-include $(BUILD_NATIVE_TEST)
diff --git a/tests/hardware/Android.bp b/tests/hardware/Android.bp
new file mode 100644
index 0000000..2f5db12
--- /dev/null
+++ b/tests/hardware/Android.bp
@@ -0,0 +1,16 @@
+cc_library_static {
+    name: "static-hal-check",
+    srcs: [
+        "struct-size.cpp",
+        "struct-offset.cpp",
+        "struct-last.cpp",
+    ],
+    shared_libs: ["libhardware"],
+    cflags: [
+        "-O0",
+        "-Wall",
+        "-Werror",
+    ],
+
+    include_dirs: ["system/media/camera/include"],
+}
diff --git a/tests/hardware/Android.mk b/tests/hardware/Android.mk
deleted file mode 100644
index 02a3596..0000000
--- a/tests/hardware/Android.mk
+++ /dev/null
@@ -1,12 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_MODULE := static-hal-check
-LOCAL_SRC_FILES := struct-size.cpp struct-offset.cpp struct-last.cpp
-LOCAL_SHARED_LIBRARIES := libhardware
-LOCAL_CFLAGS := -O0 -Wall -Werror
-
-LOCAL_C_INCLUDES += \
-    system/media/camera/include
-
-include $(BUILD_STATIC_LIBRARY)
diff --git a/tests/hwc/Android.bp b/tests/hwc/Android.bp
new file mode 100644
index 0000000..782a314
--- /dev/null
+++ b/tests/hwc/Android.bp
@@ -0,0 +1,37 @@
+cc_library_static {
+    name: "libcnativewindow",
+    srcs: [
+        "cnativewindow.c",
+        "util.c",
+    ],
+    cflags: [
+        "-Wall",
+        "-Werror",
+        "-Wno-unused-parameter",
+    ],
+    shared_libs: [
+        "libEGL",
+        "libGLESv2",
+        "libdl",
+        "libhardware",
+        "libnativewindow",
+    ],
+}
+
+cc_binary {
+    name: "hwc-test-arrows",
+    srcs: ["test-arrows.c"],
+    static_libs: ["libcnativewindow"],
+    shared_libs: [
+        "libEGL",
+        "libGLESv2",
+        "libdl",
+        "libhardware",
+        "libnativewindow",
+    ],
+    cflags: [
+        "-DGL_GLEXT_PROTOTYPES",
+        "-Wall",
+        "-Werror",
+    ],
+}
diff --git a/tests/hwc/Android.mk b/tests/hwc/Android.mk
deleted file mode 100644
index a5f59f1..0000000
--- a/tests/hwc/Android.mk
+++ /dev/null
@@ -1,16 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-
-include $(CLEAR_VARS)
-LOCAL_MODULE := libcnativewindow
-LOCAL_SRC_FILES := cnativewindow.c util.c
-LOCAL_CFLAGS := -Wall -Werror -Wno-unused-parameter
-LOCAL_SHARED_LIBRARIES := libEGL libGLESv2 libdl libhardware libnativewindow
-include $(BUILD_STATIC_LIBRARY)
-
-include $(CLEAR_VARS)
-LOCAL_MODULE := hwc-test-arrows
-LOCAL_SRC_FILES := test-arrows.c
-LOCAL_STATIC_LIBRARIES := libcnativewindow
-LOCAL_SHARED_LIBRARIES := libEGL libGLESv2 libdl libhardware libnativewindow
-LOCAL_CFLAGS := -DGL_GLEXT_PROTOTYPES -Wall -Werror
-include $(BUILD_EXECUTABLE)
diff --git a/tests/input/Android.mk b/tests/input/Android.mk
deleted file mode 100644
index 3011b2e..0000000
--- a/tests/input/Android.mk
+++ /dev/null
@@ -1,19 +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)
-
-include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/tests/input/evdev/Android.bp b/tests/input/evdev/Android.bp
new file mode 100644
index 0000000..fa03a00
--- /dev/null
+++ b/tests/input/evdev/Android.bp
@@ -0,0 +1,33 @@
+cc_test {
+    name: "libinput_evdevtests",
+
+    srcs: [
+        "BitUtils_test.cpp",
+        "InputDevice_test.cpp",
+        "InputHub_test.cpp",
+        "InputMocks.cpp",
+        "MouseInputMapper_test.cpp",
+        "SwitchInputMapper_test.cpp",
+        "TestHelpers.cpp",
+    ],
+
+    static_libs: ["libgmock"],
+
+    shared_libs: [
+        "libinput_evdev",
+        "liblog",
+        "libutils",
+    ],
+
+    cflags: [
+        "-Wall",
+        "-Wextra",
+        "-Werror",
+        "-Wno-unused-parameter",
+
+        // TestHelpers uses mktemp. As the path is given to TempFile, we can't do too much
+        // here (e.g., use mkdtemp first). At least races will lead to an early failure, as
+        // mkfifo fails on existing files.
+        "-Wno-deprecated-declarations",
+    ],
+}
diff --git a/tests/input/evdev/Android.mk b/tests/input/evdev/Android.mk
deleted file mode 100644
index b09a8ac..0000000
--- a/tests/input/evdev/Android.mk
+++ /dev/null
@@ -1,33 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_C_INCLUDES += hardware/libhardware/modules/input/evdev
-
-LOCAL_SRC_FILES:= \
-    BitUtils_test.cpp \
-    InputDevice_test.cpp \
-    InputHub_test.cpp \
-    InputMocks.cpp \
-    MouseInputMapper_test.cpp \
-    SwitchInputMapper_test.cpp \
-    TestHelpers.cpp
-
-LOCAL_STATIC_LIBRARIES := libgmock
-
-LOCAL_SHARED_LIBRARIES := \
-    libinput_evdev \
-    liblog \
-    libutils
-
-LOCAL_CLANG := true
-LOCAL_CFLAGS += -Wall -Wextra -Werror -Wno-unused-parameter
-
-# TestHelpers uses mktemp. As the path is given to TempFile, we can't do too much
-# here (e.g., use mkdtemp first). At least races will lead to an early failure, as
-# mkfifo fails on existing files.
-LOCAL_CFLAGS += -Wno-deprecated-declarations
-
-LOCAL_MODULE := libinput_evdevtests
-LOCAL_MODULE_TAGS := tests
-
-include $(BUILD_NATIVE_TEST)
diff --git a/tests/keymaster/Android.bp b/tests/keymaster/Android.bp
new file mode 100644
index 0000000..8c027e0
--- /dev/null
+++ b/tests/keymaster/Android.bp
@@ -0,0 +1,17 @@
+// Build the keymaster unit tests
+cc_test {
+    name: "keymaster_test",
+    srcs: ["keymaster_test.cpp"],
+
+    shared_libs: [
+        "liblog",
+        "libutils",
+        "libcrypto",
+        "libhardware",
+    ],
+
+    cflags: [
+        "-Wall",
+        "-Werror",
+    ],
+}
diff --git a/tests/keymaster/Android.mk b/tests/keymaster/Android.mk
deleted file mode 100644
index 173fccc..0000000
--- a/tests/keymaster/Android.mk
+++ /dev/null
@@ -1,21 +0,0 @@
-# Build the keymaster unit tests
-
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES:= \
-    keymaster_test.cpp
-
-LOCAL_SHARED_LIBRARIES := \
-    liblog \
-    libutils \
-    libcrypto \
-    libhardware \
-
-LOCAL_MODULE := keymaster_test
-
-LOCAL_CFLAGS := -Wall -Werror
-
-LOCAL_MODULE_TAGS := tests
-
-include $(BUILD_NATIVE_TEST)
diff --git a/tests/vehicle/Android.bp b/tests/vehicle/Android.bp
new file mode 100644
index 0000000..cbe2a11
--- /dev/null
+++ b/tests/vehicle/Android.bp
@@ -0,0 +1,48 @@
+//
+//  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 native tests.
+cc_test {
+    name: "vehicle_tests",
+    srcs: ["vehicle_tests.cpp"],
+
+    shared_libs: [
+        "liblog",
+        "libhardware",
+    ],
+
+    cflags: [
+        "-Wall",
+        "-Wextra",
+        "-Werror",
+    ],
+}
+
+// Build HAL command line utility.
+cc_binary {
+    name: "vehicle-hal-tool",
+    srcs: ["vehicle-hal-tool.c"],
+    cflags: [
+        "-Wall",
+        "-Wno-unused-parameter",
+        "-Werror",
+    ],
+
+    shared_libs: [
+        "libcutils",
+        "libhardware",
+        "liblog",
+    ],
+}
diff --git a/tests/vehicle/Android.mk b/tests/vehicle/Android.mk
deleted file mode 100644
index ab412fb..0000000
--- a/tests/vehicle/Android.mk
+++ /dev/null
@@ -1,45 +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)
-
-# Build native tests.
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES:= \
-    vehicle_tests.cpp \
-
-LOCAL_SHARED_LIBRARIES := \
-    liblog \
-    libhardware \
-
-LOCAL_CFLAGS += -Wall -Wextra -Werror
-
-LOCAL_MODULE:= vehicle_tests
-LOCAL_MODULE_TAGS := tests
-
-include $(BUILD_NATIVE_TEST)
-
-# Build HAL command line utility.
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES := vehicle-hal-tool.c
-LOCAL_MODULE := vehicle-hal-tool
-LOCAL_CFLAGS := -Wall -Wno-unused-parameter -Werror
-LOCAL_MODULE_TAGS := tests
-
-LOCAL_SHARED_LIBRARIES := libcutils libhardware liblog
-
-include $(BUILD_EXECUTABLE)