blob: 03bdcf237873b81bd82dd16b06f8b711b9f1579d [file] [log] [blame]
Paul Duffine20f1932016-11-28 15:51:09 +00001#
2# Copyright (C) 2016 The Android Open Source Project
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15#
16
17LOCAL_PATH:= $(call my-dir)
18
Paul Duffin5c993822017-11-16 15:53:09 +000019# Build the android.test.base library
20# ===================================
21# This contains the junit.framework and android.test classes that were in
22# Android API level 25 excluding those from android.test.runner.
23# Also contains the com.android.internal.util.Predicate[s] classes.
24include $(CLEAR_VARS)
25
26LOCAL_SRC_FILES := $(call all-java-files-under, src)
27
28LOCAL_MODULE := android.test.base
29LOCAL_NO_STANDARD_LIBRARIES := true
30LOCAL_JAVA_LIBRARIES := core-oj core-libart framework
31
32include $(BUILD_JAVA_LIBRARY)
33
Paul Duffine20f1932016-11-28 15:51:09 +000034# Build the legacy-test library
35# =============================
Paul Duffin2ffc4ad2017-01-17 14:36:12 +000036# This contains the junit.framework and android.test classes that were in
Paul Duffin4e0c1902017-05-02 13:13:13 +010037# Android API level 25 excluding those from android.test.runner.
Paul Duffinf71d5b52017-05-09 15:52:46 +010038# Also contains the com.android.internal.util.Predicate[s] classes.
Paul Duffine20f1932016-11-28 15:51:09 +000039include $(CLEAR_VARS)
40
Paul Duffindf257602016-11-30 13:29:39 +000041LOCAL_SRC_FILES := $(call all-java-files-under, src)
Paul Duffinf71d5b52017-05-09 15:52:46 +010042
Paul Duffine20f1932016-11-28 15:51:09 +000043LOCAL_MODULE := legacy-test
Paul Duffindf257602016-11-30 13:29:39 +000044LOCAL_NO_STANDARD_LIBRARIES := true
45LOCAL_JAVA_LIBRARIES := core-oj core-libart framework
Paul Duffine20f1932016-11-28 15:51:09 +000046
47include $(BUILD_JAVA_LIBRARY)
Paul Duffin02f42f92016-12-07 14:21:53 +000048
Paul Duffin5c993822017-11-16 15:53:09 +000049# Build the repackaged.android.test.base library
50# ==============================================
51# This contains repackaged versions of the classes from legacy-test.
52include $(CLEAR_VARS)
53
54LOCAL_SRC_FILES := $(call all-java-files-under, src)
55
56LOCAL_MODULE := repackaged.android.test.base
57LOCAL_NO_STANDARD_LIBRARIES := true
58LOCAL_JAVA_LIBRARIES := core-oj core-libart framework
59LOCAL_JARJAR_RULES := $(LOCAL_PATH)/jarjar-rules.txt
60
61include $(BUILD_STATIC_JAVA_LIBRARY)
62
Paul Duffin1f090a82017-12-06 12:43:28 +000063# For unbundled build we'll use the prebuilt jar from prebuilts/sdk.
64ifeq (,$(TARGET_BUILD_APPS)$(filter true,$(TARGET_BUILD_PDK)))
65
Paul Duffin5c993822017-11-16 15:53:09 +000066# Generate the stub source files for android.test.base.stubs
67# ==========================================================
Paul Duffinbacad402017-06-28 11:57:59 +010068include $(CLEAR_VARS)
69
70LOCAL_SRC_FILES := \
71 $(call all-java-files-under, src)
72
73LOCAL_JAVA_LIBRARIES := \
74 core-oj \
75 core-libart \
76 framework \
77
78LOCAL_MODULE_CLASS := JAVA_LIBRARIES
79LOCAL_DROIDDOC_SOURCE_PATH := $(LOCAL_PATH)/src
80
Paul Duffin5c993822017-11-16 15:53:09 +000081ANDROID_TEST_BASE_OUTPUT_API_FILE := $(TARGET_OUT_COMMON_INTERMEDIATES)/JAVA_LIBRARIES/android.test.base.stubs_intermediates/api.txt
82ANDROID_TEST_BASE_OUTPUT_REMOVED_API_FILE := $(TARGET_OUT_COMMON_INTERMEDIATES)/JAVA_LIBRARIES/android.test.base.stubs_intermediates/removed.txt
Paul Duffinbacad402017-06-28 11:57:59 +010083
Paul Duffin5c993822017-11-16 15:53:09 +000084ANDROID_TEST_BASE_API_FILE := $(LOCAL_PATH)/api/android-test-base-current.txt
85ANDROID_TEST_BASE_REMOVED_API_FILE := $(LOCAL_PATH)/api/android-test-base-removed.txt
Paul Duffinbacad402017-06-28 11:57:59 +010086
87LOCAL_DROIDDOC_OPTIONS:= \
88 -stubpackages android.test:android.test.suitebuilder.annotation:com.android.internal.util:junit.framework \
89 -stubsourceonly \
Paul Duffin5c993822017-11-16 15:53:09 +000090 -stubs $(TARGET_OUT_COMMON_INTERMEDIATES)/JAVA_LIBRARIES/android.test.base.stubs_intermediates/src \
Paul Duffinbacad402017-06-28 11:57:59 +010091 -nodocs \
Paul Duffin5c993822017-11-16 15:53:09 +000092 -api $(ANDROID_TEST_BASE_OUTPUT_API_FILE) \
93 -removedApi $(ANDROID_TEST_BASE_OUTPUT_REMOVED_API_FILE) \
Paul Duffinbacad402017-06-28 11:57:59 +010094
95LOCAL_UNINSTALLABLE_MODULE := true
Paul Duffin5c993822017-11-16 15:53:09 +000096LOCAL_MODULE := android-test-base-api-stubs-gen
Paul Duffinbacad402017-06-28 11:57:59 +010097
98include $(BUILD_DROIDDOC)
99
100# Remember the target that will trigger the code generation.
Paul Duffin5c993822017-11-16 15:53:09 +0000101android_test_base_gen_stamp := $(full_target)
Paul Duffinbacad402017-06-28 11:57:59 +0100102
103# Add some additional dependencies
Paul Duffin5c993822017-11-16 15:53:09 +0000104$(ANDROID_TEST_BASE_OUTPUT_API_FILE): $(full_target)
105$(ANDROID_TEST_BASE_OUTPUT_REMOVED_API_FILE): $(full_target)
Paul Duffinbacad402017-06-28 11:57:59 +0100106
Paul Duffin5c993822017-11-16 15:53:09 +0000107# Build the android.test.base.stubs library
108# =========================================
Paul Duffinbacad402017-06-28 11:57:59 +0100109include $(CLEAR_VARS)
110
Paul Duffin5c993822017-11-16 15:53:09 +0000111LOCAL_MODULE := android.test.base.stubs
Paul Duffinbacad402017-06-28 11:57:59 +0100112
113LOCAL_SOURCE_FILES_ALL_GENERATED := true
Paul Duffind41d8472017-06-30 16:02:09 +0100114LOCAL_SDK_VERSION := current
Paul Duffinbacad402017-06-28 11:57:59 +0100115
Paul Duffinbacad402017-06-28 11:57:59 +0100116# Make sure to run droiddoc first to generate the stub source files.
Paul Duffin5c993822017-11-16 15:53:09 +0000117LOCAL_ADDITIONAL_DEPENDENCIES := $(android_test_base_gen_stamp)
118android_test_base_gen_stamp :=
Colin Cross85ab4062017-09-05 22:59:27 -0700119
120include $(BUILD_STATIC_JAVA_LIBRARY)
Paul Duffinbacad402017-06-28 11:57:59 +0100121
122# Archive a copy of the classes.jar in SDK build.
Paul Duffin5c993822017-11-16 15:53:09 +0000123$(call dist-for-goals,sdk win_sdk,$(full_classes_jar):android.test.base.stubs.jar)
Paul Duffinbacad402017-06-28 11:57:59 +0100124
Paul Duffin5c993822017-11-16 15:53:09 +0000125# Check that the android.test.base.stubs library has not changed
126# ==============================================================
Paul Duffinbacad402017-06-28 11:57:59 +0100127
128# Check that the API we're building hasn't changed from the not-yet-released
129# SDK version.
130$(eval $(call check-api, \
Paul Duffin5c993822017-11-16 15:53:09 +0000131 check-android-test-base-api-current, \
132 $(ANDROID_TEST_BASE_API_FILE), \
133 $(ANDROID_TEST_BASE_OUTPUT_API_FILE), \
134 $(ANDROID_TEST_BASE_REMOVED_API_FILE), \
135 $(ANDROID_TEST_BASE_OUTPUT_REMOVED_API_FILE), \
Paul Duffinbacad402017-06-28 11:57:59 +0100136 -error 2 -error 3 -error 4 -error 5 -error 6 \
137 -error 7 -error 8 -error 9 -error 10 -error 11 -error 12 -error 13 -error 14 -error 15 \
138 -error 16 -error 17 -error 18 -error 19 -error 20 -error 21 -error 23 -error 24 \
139 -error 25 -error 26 -error 27, \
Paul Duffinf779efd2017-11-16 15:47:05 +0000140 cat $(LOCAL_PATH)/api/apicheck_msg_android_test_base.txt, \
Paul Duffin5c993822017-11-16 15:53:09 +0000141 check-android-test-base-api, \
142 $(call doc-timestamp-for,android-test-base-api-stubs-gen) \
Paul Duffinbacad402017-06-28 11:57:59 +0100143 ))
144
Paul Duffin5c993822017-11-16 15:53:09 +0000145.PHONY: check-android-test-base-api
146checkapi: check-android-test-base-api
Paul Duffinbacad402017-06-28 11:57:59 +0100147
Paul Duffin5c993822017-11-16 15:53:09 +0000148.PHONY: update-android-test-base-api
149update-api: update-android-test-base-api
Paul Duffinbacad402017-06-28 11:57:59 +0100150
Paul Duffin5c993822017-11-16 15:53:09 +0000151update-android-test-base-api: $(ANDROID_TEST_BASE_OUTPUT_API_FILE) | $(ACP)
Paul Duffinbacad402017-06-28 11:57:59 +0100152 @echo Copying current.txt
Paul Duffin5c993822017-11-16 15:53:09 +0000153 $(hide) $(ACP) $(ANDROID_TEST_BASE_OUTPUT_API_FILE) $(ANDROID_TEST_BASE_API_FILE)
Paul Duffinbacad402017-06-28 11:57:59 +0100154 @echo Copying removed.txt
Paul Duffin5c993822017-11-16 15:53:09 +0000155 $(hide) $(ACP) $(ANDROID_TEST_BASE_OUTPUT_REMOVED_API_FILE) $(ANDROID_TEST_BASE_REMOVED_API_FILE)
Paul Duffinbacad402017-06-28 11:57:59 +0100156
Paul Duffin1f090a82017-12-06 12:43:28 +0000157endif # not TARGET_BUILD_APPS not TARGET_BUILD_PDK=true
158
Paul Duffin2ffc4ad2017-01-17 14:36:12 +0000159# Build the legacy-android-test library
Paul Duffinf71d5b52017-05-09 15:52:46 +0100160# =====================================
Paul Duffin4e0c1902017-05-02 13:13:13 +0100161# This contains the android.test classes that were in Android API level 25,
162# including those from android.test.runner.
Paul Duffinf71d5b52017-05-09 15:52:46 +0100163# Also contains the com.android.internal.util.Predicate[s] classes.
Paul Duffin2ffc4ad2017-01-17 14:36:12 +0000164include $(CLEAR_VARS)
165
Paul Duffin4e0c1902017-05-02 13:13:13 +0100166LOCAL_SRC_FILES := \
167 $(call all-java-files-under, src/android) \
Paul Duffinf71d5b52017-05-09 15:52:46 +0100168 $(call all-java-files-under, ../test-runner/src/android) \
Paul Duffine2545262017-11-15 11:39:14 +0000169 $(call all-java-files-under, ../test-mock/src/android) \
Paul Duffinf71d5b52017-05-09 15:52:46 +0100170 $(call all-java-files-under, src/com)
Paul Duffin2ffc4ad2017-01-17 14:36:12 +0000171LOCAL_MODULE := legacy-android-test
172LOCAL_NO_STANDARD_LIBRARIES := true
173LOCAL_JAVA_LIBRARIES := core-oj core-libart framework junit
174
175include $(BUILD_STATIC_JAVA_LIBRARY)
176
Paul Duffin5c993822017-11-16 15:53:09 +0000177# Build the legacy.test.stubs library
178# ===================================
179include $(CLEAR_VARS)
180
181LOCAL_MODULE := legacy.test.stubs
182LOCAL_SDK_VERSION := current
183
184LOCAL_STATIC_JAVA_LIBRARIES := android.test.base.stubs
185
186include $(BUILD_STATIC_JAVA_LIBRARY)
187
Paul Duffin02f42f92016-12-07 14:21:53 +0000188ifeq ($(HOST_OS),linux)
189# Build the legacy-performance-test-hostdex library
190# =================================================
191# This contains the android.test.PerformanceTestCase class only
192include $(CLEAR_VARS)
193
Paul Duffindf257602016-11-30 13:29:39 +0000194LOCAL_SRC_FILES := src/android/test/PerformanceTestCase.java
Paul Duffin02f42f92016-12-07 14:21:53 +0000195LOCAL_MODULE := legacy-performance-test-hostdex
196
Paul Duffinf1c59612017-02-22 11:42:46 +0000197include $(BUILD_HOST_DALVIK_STATIC_JAVA_LIBRARY)
Paul Duffin02f42f92016-12-07 14:21:53 +0000198endif # HOST_OS == linux