blob: d825533e92f571e63d9058350f1c8238a21bf52d [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
24LOCAL_MODULE_TAGS := optional
25
26LOCAL_PRIVILEGED_MODULE := true
27
28LOCAL_STATIC_JAVA_LIBRARIES := \
Artem Iglikov5ed1dab2017-05-25 15:56:05 +010029 services.backup \
Bernardo Rufino58dd6c32017-11-09 19:30:32 +000030 services.core
Artem Iglikov5ed1dab2017-05-25 15:56:05 +010031
32include $(BUILD_PACKAGE)
33
Robert Berry39194c02018-01-11 13:50:56 +000034##############################################
35# FrameworksServices Robolectric test target #
36##############################################
Artem Iglikov5ed1dab2017-05-25 15:56:05 +010037include $(CLEAR_VARS)
38
Robert Berry39194c02018-01-11 13:50:56 +000039# Dependency platform-robolectric-android-all-stubs below contains a bunch of Android classes as
40# stubs that throw RuntimeExceptions when we use them. The goal is to include hidden APIs that
41# weren't included in Robolectric's Android jar files. However, we are testing the framework itself
42# here, so if we write stuff that is being used in the tests and exist in
43# platform-robolectric-android-all-stubs, the class loader is going to pick up the latter, and thus
44# we are going to test what we don't want. To solve this:
45#
46# 1. If the class being used should be visible to bundled apps:
47# => Bypass the stubs target by including them in LOCAL_SRC_FILES and LOCAL_AIDL_INCLUDES
48# (if aidl).
49#
50# 2. If it's not visible:
51# => Remove the class from the stubs jar (common/robolectric/android-all/android-all-stubs.jar)
52# and add the class path to
53# common/robolectric/android-all/android-all-stubs_removed_classes.txt.
54#
Artem Iglikov5ed1dab2017-05-25 15:56:05 +010055
Robert Berry39194c02018-01-11 13:50:56 +000056INTERNAL_BACKUP := ../../core/java/com/android/internal/backup
57
58LOCAL_SRC_FILES := \
59 $(call all-java-files-under, src) \
60 $(call all-Iaidl-files-under, $(INTERNAL_BACKUP)) \
61 ../../core/java/android/content/pm/PackageInfo.java \
62 ../../core/java/android/app/backup/BackupAgent.java \
63 ../../core/java/android/app/backup/BackupDataOutput.java \
64 ../../core/java/android/app/backup/FullBackupDataOutput.java \
65 ../../core/java/android/app/IBackupAgent.aidl
66
67LOCAL_AIDL_INCLUDES := \
68 $(call all-Iaidl-files-under, $(INTERNAL_BACKUP)) \
69 ../../core/java/android/app/IBackupAgent.aidl
70
Artem Iglikov5ed1dab2017-05-25 15:56:05 +010071LOCAL_STATIC_JAVA_LIBRARIES := \
Bernardo Rufino90a88022017-11-13 17:19:15 +000072 platform-robolectric-android-all-stubs \
Bernardo Rufino58dd6c32017-11-09 19:30:32 +000073 android-support-test \
74 mockito-robolectric-prebuilt \
75 platform-test-annotations \
Bernardo Rufino24476872017-12-21 11:43:16 +000076 truth-prebuilt \
77 testng
Artem Iglikov5ed1dab2017-05-25 15:56:05 +010078
79LOCAL_JAVA_LIBRARIES := \
80 junit \
James Lemieux0f5bba02018-01-04 17:45:28 -080081 platform-robolectric-3.6.1-prebuilt
Artem Iglikov5ed1dab2017-05-25 15:56:05 +010082
83LOCAL_INSTRUMENTATION_FOR := FrameworksServicesLib
84LOCAL_MODULE := FrameworksServicesRoboTests
85
86LOCAL_MODULE_TAGS := optional
87
88include $(BUILD_STATIC_JAVA_LIBRARY)
89
Robert Berry39194c02018-01-11 13:50:56 +000090###############################################################
91# FrameworksServices runner target to run the previous target #
92###############################################################
Artem Iglikov5ed1dab2017-05-25 15:56:05 +010093include $(CLEAR_VARS)
94
95LOCAL_MODULE := RunFrameworksServicesRoboTests
96
97LOCAL_SDK_VERSION := current
98
99LOCAL_STATIC_JAVA_LIBRARIES := \
100 FrameworksServicesRoboTests
101
102LOCAL_TEST_PACKAGE := FrameworksServicesLib
103
Artem Iglikovbd476ea2017-09-01 10:57:26 +0100104LOCAL_INSTRUMENT_SOURCE_DIRS := $(dir $(LOCAL_PATH))backup/java
105
James Lemieux0f5bba02018-01-04 17:45:28 -0800106include prebuilts/misc/common/robolectric/3.6.1/run_robotests.mk