blob: e67f8d32fb6db9274ced42cb62d9e374f64ecf47 [file] [log] [blame]
Artem Iglikov5ed1dab2017-05-25 15:56:05 +01001# 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 Berry39194c02018-01-11 13:50:56 +000016##############################################################
17# FrameworksServicesLib app just for Robolectric test target #
18##############################################################
Artem Iglikov5ed1dab2017-05-25 15:56:05 +010019LOCAL_PATH := $(call my-dir)
20
21include $(CLEAR_VARS)
22
23LOCAL_PACKAGE_NAME := FrameworksServicesLib
Anton Hanssond137c872018-02-23 12:57:51 +000024LOCAL_PRIVATE_PLATFORM_APIS := true
Artem Iglikov5ed1dab2017-05-25 15:56:05 +010025LOCAL_MODULE_TAGS := optional
26
27LOCAL_PRIVILEGED_MODULE := true
28
29LOCAL_STATIC_JAVA_LIBRARIES := \
Artem Iglikov5ed1dab2017-05-25 15:56:05 +010030 services.backup \
Bernardo Rufino58dd6c32017-11-09 19:30:32 +000031 services.core
Artem Iglikov5ed1dab2017-05-25 15:56:05 +010032
33include $(BUILD_PACKAGE)
34
Robert Berry39194c02018-01-11 13:50:56 +000035##############################################
36# FrameworksServices Robolectric test target #
37##############################################
Artem Iglikov5ed1dab2017-05-25 15:56:05 +010038include $(CLEAR_VARS)
39
Robert Berry39194c02018-01-11 13:50:56 +000040# Dependency platform-robolectric-android-all-stubs below contains a bunch of Android classes as
41# stubs that throw RuntimeExceptions when we use them. The goal is to include hidden APIs that
42# weren't included in Robolectric's Android jar files. However, we are testing the framework itself
43# here, so if we write stuff that is being used in the tests and exist in
44# platform-robolectric-android-all-stubs, the class loader is going to pick up the latter, and thus
45# we are going to test what we don't want. To solve this:
46#
47# 1. If the class being used should be visible to bundled apps:
48# => Bypass the stubs target by including them in LOCAL_SRC_FILES and LOCAL_AIDL_INCLUDES
49# (if aidl).
50#
51# 2. If it's not visible:
52# => Remove the class from the stubs jar (common/robolectric/android-all/android-all-stubs.jar)
53# and add the class path to
54# common/robolectric/android-all/android-all-stubs_removed_classes.txt.
55#
Artem Iglikov5ed1dab2017-05-25 15:56:05 +010056
Robert Berry39194c02018-01-11 13:50:56 +000057INTERNAL_BACKUP := ../../core/java/com/android/internal/backup
58
59LOCAL_SRC_FILES := \
60 $(call all-java-files-under, src) \
61 $(call all-Iaidl-files-under, $(INTERNAL_BACKUP)) \
Michal Karpinskib5e09312018-02-19 13:55:23 +000062 $(call all-java-files-under, ../../core/java/android/app/backup) \
63 $(call all-Iaidl-files-under, ../../core/java/android/app/backup) \
Bram Bonné226dfa22018-09-13 17:36:42 +020064 $(call all-java-files-under, ../../core/java/android/util/proto) \
Robert Berry39194c02018-01-11 13:50:56 +000065 ../../core/java/android/content/pm/PackageInfo.java \
Annie Meng48b2eca2018-03-08 20:38:43 +000066 ../../core/java/android/app/IBackupAgent.aidl \
Annie Meng13746902018-08-09 18:07:11 +010067 ../../core/java/android/util/KeyValueSettingObserver.java \
68 ../../core/java/android/content/pm/PackageParser.java \
69 ../../core/java/android/content/pm/SigningInfo.java
Robert Berry39194c02018-01-11 13:50:56 +000070
71LOCAL_AIDL_INCLUDES := \
72 $(call all-Iaidl-files-under, $(INTERNAL_BACKUP)) \
Michal Karpinskib5e09312018-02-19 13:55:23 +000073 $(call all-Iaidl-files-under, ../../core/java/android/app/backup) \
Robert Berry39194c02018-01-11 13:50:56 +000074 ../../core/java/android/app/IBackupAgent.aidl
75
Artem Iglikov5ed1dab2017-05-25 15:56:05 +010076LOCAL_STATIC_JAVA_LIBRARIES := \
Bernardo Rufino90a88022017-11-13 17:19:15 +000077 platform-robolectric-android-all-stubs \
Bernardo Rufino58dd6c32017-11-09 19:30:32 +000078 android-support-test \
Bram Bonnécf2b7c32018-09-11 10:54:10 +020079 guava \
Bernardo Rufino58dd6c32017-11-09 19:30:32 +000080 mockito-robolectric-prebuilt \
81 platform-test-annotations \
Bernardo Rufino24476872017-12-21 11:43:16 +000082 truth-prebuilt \
83 testng
Artem Iglikov5ed1dab2017-05-25 15:56:05 +010084
85LOCAL_JAVA_LIBRARIES := \
86 junit \
Tobias Thiereree7b4122018-10-12 17:43:10 +010087 platform-robolectric-3.6.2-prebuilt
Artem Iglikov5ed1dab2017-05-25 15:56:05 +010088
89LOCAL_INSTRUMENTATION_FOR := FrameworksServicesLib
90LOCAL_MODULE := FrameworksServicesRoboTests
91
92LOCAL_MODULE_TAGS := optional
93
94include $(BUILD_STATIC_JAVA_LIBRARY)
95
Robert Berry39194c02018-01-11 13:50:56 +000096###############################################################
97# FrameworksServices runner target to run the previous target #
98###############################################################
Artem Iglikov5ed1dab2017-05-25 15:56:05 +010099include $(CLEAR_VARS)
100
101LOCAL_MODULE := RunFrameworksServicesRoboTests
102
103LOCAL_SDK_VERSION := current
104
105LOCAL_STATIC_JAVA_LIBRARIES := \
106 FrameworksServicesRoboTests
107
108LOCAL_TEST_PACKAGE := FrameworksServicesLib
109
Artem Iglikovbd476ea2017-09-01 10:57:26 +0100110LOCAL_INSTRUMENT_SOURCE_DIRS := $(dir $(LOCAL_PATH))backup/java
111
Tobias Thiereree7b4122018-10-12 17:43:10 +0100112include prebuilts/misc/common/robolectric/3.6.2/run_robotests.mk