| Artem Iglikov | 5ed1dab | 2017-05-25 15:56:05 +0100 | [diff] [blame] | 1 | # Copyright (C) 2016 The Android Open Source Project |
| 2 | # |
| 3 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | # you may not use this file except in compliance with the License. |
| 5 | # You may obtain a copy of the License at |
| 6 | # |
| 7 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | # |
| 9 | # Unless required by applicable law or agreed to in writing, software |
| 10 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | # See the License for the specific language governing permissions and |
| 13 | # limitations under the License. |
| 14 | |
| 15 | |
| Robert Berry | 39194c0 | 2018-01-11 13:50:56 +0000 | [diff] [blame] | 16 | ############################################################## |
| 17 | # FrameworksServicesLib app just for Robolectric test target # |
| 18 | ############################################################## |
| Artem Iglikov | 5ed1dab | 2017-05-25 15:56:05 +0100 | [diff] [blame] | 19 | LOCAL_PATH := $(call my-dir) |
| 20 | |
| 21 | include $(CLEAR_VARS) |
| 22 | |
| 23 | LOCAL_PACKAGE_NAME := FrameworksServicesLib |
| Anton Hansson | d137c87 | 2018-02-23 12:57:51 +0000 | [diff] [blame] | 24 | LOCAL_PRIVATE_PLATFORM_APIS := true |
| Artem Iglikov | 5ed1dab | 2017-05-25 15:56:05 +0100 | [diff] [blame] | 25 | LOCAL_MODULE_TAGS := optional |
| 26 | |
| 27 | LOCAL_PRIVILEGED_MODULE := true |
| 28 | |
| 29 | LOCAL_STATIC_JAVA_LIBRARIES := \ |
| Artem Iglikov | 5ed1dab | 2017-05-25 15:56:05 +0100 | [diff] [blame] | 30 | services.backup \ |
| Dan Shi | dc2b631 | 2018-11-12 17:17:17 -0800 | [diff] [blame] | 31 | services.core \ |
| 32 | services.net |
| Artem Iglikov | 5ed1dab | 2017-05-25 15:56:05 +0100 | [diff] [blame] | 33 | |
| 34 | include $(BUILD_PACKAGE) |
| 35 | |
| Robert Berry | 39194c0 | 2018-01-11 13:50:56 +0000 | [diff] [blame] | 36 | ############################################## |
| 37 | # FrameworksServices Robolectric test target # |
| 38 | ############################################## |
| Artem Iglikov | 5ed1dab | 2017-05-25 15:56:05 +0100 | [diff] [blame] | 39 | include $(CLEAR_VARS) |
| 40 | |
| Robert Berry | 39194c0 | 2018-01-11 13:50:56 +0000 | [diff] [blame] | 41 | # Dependency platform-robolectric-android-all-stubs below contains a bunch of Android classes as |
| 42 | # stubs that throw RuntimeExceptions when we use them. The goal is to include hidden APIs that |
| 43 | # weren't included in Robolectric's Android jar files. However, we are testing the framework itself |
| 44 | # here, so if we write stuff that is being used in the tests and exist in |
| 45 | # platform-robolectric-android-all-stubs, the class loader is going to pick up the latter, and thus |
| 46 | # we are going to test what we don't want. To solve this: |
| 47 | # |
| 48 | # 1. If the class being used should be visible to bundled apps: |
| 49 | # => Bypass the stubs target by including them in LOCAL_SRC_FILES and LOCAL_AIDL_INCLUDES |
| 50 | # (if aidl). |
| 51 | # |
| 52 | # 2. If it's not visible: |
| 53 | # => Remove the class from the stubs jar (common/robolectric/android-all/android-all-stubs.jar) |
| 54 | # and add the class path to |
| 55 | # common/robolectric/android-all/android-all-stubs_removed_classes.txt. |
| 56 | # |
| Artem Iglikov | 5ed1dab | 2017-05-25 15:56:05 +0100 | [diff] [blame] | 57 | |
| Robert Berry | 39194c0 | 2018-01-11 13:50:56 +0000 | [diff] [blame] | 58 | INTERNAL_BACKUP := ../../core/java/com/android/internal/backup |
| 59 | |
| 60 | LOCAL_SRC_FILES := \ |
| 61 | $(call all-java-files-under, src) \ |
| 62 | $(call all-Iaidl-files-under, $(INTERNAL_BACKUP)) \ |
| Michal Karpinski | b5e0931 | 2018-02-19 13:55:23 +0000 | [diff] [blame] | 63 | $(call all-java-files-under, ../../core/java/android/app/backup) \ |
| 64 | $(call all-Iaidl-files-under, ../../core/java/android/app/backup) \ |
| Robert Berry | 39194c0 | 2018-01-11 13:50:56 +0000 | [diff] [blame] | 65 | ../../core/java/android/content/pm/PackageInfo.java \ |
| Annie Meng | 7d3033b | 2018-03-08 20:38:43 +0000 | [diff] [blame] | 66 | ../../core/java/android/app/IBackupAgent.aidl \ |
| 67 | ../../core/java/android/util/KeyValueSettingObserver.java |
| Robert Berry | 39194c0 | 2018-01-11 13:50:56 +0000 | [diff] [blame] | 68 | |
| 69 | LOCAL_AIDL_INCLUDES := \ |
| 70 | $(call all-Iaidl-files-under, $(INTERNAL_BACKUP)) \ |
| Michal Karpinski | b5e0931 | 2018-02-19 13:55:23 +0000 | [diff] [blame] | 71 | $(call all-Iaidl-files-under, ../../core/java/android/app/backup) \ |
| Robert Berry | 39194c0 | 2018-01-11 13:50:56 +0000 | [diff] [blame] | 72 | ../../core/java/android/app/IBackupAgent.aidl |
| 73 | |
| Artem Iglikov | 5ed1dab | 2017-05-25 15:56:05 +0100 | [diff] [blame] | 74 | LOCAL_STATIC_JAVA_LIBRARIES := \ |
| Bernardo Rufino | 90a8802 | 2017-11-13 17:19:15 +0000 | [diff] [blame] | 75 | platform-robolectric-android-all-stubs \ |
| Bernardo Rufino | 58dd6c3 | 2017-11-09 19:30:32 +0000 | [diff] [blame] | 76 | android-support-test \ |
| 77 | mockito-robolectric-prebuilt \ |
| 78 | platform-test-annotations \ |
| Bernardo Rufino | 2447687 | 2017-12-21 11:43:16 +0000 | [diff] [blame] | 79 | truth-prebuilt \ |
| 80 | testng |
| Artem Iglikov | 5ed1dab | 2017-05-25 15:56:05 +0100 | [diff] [blame] | 81 | |
| 82 | LOCAL_JAVA_LIBRARIES := \ |
| 83 | junit \ |
| Tobias Thierer | ee7b412 | 2018-10-12 17:43:10 +0100 | [diff] [blame] | 84 | platform-robolectric-3.6.2-prebuilt |
| Artem Iglikov | 5ed1dab | 2017-05-25 15:56:05 +0100 | [diff] [blame] | 85 | |
| 86 | LOCAL_INSTRUMENTATION_FOR := FrameworksServicesLib |
| 87 | LOCAL_MODULE := FrameworksServicesRoboTests |
| 88 | |
| 89 | LOCAL_MODULE_TAGS := optional |
| 90 | |
| 91 | include $(BUILD_STATIC_JAVA_LIBRARY) |
| 92 | |
| Robert Berry | 39194c0 | 2018-01-11 13:50:56 +0000 | [diff] [blame] | 93 | ############################################################### |
| 94 | # FrameworksServices runner target to run the previous target # |
| 95 | ############################################################### |
| Artem Iglikov | 5ed1dab | 2017-05-25 15:56:05 +0100 | [diff] [blame] | 96 | include $(CLEAR_VARS) |
| 97 | |
| 98 | LOCAL_MODULE := RunFrameworksServicesRoboTests |
| 99 | |
| 100 | LOCAL_SDK_VERSION := current |
| 101 | |
| 102 | LOCAL_STATIC_JAVA_LIBRARIES := \ |
| 103 | FrameworksServicesRoboTests |
| 104 | |
| 105 | LOCAL_TEST_PACKAGE := FrameworksServicesLib |
| 106 | |
| Artem Iglikov | bd476ea | 2017-09-01 10:57:26 +0100 | [diff] [blame] | 107 | LOCAL_INSTRUMENT_SOURCE_DIRS := $(dir $(LOCAL_PATH))backup/java |
| 108 | |
| Tobias Thierer | ee7b412 | 2018-10-12 17:43:10 +0100 | [diff] [blame] | 109 | include prebuilts/misc/common/robolectric/3.6.2/run_robotests.mk |