blob: da47de0a3d35387d6abd030afa4f9336a332f2b9 [file] [log] [blame]
Paul Duffin898e7de2018-01-30 13:01:30 +00001#
2# Copyright (C) 2018 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
19# For unbundled build we'll use the prebuilt jar from prebuilts/sdk.
20ifeq (,$(TARGET_BUILD_APPS)$(filter true,$(TARGET_BUILD_PDK)))
21
22# Build the android.test.legacy library
23# =====================================
Paul Duffin4cdec672018-02-14 10:36:16 +000024# Built against the SDK so that it can be statically included in APKs
25# without breaking link type checks.
26#
27# This builds directly from the source rather than simply statically
28# including the android.test.base-minus-junit and
29# android.test.runner-minus-junit libraries because the latter library
30# cannot itself be built against the SDK. That is because it uses on
31# an internal method (setTestContext) on the AndroidTestCase class.
32# That class is provided by both the android.test.base-minus-junit and
33# the current SDK and as the latter is first on the classpath its
34# version is used. Unfortunately, it does not provide the internal
35# method and so compilation fails.
36#
37# Building from source avoids that because the compiler will use the
38# source version of AndroidTestCase instead of the one from the current
39# SDK.
40#
41# The use of the internal method does not prevent this from being
42# statically included because the class that provides the method is
43# also included in this library.
Paul Duffin898e7de2018-01-30 13:01:30 +000044include $(CLEAR_VARS)
45
46LOCAL_MODULE := android.test.legacy
47
Paul Duffin4cdec672018-02-14 10:36:16 +000048LOCAL_SRC_FILES := \
49 $(call all-java-files-under, ../test-base/src/android) \
50 $(call all-java-files-under, ../test-base/src/com) \
51 $(call all-java-files-under, ../test-runner/src/android) \
52
Paul Duffin898e7de2018-01-30 13:01:30 +000053LOCAL_SDK_VERSION := current
54
Paul Duffin4cdec672018-02-14 10:36:16 +000055LOCAL_JAVA_LIBRARIES := junit android.test.mock.stubs
Paul Duffin898e7de2018-01-30 13:01:30 +000056
57include $(BUILD_STATIC_JAVA_LIBRARY)
58
59# Archive a copy of the classes.jar in SDK build.
60$(call dist-for-goals,sdk win_sdk,$(full_classes_jar):android.test.legacy.jar)
61
62endif # not TARGET_BUILD_APPS not TARGET_BUILD_PDK=true