Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5a007fe0 authored by Hyunyoung Song's avatar Hyunyoung Song
Browse files

Convert Launcher Android.mk to Android.bp to setup RoboTests

Bug: 181083996
Test: m Launcher3 && install Launcher3 and test basic things
Test: m RunLauncherRoboTests (90 tests run and 3 fails)

Change-Id: Icdc839d06413409cbd52d10a5ef9fe27b0a57baa
parent d6844dcb
Loading
Loading
Loading
Loading
+90 −0
Original line number Diff line number Diff line
@@ -93,3 +93,93 @@ java_library {
    sdk_version: "current",
    min_sdk_version: "28",
}

//
// Build rule for Launcher3 dependencies lib.
//
android_library {
    name: "Launcher3CommonDepsLib",
    static_libs: [
        "androidx.recyclerview_recyclerview",
        "androidx.dynamicanimation_dynamicanimation",
        "androidx.preference_preference",
        "androidx.slice_slice-view",
        "iconloader_base",
        "LauncherPluginLib",
        "launcher_quickstep_log_protos_lite"
    ],
    srcs: [
        "src_build_config/**/*.java",
    ],
    resource_dirs: ["res"],
    optimize: {
        enabled: false,
    },
    sdk_version: "current",
    min_sdk_version: "26",
    manifest: "AndroidManifest-common.xml",
}

//
// Build rule for Launcher3 app.
//
android_app {
    name: "Launcher3",

    static_libs: [
        "Launcher3CommonDepsLib",
    ],
    srcs: [
        "src/**/*.java",
        "src_shortcuts_overrides/**/*.java",
        "src_ui_overrides/**/*.java",
        "ext_tests/src/**/*.java",
    ],
    resource_dirs: [
        "ext_tests/res",
    ],
    optimize: {
        proguard_flags_files: ["proguard.flags"],
        // Proguard is disable for testing. Derivarive prjects to keep proguard enabled
        enabled: false,
    },

    sdk_version: "current",
    min_sdk_version: "26",
    target_sdk_version: "29",
    privileged: true,
    system_ext_specific: true,

    overrides: [
        "Home",
        "Launcher2",
    ],
    required: ["privapp_whitelist_com.android.launcher3"],

    jacoco: {
        include_filter: ["com.android.launcher3.**"],
    },
    additional_manifests: [
        "AndroidManifest-common.xml",
    ],
}

//
// Launcher Robolectric test target.
//
java_library {
    name: "Launcher3TestCommon",
    libs: [
        "Launcher3CommonDepsLib",
    ],
    srcs: [
        "src/**/*.java",
        "src_shortcuts_overrides/**/*.java",
        "src_ui_overrides/**/*.java",
        "ext_tests/src/**/*.java",
        "tests/src_common/**/*.java",
    ],
    target_sdk_version: "29",
    sdk_version: "current",
    min_sdk_version: "26",
}
+0 −73
Original line number Diff line number Diff line
@@ -16,79 +16,6 @@

LOCAL_PATH := $(call my-dir)

#
# Build rule for Launcher3 dependencies lib.
#
include $(CLEAR_VARS)
LOCAL_USE_AAPT2 := true
LOCAL_AAPT2_ONLY := true
LOCAL_MODULE_TAGS := optional

LOCAL_STATIC_ANDROID_LIBRARIES := \
    androidx.recyclerview_recyclerview \
    androidx.dynamicanimation_dynamicanimation \
    androidx.preference_preference \
    androidx.slice_slice-view \
    iconloader_base

LOCAL_STATIC_JAVA_LIBRARIES := \
    LauncherPluginLib \
    launcher_quickstep_log_protos_lite \
    search_ui

LOCAL_SRC_FILES := \
    $(call all-java-files-under, src_build_config) \

LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res

LOCAL_PROGUARD_ENABLED := disabled

LOCAL_SDK_VERSION := current
LOCAL_MIN_SDK_VERSION := 26
LOCAL_MODULE := Launcher3CommonDepsLib
LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0
LOCAL_LICENSE_CONDITIONS := notice
LOCAL_NOTICE_FILE := $(LOCAL_PATH)/NOTICE
LOCAL_PRIVILEGED_MODULE := true
LOCAL_MANIFEST_FILE := AndroidManifest-common.xml

include $(BUILD_STATIC_JAVA_LIBRARY)

#
# Build rule for Launcher3 app.
#
include $(CLEAR_VARS)
LOCAL_USE_AAPT2 := true
LOCAL_MODULE_TAGS := optional

LOCAL_STATIC_ANDROID_LIBRARIES := Launcher3CommonDepsLib

LOCAL_SRC_FILES := \
    $(call all-java-files-under, src) \
    $(call all-java-files-under, src_shortcuts_overrides) \
    $(call all-java-files-under, src_ui_overrides) \
    $(call all-java-files-under, ext_tests/src)

LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/ext_tests/res

LOCAL_PROGUARD_FLAG_FILES := proguard.flags
# Proguard is disable for testing. Derivarive prjects to keep proguard enabled
LOCAL_PROGUARD_ENABLED := disabled

LOCAL_SDK_VERSION := current
LOCAL_MIN_SDK_VERSION := 26
LOCAL_PACKAGE_NAME := Launcher3
LOCAL_PRIVILEGED_MODULE := true
LOCAL_SYSTEM_EXT_MODULE := true
LOCAL_OVERRIDES_PACKAGES := Home Launcher2
LOCAL_REQUIRED_MODULES := privapp_whitelist_com.android.launcher3

LOCAL_FULL_LIBS_MANIFEST_FILES := $(LOCAL_PATH)/AndroidManifest-common.xml

LOCAL_JACK_COVERAGE_INCLUDE_FILTER := com.android.launcher3.*

include $(BUILD_PACKAGE)

#
# Build rule for Launcher3 Go app for Android Go devices.
#
+0 −1
Original line number Diff line number Diff line
<resources>
    <bool name="config_largeHeap">true</bool>

<!-- All Apps & Widgets -->
    <!-- Out of 100, the percent to shrink the workspace during spring loaded mode. -->
+46 −0
Original line number Diff line number Diff line
// 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.

//
// Launcher Robolectric test target.
//
//        "robolectric_android-all-stub", not needed, we write our own stubs
android_robolectric_test {
    name: "LauncherRoboTests",
    srcs: [
        "src/**/*.java",
    ],
    java_resource_dirs: [
        "resources",
        "res",
        "config",
    ],
    static_libs: [
        "truth-prebuilt",
        "Launcher3TestCommon",
        "androidx.test.runner",
        "androidx.test.rules",
        "mockito-robolectric-prebuilt",
    ],
    //robolectric_prebuilt_version: "4.4",
    libs: [
        "platform-robolectric-4.4-prebuilt",
    ],
    instrumentation_for: "Launcher3",

    test_options: {
        timeout: 36000,
    },
}

robolectric_tests/Android.mk

deleted100644 → 0
+0 −68
Original line number Diff line number Diff line
# Copyright (C) 2018 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.

#############################################
# Launcher Robolectric test target.         #
#############################################
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)

LOCAL_MODULE := LauncherRoboTests
LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0
LOCAL_LICENSE_CONDITIONS := notice
LOCAL_NOTICE_FILE := $(LOCAL_PATH)/../NOTICE
LOCAL_MODULE_CLASS := JAVA_LIBRARIES

LOCAL_SDK_VERSION := system_current
LOCAL_SRC_FILES := \
	$(call all-java-files-under, src) \
	$(call all-java-files-under, ../tests/src_common)

LOCAL_STATIC_JAVA_LIBRARIES := \
    androidx.test.runner \
    androidx.test.rules \
    mockito-robolectric-prebuilt \
    truth-prebuilt
LOCAL_JAVA_LIBRARIES := \
    platform-robolectric-4.3.1-prebuilt

LOCAL_JAVA_RESOURCE_DIRS := resources config

LOCAL_INSTRUMENTATION_FOR := Launcher3
LOCAL_MODULE_TAGS := optional

# Generate test_config.properties
include external/robolectric-shadows/gen_test_config.mk

include $(BUILD_STATIC_JAVA_LIBRARY)

############################################
# Target to run the previous target.       #
############################################
include $(CLEAR_VARS)

LOCAL_MODULE := RunLauncherRoboTests
LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0
LOCAL_LICENSE_CONDITIONS := notice
LOCAL_NOTICE_FILE := $(LOCAL_PATH)/../NOTICE
LOCAL_SDK_VERSION := system_current
LOCAL_JAVA_LIBRARIES := LauncherRoboTests

LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res
LOCAL_TEST_PACKAGE := Launcher3
LOCAL_INSTRUMENT_SOURCE_DIRS := packages/apps/Launcher3/src

LOCAL_ROBOTEST_TIMEOUT := 36000

include prebuilts/misc/common/robolectric/4.4/run_robotests.mk
Loading