Merge "mk2bp conversion of TV" into main am: 0230f43caf am: 9c16f02018

Original change: https://android-review.googlesource.com/c/platform/packages/apps/TV/+/2826213

Change-Id: Ifc0f47d7e55223a4e99405ce386c36611ec9d0f6
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
diff --git a/common/tests/robotests/Android.bp b/common/tests/robotests/Android.bp
new file mode 100644
index 0000000..babaf7d
--- /dev/null
+++ b/common/tests/robotests/Android.bp
@@ -0,0 +1,50 @@
+//
+// Copyright (C) 2023 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",
+    ],
+}
+
+android_robolectric_test {
+    name: "TvCommonRoboTests",
+    srcs: [
+        "src/**/*.java",
+    ],
+    java_resource_dirs: ["config"],
+    libs: [
+        "robolectric_android-all-stub",
+        "Robolectric_all-target",
+        "mockito-robolectric-prebuilt",
+        "diffutils-prebuilt-jar",
+    ],
+    static_libs: [
+        "tv-lib-truth",
+        "androidx.test.ext.truth",
+        "tv-test-common",
+        "tv-test-common-robo",
+    ],
+    plugins: [
+        "tv-lib-dagger-android-processor",
+        "tv-lib-dagger-compiler",
+    ],
+    instrumentation_for: "LiveTv",
+    test_options: {
+        timeout: 36000,
+    },
+}
diff --git a/common/tests/robotests/Android.mk b/common/tests/robotests/Android.mk
deleted file mode 100644
index 85512fb..0000000
--- a/common/tests/robotests/Android.mk
+++ /dev/null
@@ -1,54 +0,0 @@
-#############################################################
-# Tv Common Robolectric test target.                        #
-#############################################################
-LOCAL_PATH := $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_MODULE := TvCommonRoboTests
-LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0
-LOCAL_LICENSE_CONDITIONS := notice
-LOCAL_MODULE_CLASS := JAVA_LIBRARIES
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_JAVA_LIBRARIES := \
-    Robolectric_all-target \
-    mockito-robolectric-prebuilt \
-    robolectric_android-all-stub \
-    diffutils-prebuilt-jar \
-
-LOCAL_STATIC_JAVA_LIBRARIES := \
-    tv-lib-truth \
-
-LOCAL_STATIC_ANDROID_LIBRARIES := \
-    androidx.test.ext.truth \
-    tv-test-common \
-    tv-test-common-robo \
-
-LOCAL_INSTRUMENTATION_FOR := LiveTv
-
-LOCAL_MODULE_TAGS := optional
-
-include $(BUILD_STATIC_JAVA_LIBRARY)
-
-#############################################################
-# Tv common runner target to run the previous target.       #
-#############################################################
-include $(CLEAR_VARS)
-LOCAL_MODULE := RunTvCommonRoboTests
-LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0
-LOCAL_LICENSE_CONDITIONS := notice
-
-LOCAL_ROBOTEST_FILES := $(call find-files-in-subdirs,$(LOCAL_PATH)/src,*Test.java,.)
-
-LOCAL_JAVA_LIBRARIES := \
-    TvCommonRoboTests \
-    Robolectric_all-target \
-    mockito-robolectric-prebuilt \
-    robolectric_android-all-stub \
-
-LOCAL_TEST_PACKAGE := LiveTv
-
-LOCAL_ROBOTEST_TIMEOUT := 36000
-
-include external/robolectric-shadows/run_robotests.mk
diff --git a/tests/robotests/Android.bp b/tests/robotests/Android.bp
new file mode 100644
index 0000000..a89f38f
--- /dev/null
+++ b/tests/robotests/Android.bp
@@ -0,0 +1,57 @@
+//
+//  Copyright 2023, 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",
+    ],
+}
+
+android_robolectric_test {
+    name: "TvRoboTests",
+    srcs: [
+        "src/**/*.java",
+    ],
+    exclude_srcs: [
+        "src/com/android/tv/data/epg/EpgFetcherImplTest.java",
+        "src/com/android/tv/guide/ProgramItemViewTest.java",
+    ],
+    libs: [
+        "Robolectric_all-target",
+        "mockito-robolectric-prebuilt",
+        "robolectric_android-all-stub",
+    ],
+    static_libs: [
+        "tv-lib-dagger",
+        "tv-lib-truth",
+        "android-support-annotations",
+        "androidx.leanback_leanback-nodeps",
+        "androidx.test.core",
+        "androidx.test.ext.truth",
+        "tv-lib-dagger-android",
+        "tv-test-common",
+        "tv-test-common-robo",
+    ],
+    plugins: [
+        "tv-lib-dagger-android-processor",
+        "tv-lib-dagger-compiler",
+    ],
+    instrumentation_for: "LiveTv",
+    test_options: {
+        timeout: 36000,
+    },
+}
diff --git a/tests/robotests/Android.mk b/tests/robotests/Android.mk
deleted file mode 100644
index c5341ab..0000000
--- a/tests/robotests/Android.mk
+++ /dev/null
@@ -1,78 +0,0 @@
-#############################################################
-# Tv Robolectric test target.                               #
-#############################################################
-LOCAL_PATH := $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_MODULE := TvRoboTests
-LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0
-LOCAL_LICENSE_CONDITIONS := notice
-LOCAL_MODULE_CLASS := JAVA_LIBRARIES
-
-BASE_DIR = src/com/android/tv
-EXCLUDE_FILES := \
-    $(BASE_DIR)/data/epg/EpgFetcherImplTest.java \
-    $(BASE_DIR)/guide/ProgramItemViewTest.java \
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-LOCAL_SRC_FILES := $(filter-out $(EXCLUDE_FILES),$(LOCAL_SRC_FILES))
-
-LOCAL_JAVA_LIBRARIES := \
-    Robolectric_all-target \
-    mockito-robolectric-prebuilt \
-    robolectric_android-all-stub \
-
-LOCAL_STATIC_JAVA_LIBRARIES := \
-    tv-lib-dagger \
-    tv-lib-truth \
-
-LOCAL_STATIC_ANDROID_LIBRARIES := \
-    androidx.leanback_leanback-nodeps \
-    androidx.test.core \
-    androidx.test.ext.truth \
-    tv-lib-dagger-android \
-    tv-test-common \
-    tv-test-common-robo \
-
-LOCAL_ANNOTATION_PROCESSORS := \
-    tv-lib-dagger-android-processor \
-    tv-lib-dagger-compiler \
-
-LOCAL_ANNOTATION_PROCESSOR_CLASSES := \
-  dagger.internal.codegen.ComponentProcessor,dagger.android.processor.AndroidProcessor
-
-LOCAL_INSTRUMENTATION_FOR := LiveTv
-
-LOCAL_MODULE_TAGS := optional
-
-include $(BUILD_STATIC_JAVA_LIBRARY)
-
-#############################################################
-# Tv runner target to run the previous target.              #
-#############################################################
-include $(CLEAR_VARS)
-LOCAL_MODULE := RunTvRoboTests
-LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0
-LOCAL_LICENSE_CONDITIONS := notice
-
-BASE_DIR = com/android/tv
-EXCLUDE_FILES := \
-    $(BASE_DIR)/data/epg/EpgFetcherImplTest.java \
-    $(BASE_DIR)/guide/ProgramItemViewTest.java \
-
-LOCAL_ROBOTEST_FILES := $(call find-files-in-subdirs,$(LOCAL_PATH)/src,*Test.java,.)
-LOCAL_ROBOTEST_FILES := $(filter-out $(EXCLUDE_FILES),$(LOCAL_ROBOTEST_FILES))
-
-LOCAL_JAVA_LIBRARIES := \
-    Robolectric_all-target \
-    TvRoboTests \
-    mockito-robolectric-prebuilt \
-    robolectric_android-all-stub \
-    tv-test-common \
-    tv-test-common-robo \
-
-LOCAL_TEST_PACKAGE := LiveTv
-
-LOCAL_ROBOTEST_TIMEOUT := 36000
-
-include external/robolectric-shadows/run_robotests.mk
diff --git a/tuner/tests/robotests/Android.bp b/tuner/tests/robotests/Android.bp
new file mode 100644
index 0000000..99926e7
--- /dev/null
+++ b/tuner/tests/robotests/Android.bp
@@ -0,0 +1,51 @@
+//
+// Copyright (C) 2023 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",
+    ],
+}
+
+android_robolectric_test {
+    name: "TvTunerRoboTests",
+    srcs: [
+        "javatests/**/*.java",
+    ],
+    java_resource_dirs: ["config"],
+    libs: [
+        "robolectric_android-all-stub",
+        "Robolectric_all-target",
+        "mockito-robolectric-prebuilt",
+    ],
+    static_libs: [
+        "tv-lib-dagger",
+        "androidx.test.core",
+        "tv-lib-dagger-android",
+        "tv-test-common",
+        "tv-test-common-robo",
+        "tv-tuner-testing",
+    ],
+    plugins: [
+        "tv-lib-dagger-android-processor",
+        "tv-lib-dagger-compiler",
+    ],
+    instrumentation_for: "LiveTv",
+    test_options: {
+        timeout: 36000,
+    },
+}
diff --git a/tuner/tests/robotests/Android.mk b/tuner/tests/robotests/Android.mk
deleted file mode 100644
index bf2f24c..0000000
--- a/tuner/tests/robotests/Android.mk
+++ /dev/null
@@ -1,72 +0,0 @@
-#############################################################
-# Tv Robolectric test target.                               #
-#############################################################
-LOCAL_PATH := $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_MODULE := TvTunerRoboTests
-LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0
-LOCAL_LICENSE_CONDITIONS := notice
-LOCAL_MODULE_CLASS := JAVA_LIBRARIES
-
-LOCAL_SRC_FILES := $(call all-java-files-under, javatests)
-
-LOCAL_JAVA_LIBRARIES := \
-    Robolectric_all-target \
-    mockito-robolectric-prebuilt \
-    robolectric_android-all-stub \
-
-LOCAL_STATIC_JAVA_LIBRARIES := \
-    tv-lib-dagger
-
-LOCAL_STATIC_ANDROID_LIBRARIES := \
-    androidx.test.core \
-    tv-lib-dagger-android \
-    tv-test-common \
-    tv-test-common-robo \
-    tv-tuner-testing \
-
-LOCAL_ANNOTATION_PROCESSORS := \
-    tv-lib-dagger-android-processor \
-    tv-lib-dagger-compiler \
-
-LOCAL_ANNOTATION_PROCESSOR_CLASSES := \
-  dagger.internal.codegen.ComponentProcessor,dagger.android.processor.AndroidProcessor
-
-LOCAL_INSTRUMENTATION_FOR := LiveTv
-
-LOCAL_MODULE_TAGS := optional
-
-include $(BUILD_STATIC_JAVA_LIBRARY)
-
-#############################################################
-# Tv runner target to run the previous target.              #
-#############################################################
-include $(CLEAR_VARS)
-LOCAL_MODULE := RunTvTunerRoboTests
-LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0
-LOCAL_LICENSE_CONDITIONS := notice
-
-BASE_DIR = com/android/tv/tuner
-EXCLUDE_FILES := \
-    $(BASE_DIR)/dvb/DvbTunerHalTest.java \
-    $(BASE_DIR)/exoplayer/tests/SampleSourceExtractorTest.java \
-
-LOCAL_ROBOTEST_FILES := $(call find-files-in-subdirs,$(LOCAL_PATH)/javatests,*Test.java,.)
-LOCAL_ROBOTEST_FILES := $(filter-out $(EXCLUDE_FILES),$(LOCAL_ROBOTEST_FILES))
-
-LOCAL_JAVA_LIBRARIES := \
-    Robolectric_all-target \
-    TvTunerRoboTests \
-    mockito-robolectric-prebuilt \
-    robolectric_android-all-stub \
-    tv-lib-truth \
-    tv-test-common \
-    tv-test-common-robo \
-    tv-tuner-testing \
-
-LOCAL_TEST_PACKAGE := LiveTv
-
-LOCAL_ROBOTEST_TIMEOUT := 36000
-
-include external/robolectric-shadows/run_robotests.mk