Merge "Convert cpp_api/../Android.mk to Android.bp" am: cee1aae4a8

Original change: https://android-review.googlesource.com/c/platform/frameworks/rs/+/1850847

Change-Id: I496062465a501943d8f5b04c2e5fb8fceddcb010
diff --git a/tests/cpp_api/Android.bp b/tests/cpp_api/Android.bp
new file mode 100644
index 0000000..9c3632a
--- /dev/null
+++ b/tests/cpp_api/Android.bp
@@ -0,0 +1,31 @@
+// Copyright (C) 2021 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.
+//
+
+package {
+    // See: http://go/android-license-faq
+    default_applicable_licenses: ["Android-Apache-2.0"],
+}
+
+cc_defaults {
+    name: "frameworks_rs_tests_cpp-api-defaults",
+    shared_libs: ["liblog"],
+    cflags: [
+        "-Werror",
+        "-Wall",
+        "-Wextra",
+    ],
+    header_libs: ["rs-headers"],
+}
+
diff --git a/tests/cpp_api/Android.mk b/tests/cpp_api/Android.mk
deleted file mode 100644
index 6145a3d..0000000
--- a/tests/cpp_api/Android.mk
+++ /dev/null
@@ -1,3 +0,0 @@
-LOCAL_PATH:=$(call my-dir)
-
-include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/tests/cpp_api/common.mk b/tests/cpp_api/common.mk
deleted file mode 100644
index 9bad790..0000000
--- a/tests/cpp_api/common.mk
+++ /dev/null
@@ -1,7 +0,0 @@
-LOCAL_MODULE_TAGS := tests
-
-LOCAL_CFLAGS += -Werror -Wall -Wextra
-LOCAL_LDFLAGS +=  -llog
-
-intermediates := $(call intermediates-dir-for,STATIC_LIBRARIES,libRS,TARGET,)
-LOCAL_C_INCLUDES += $(intermediates)
diff --git a/tests/cpp_api/cpp-globalguard/Android.bp b/tests/cpp_api/cpp-globalguard/Android.bp
new file mode 100644
index 0000000..c0ac0f9
--- /dev/null
+++ b/tests/cpp_api/cpp-globalguard/Android.bp
@@ -0,0 +1,34 @@
+//
+// Copyright (C) 2021 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.
+//
+
+package {
+    // See: http://go/android-license-faq
+    default_applicable_licenses: [
+        "Android-Apache-2.0",
+    ],
+}
+
+cc_binary {
+    name: "rstest-cpp-globalguard",
+    defaults: ["frameworks_rs_tests_cpp-api-defaults"],
+    sdk_version: "21",
+    stl: "c++_static",
+    srcs: [
+        "multiply.rscript",
+        "compute.cpp",
+    ],
+    static_libs: ["libRScpp_static"],
+}
diff --git a/tests/cpp_api/cpp-globalguard/Android.mk b/tests/cpp_api/cpp-globalguard/Android.mk
deleted file mode 100644
index 88a10c9..0000000
--- a/tests/cpp_api/cpp-globalguard/Android.mk
+++ /dev/null
@@ -1,21 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_MODULE:= rstest-cpp-globalguard
-LOCAL_LICENSE_KINDS:= SPDX-license-identifier-Apache-2.0
-LOCAL_LICENSE_CONDITIONS:= notice
-
-LOCAL_SDK_VERSION := 21
-LOCAL_NDK_STL_VARIANT := c++_static
-
-LOCAL_SRC_FILES:= \
-	multiply.rscript \
-	compute.cpp
-
-LOCAL_STATIC_LIBRARIES := \
-	libRScpp_static
-
-LOCAL_LDFLAGS += -llog
-
-include frameworks/rs/tests/cpp_api/common.mk
-include $(BUILD_EXECUTABLE)
diff --git a/tests/cpp_api/cppallocation/Android.bp b/tests/cpp_api/cppallocation/Android.bp
new file mode 100644
index 0000000..210969b
--- /dev/null
+++ b/tests/cpp_api/cppallocation/Android.bp
@@ -0,0 +1,32 @@
+//
+// Copyright (C) 2021 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.
+//
+
+package {
+    // See: http://go/android-license-faq
+    default_applicable_licenses: ["Android-Apache-2.0"],
+}
+
+cc_binary {
+    name: "rstest-cppallocation",
+    defaults: ["frameworks_rs_tests_cpp-api-defaults"],
+    sdk_version: "21",
+    stl: "c++_static",
+    srcs: [
+        "multiply.rscript",
+        "compute.cpp",
+    ],
+    static_libs: ["libRScpp_static"],
+}
diff --git a/tests/cpp_api/cppallocation/Android.mk b/tests/cpp_api/cppallocation/Android.mk
deleted file mode 100644
index d2c7cbc..0000000
--- a/tests/cpp_api/cppallocation/Android.mk
+++ /dev/null
@@ -1,21 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_MODULE:= rstest-cppallocation
-LOCAL_LICENSE_KINDS:= SPDX-license-identifier-Apache-2.0
-LOCAL_LICENSE_CONDITIONS:= notice
-
-LOCAL_SDK_VERSION := 21
-LOCAL_NDK_STL_VARIANT := c++_static
-
-LOCAL_SRC_FILES:= \
-	multiply.rscript \
-	compute.cpp
-
-LOCAL_STATIC_LIBRARIES := \
-	libRScpp_static
-
-LOCAL_LDFLAGS += -llog
-
-include frameworks/rs/tests/cpp_api/common.mk
-include $(BUILD_EXECUTABLE)
diff --git a/tests/cpp_api/cppbasic-getpointer/Android.bp b/tests/cpp_api/cppbasic-getpointer/Android.bp
new file mode 100644
index 0000000..203a8c9
--- /dev/null
+++ b/tests/cpp_api/cppbasic-getpointer/Android.bp
@@ -0,0 +1,32 @@
+//
+// Copyright (C) 2021 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.
+//
+
+package {
+    // See: http://go/android-license-faq
+    default_applicable_licenses: [
+        "Android-Apache-2.0",
+    ],
+}
+
+cc_binary {
+    name: "rstest-compute-getpointer",
+    defaults: ["frameworks_rs_tests_cpp-api-defaults"],
+    srcs: [
+        "mono.rscript",
+        "compute.cpp",
+    ],
+    shared_libs: ["libRScpp"],
+}
diff --git a/tests/cpp_api/cppbasic-getpointer/Android.mk b/tests/cpp_api/cppbasic-getpointer/Android.mk
deleted file mode 100644
index 963a3e4..0000000
--- a/tests/cpp_api/cppbasic-getpointer/Android.mk
+++ /dev/null
@@ -1,18 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_MODULE:= rstest-compute-getpointer
-LOCAL_LICENSE_KINDS:= SPDX-license-identifier-Apache-2.0
-LOCAL_LICENSE_CONDITIONS:= notice
-
-LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
-
-LOCAL_SRC_FILES:= \
-	mono.rscript \
-	compute.cpp
-
-LOCAL_SHARED_LIBRARIES := \
-	libRScpp
-
-include frameworks/rs/tests/cpp_api/common.mk
-include $(BUILD_EXECUTABLE)
diff --git a/tests/cpp_api/cppbasic-shared/Android.bp b/tests/cpp_api/cppbasic-shared/Android.bp
new file mode 100644
index 0000000..0b49d86
--- /dev/null
+++ b/tests/cpp_api/cppbasic-shared/Android.bp
@@ -0,0 +1,32 @@
+//
+// Copyright (C) 2021 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.
+//
+
+package {
+    // See: http://go/android-license-faq
+    default_applicable_licenses: [
+        "Android-Apache-2.0",
+    ],
+}
+
+cc_binary {
+    name: "rstest-compute-shared",
+    defaults: ["frameworks_rs_tests_cpp-api-defaults"],
+    srcs: [
+        "mono.rscript",
+        "compute.cpp",
+    ],
+    shared_libs: ["libRScpp"],
+}
diff --git a/tests/cpp_api/cppbasic-shared/Android.mk b/tests/cpp_api/cppbasic-shared/Android.mk
deleted file mode 100644
index ca91745..0000000
--- a/tests/cpp_api/cppbasic-shared/Android.mk
+++ /dev/null
@@ -1,18 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_MODULE:= rstest-compute-shared
-LOCAL_LICENSE_KINDS:= SPDX-license-identifier-Apache-2.0
-LOCAL_LICENSE_CONDITIONS:= notice
-
-LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
-
-LOCAL_SRC_FILES:= \
-	mono.rscript \
-	compute.cpp
-
-LOCAL_SHARED_LIBRARIES := \
-	libRScpp
-
-include frameworks/rs/tests/cpp_api/common.mk
-include $(BUILD_EXECUTABLE)
diff --git a/tests/cpp_api/cppbasic/Android.bp b/tests/cpp_api/cppbasic/Android.bp
new file mode 100644
index 0000000..d6723ca
--- /dev/null
+++ b/tests/cpp_api/cppbasic/Android.bp
@@ -0,0 +1,34 @@
+//
+// Copyright (C) 2021 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.
+//
+
+package {
+    // See: http://go/android-license-faq
+    default_applicable_licenses: [
+        "Android-Apache-2.0",
+    ],
+}
+
+cc_binary {
+    name: "rstest-compute",
+    defaults: ["frameworks_rs_tests_cpp-api-defaults"],
+    sdk_version: "21",
+    stl: "c++_static",
+    srcs: [
+        "mono.rscript",
+        "compute.cpp",
+    ],
+    static_libs: ["libRScpp_static"],
+}
diff --git a/tests/cpp_api/cppbasic/Android.mk b/tests/cpp_api/cppbasic/Android.mk
deleted file mode 100644
index a1f090f..0000000
--- a/tests/cpp_api/cppbasic/Android.mk
+++ /dev/null
@@ -1,19 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_MODULE:= rstest-compute
-LOCAL_LICENSE_KINDS:= SPDX-license-identifier-Apache-2.0
-LOCAL_LICENSE_CONDITIONS:= notice
-
-LOCAL_SDK_VERSION := 21
-LOCAL_NDK_STL_VARIANT := c++_static
-
-LOCAL_SRC_FILES:= \
-	mono.rscript \
-	compute.cpp
-
-LOCAL_STATIC_LIBRARIES := \
-	libRScpp_static
-
-include frameworks/rs/tests/cpp_api/common.mk
-include $(BUILD_EXECUTABLE)
diff --git a/tests/cpp_api/cppf16/Android.bp b/tests/cpp_api/cppf16/Android.bp
new file mode 100644
index 0000000..4aaca31
--- /dev/null
+++ b/tests/cpp_api/cppf16/Android.bp
@@ -0,0 +1,33 @@
+//
+// Copyright (C) 2021 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.
+//
+
+package {
+    // See: http://go/android-license-faq
+    default_applicable_licenses: [
+        "Android-Apache-2.0",
+    ],
+}
+
+cc_binary {
+    name: "rstest-cppf16",
+    defaults: ["frameworks_rs_tests_cpp-api-defaults"],
+    stl: "c++_static",
+    srcs: ["compute.cpp"],
+    static_libs: ["libRScpp_static"],
+    shared_libs: [
+        "libdl",
+    ],
+}
diff --git a/tests/cpp_api/cppf16/Android.mk b/tests/cpp_api/cppf16/Android.mk
deleted file mode 100644
index eca91db..0000000
--- a/tests/cpp_api/cppf16/Android.mk
+++ /dev/null
@@ -1,19 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_MODULE:= rstest-cppf16
-LOCAL_LICENSE_KINDS:= SPDX-license-identifier-Apache-2.0
-LOCAL_LICENSE_CONDITIONS:= notice
-
-LOCAL_NDK_STL_VARIANT := c++_static
-
-LOCAL_SRC_FILES:= \
-	compute.cpp
-
-LOCAL_STATIC_LIBRARIES := \
-	libRScpp_static
-
-LOCAL_LDFLAGS += -llog -ldl
-
-include frameworks/rs/tests/cpp_api/common.mk
-include $(BUILD_EXECUTABLE)
diff --git a/tests/cpp_api/cppstrided/Android.bp b/tests/cpp_api/cppstrided/Android.bp
new file mode 100644
index 0000000..df3fc93
--- /dev/null
+++ b/tests/cpp_api/cppstrided/Android.bp
@@ -0,0 +1,34 @@
+//
+// Copyright (C) 2021 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.
+//
+
+package {
+    // See: http://go/android-license-faq
+    default_applicable_licenses: [
+        "Android-Apache-2.0",
+    ],
+}
+
+cc_binary {
+    name: "rstest-cppstrided",
+    defaults: ["frameworks_rs_tests_cpp-api-defaults"],
+    sdk_version: "21",
+    stl: "c++_static",
+    srcs: [
+        "multiply.rscript",
+        "compute.cpp",
+    ],
+    static_libs: ["libRScpp_static"],
+}
diff --git a/tests/cpp_api/cppstrided/Android.mk b/tests/cpp_api/cppstrided/Android.mk
deleted file mode 100644
index e0e03b3..0000000
--- a/tests/cpp_api/cppstrided/Android.mk
+++ /dev/null
@@ -1,19 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_MODULE:= rstest-cppstrided
-LOCAL_LICENSE_KINDS:= SPDX-license-identifier-Apache-2.0
-LOCAL_LICENSE_CONDITIONS:= notice
-
-LOCAL_SDK_VERSION := 21
-LOCAL_NDK_STL_VARIANT := c++_static
-
-LOCAL_SRC_FILES:= \
-	multiply.rscript \
-	compute.cpp
-
-LOCAL_STATIC_LIBRARIES := \
-	libRScpp_static
-
-include frameworks/rs/tests/cpp_api/common.mk
-include $(BUILD_EXECUTABLE)
diff --git a/tests/cpp_api/latency/Android.bp b/tests/cpp_api/latency/Android.bp
new file mode 100644
index 0000000..3eaf1ee
--- /dev/null
+++ b/tests/cpp_api/latency/Android.bp
@@ -0,0 +1,34 @@
+//
+// Copyright (C) 2021 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.
+//
+
+package {
+    // See: http://go/android-license-faq
+    default_applicable_licenses: [
+        "Android-Apache-2.0",
+    ],
+}
+
+cc_binary {
+    name: "rstest-latency",
+    defaults: ["frameworks_rs_tests_cpp-api-defaults"],
+    sdk_version: "21",
+    stl: "c++_static",
+    srcs: [
+        "latency.rscript",
+        "latency.cpp",
+    ],
+    static_libs: ["libRScpp_static"],
+}
diff --git a/tests/cpp_api/latency/Android.mk b/tests/cpp_api/latency/Android.mk
deleted file mode 100644
index 16557f4..0000000
--- a/tests/cpp_api/latency/Android.mk
+++ /dev/null
@@ -1,19 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_MODULE:= rstest-latency
-LOCAL_LICENSE_KINDS:= SPDX-license-identifier-Apache-2.0
-LOCAL_LICENSE_CONDITIONS:= notice
-
-LOCAL_SDK_VERSION := 21
-LOCAL_NDK_STL_VARIANT := c++_static
-
-LOCAL_SRC_FILES:= \
-	latency.rscript \
-	latency.cpp
-
-LOCAL_STATIC_LIBRARIES := \
-	libRScpp_static
-
-include frameworks/rs/tests/cpp_api/common.mk
-include $(BUILD_EXECUTABLE)
diff --git a/tests/cpp_api/typecheck/Android.bp b/tests/cpp_api/typecheck/Android.bp
new file mode 100644
index 0000000..793888c
--- /dev/null
+++ b/tests/cpp_api/typecheck/Android.bp
@@ -0,0 +1,34 @@
+//
+// Copyright (C) 2021 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.
+//
+
+package {
+    // See: http://go/android-license-faq
+    default_applicable_licenses: [
+        "Android-Apache-2.0",
+    ],
+}
+
+cc_binary {
+    name: "rstest-typecheck",
+    defaults: ["frameworks_rs_tests_cpp-api-defaults"],
+    sdk_version: "21",
+    stl: "c++_static",
+    srcs: [
+        "kernels.rscript",
+        "typecheck.cpp",
+    ],
+    static_libs: ["libRScpp_static"],
+}
diff --git a/tests/cpp_api/typecheck/Android.mk b/tests/cpp_api/typecheck/Android.mk
deleted file mode 100644
index 82f92ea..0000000
--- a/tests/cpp_api/typecheck/Android.mk
+++ /dev/null
@@ -1,19 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_MODULE:= rstest-typecheck
-LOCAL_LICENSE_KINDS:= SPDX-license-identifier-Apache-2.0
-LOCAL_LICENSE_CONDITIONS:= notice
-
-LOCAL_SDK_VERSION := 21
-LOCAL_NDK_STL_VARIANT := c++_static
-
-LOCAL_SRC_FILES:= \
-	kernels.rscript \
-	typecheck.cpp
-
-LOCAL_STATIC_LIBRARIES := \
-	libRScpp_static
-
-include frameworks/rs/tests/cpp_api/common.mk
-include $(BUILD_EXECUTABLE)