Android.mk revision bd97e3dd4e5d395f336114016b000ef3cfb26053
1e254526f0fe5d22681555bd4a00b7ee96fee1dc1Paul Duffin#
2e254526f0fe5d22681555bd4a00b7ee96fee1dc1Paul Duffin# Copyright (C) 2008 The Android Open Source Project
3e254526f0fe5d22681555bd4a00b7ee96fee1dc1Paul Duffin#
4e254526f0fe5d22681555bd4a00b7ee96fee1dc1Paul Duffin# Licensed under the Apache License, Version 2.0 (the "License");
5e254526f0fe5d22681555bd4a00b7ee96fee1dc1Paul Duffin# you may not use this file except in compliance with the License.
6e254526f0fe5d22681555bd4a00b7ee96fee1dc1Paul Duffin# You may obtain a copy of the License at
7e254526f0fe5d22681555bd4a00b7ee96fee1dc1Paul Duffin#
8e254526f0fe5d22681555bd4a00b7ee96fee1dc1Paul Duffin#      http://www.apache.org/licenses/LICENSE-2.0
9e254526f0fe5d22681555bd4a00b7ee96fee1dc1Paul Duffin#
10e254526f0fe5d22681555bd4a00b7ee96fee1dc1Paul Duffin# Unless required by applicable law or agreed to in writing, software
11e254526f0fe5d22681555bd4a00b7ee96fee1dc1Paul Duffin# distributed under the License is distributed on an "AS IS" BASIS,
12e254526f0fe5d22681555bd4a00b7ee96fee1dc1Paul Duffin# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13e254526f0fe5d22681555bd4a00b7ee96fee1dc1Paul Duffin# See the License for the specific language governing permissions and
14e254526f0fe5d22681555bd4a00b7ee96fee1dc1Paul Duffin# limitations under the License.
15e254526f0fe5d22681555bd4a00b7ee96fee1dc1Paul Duffin#
16e254526f0fe5d22681555bd4a00b7ee96fee1dc1Paul Duffin
17e254526f0fe5d22681555bd4a00b7ee96fee1dc1Paul DuffinLOCAL_PATH:= $(call my-dir)
18e254526f0fe5d22681555bd4a00b7ee96fee1dc1Paul Duffin
19bd97e3dd4e5d395f336114016b000ef3cfb26053Paul Duffin# Includes the main framework source to ensure that doclava has access to the
20bd97e3dd4e5d395f336114016b000ef3cfb26053Paul Duffin# visibility information for the base classes of the mock classes. Without it
21bd97e3dd4e5d395f336114016b000ef3cfb26053Paul Duffin# otherwise hidden methods could be visible.
22bd97e3dd4e5d395f336114016b000ef3cfb26053Paul Duffinandroid_test_mock_source_files := \
23bd97e3dd4e5d395f336114016b000ef3cfb26053Paul Duffin    $(call all-java-files-under, src/android/test/mock) \
24bd97e3dd4e5d395f336114016b000ef3cfb26053Paul Duffin    $(call all-java-files-under, ../core/java) \
25e254526f0fe5d22681555bd4a00b7ee96fee1dc1Paul Duffin
26e254526f0fe5d22681555bd4a00b7ee96fee1dc1Paul Duffin# For unbundled build we'll use the prebuilt jar from prebuilts/sdk.
27e254526f0fe5d22681555bd4a00b7ee96fee1dc1Paul Duffinifeq (,$(TARGET_BUILD_APPS)$(filter true,$(TARGET_BUILD_PDK)))
28e254526f0fe5d22681555bd4a00b7ee96fee1dc1Paul Duffin
29e254526f0fe5d22681555bd4a00b7ee96fee1dc1Paul Duffin# Generate the stub source files for android.test.mock.stubs
30e254526f0fe5d22681555bd4a00b7ee96fee1dc1Paul Duffin# ==========================================================
31e254526f0fe5d22681555bd4a00b7ee96fee1dc1Paul Duffininclude $(CLEAR_VARS)
32e254526f0fe5d22681555bd4a00b7ee96fee1dc1Paul DuffinLOCAL_SRC_FILES := $(android_test_mock_source_files)
33e254526f0fe5d22681555bd4a00b7ee96fee1dc1Paul Duffin
34e254526f0fe5d22681555bd4a00b7ee96fee1dc1Paul DuffinLOCAL_JAVA_LIBRARIES := core-oj core-libart framework
35e254526f0fe5d22681555bd4a00b7ee96fee1dc1Paul DuffinLOCAL_MODULE_CLASS := JAVA_LIBRARIES
36e254526f0fe5d22681555bd4a00b7ee96fee1dc1Paul DuffinLOCAL_DROIDDOC_SOURCE_PATH := $(LOCAL_PATH)/src/android/test/mock
37e254526f0fe5d22681555bd4a00b7ee96fee1dc1Paul Duffin
38e254526f0fe5d22681555bd4a00b7ee96fee1dc1Paul DuffinANDROID_TEST_MOCK_OUTPUT_API_FILE := $(TARGET_OUT_COMMON_INTERMEDIATES)/JAVA_LIBRARIES/android.test.mock.stubs_intermediates/api.txt
39e254526f0fe5d22681555bd4a00b7ee96fee1dc1Paul DuffinANDROID_TEST_MOCK_OUTPUT_REMOVED_API_FILE := $(TARGET_OUT_COMMON_INTERMEDIATES)/JAVA_LIBRARIES/android.test.mock.stubs_intermediates/removed.txt
40e254526f0fe5d22681555bd4a00b7ee96fee1dc1Paul Duffin
41e254526f0fe5d22681555bd4a00b7ee96fee1dc1Paul DuffinANDROID_TEST_MOCK_API_FILE := $(LOCAL_PATH)/api/android-test-mock-current.txt
42e254526f0fe5d22681555bd4a00b7ee96fee1dc1Paul DuffinANDROID_TEST_MOCK_REMOVED_API_FILE := $(LOCAL_PATH)/api/android-test-mock-removed.txt
43e254526f0fe5d22681555bd4a00b7ee96fee1dc1Paul Duffin
44e254526f0fe5d22681555bd4a00b7ee96fee1dc1Paul DuffinLOCAL_DROIDDOC_OPTIONS:= \
45e254526f0fe5d22681555bd4a00b7ee96fee1dc1Paul Duffin    -stubpackages android.test.mock \
46e254526f0fe5d22681555bd4a00b7ee96fee1dc1Paul Duffin    -stubs $(TARGET_OUT_COMMON_INTERMEDIATES)/JAVA_LIBRARIES/android.test.mock.stubs_intermediates/src \
47e254526f0fe5d22681555bd4a00b7ee96fee1dc1Paul Duffin    -nodocs \
48e254526f0fe5d22681555bd4a00b7ee96fee1dc1Paul Duffin    -api $(ANDROID_TEST_MOCK_OUTPUT_API_FILE) \
49e254526f0fe5d22681555bd4a00b7ee96fee1dc1Paul Duffin    -removedApi $(ANDROID_TEST_MOCK_OUTPUT_REMOVED_API_FILE) \
50e254526f0fe5d22681555bd4a00b7ee96fee1dc1Paul Duffin
51e254526f0fe5d22681555bd4a00b7ee96fee1dc1Paul DuffinLOCAL_UNINSTALLABLE_MODULE := true
52e254526f0fe5d22681555bd4a00b7ee96fee1dc1Paul DuffinLOCAL_MODULE := android-test-mock-api-stubs-gen
53e254526f0fe5d22681555bd4a00b7ee96fee1dc1Paul Duffin
54e254526f0fe5d22681555bd4a00b7ee96fee1dc1Paul Duffininclude $(BUILD_DROIDDOC)
55e254526f0fe5d22681555bd4a00b7ee96fee1dc1Paul Duffin
56e254526f0fe5d22681555bd4a00b7ee96fee1dc1Paul Duffin# Remember the target that will trigger the code generation.
57e254526f0fe5d22681555bd4a00b7ee96fee1dc1Paul Duffinandroid_test_mock_gen_stamp := $(full_target)
58e254526f0fe5d22681555bd4a00b7ee96fee1dc1Paul Duffin
59e254526f0fe5d22681555bd4a00b7ee96fee1dc1Paul Duffin# Add some additional dependencies
60e254526f0fe5d22681555bd4a00b7ee96fee1dc1Paul Duffin$(ANDROID_TEST_MOCK_OUTPUT_API_FILE): $(full_target)
61e254526f0fe5d22681555bd4a00b7ee96fee1dc1Paul Duffin$(ANDROID_TEST_MOCK_OUTPUT_REMOVED_API_FILE): $(full_target)
62e254526f0fe5d22681555bd4a00b7ee96fee1dc1Paul Duffin
63e254526f0fe5d22681555bd4a00b7ee96fee1dc1Paul Duffin# Build the android.test.mock.stubs library
64e254526f0fe5d22681555bd4a00b7ee96fee1dc1Paul Duffin# =========================================
65e254526f0fe5d22681555bd4a00b7ee96fee1dc1Paul Duffininclude $(CLEAR_VARS)
66e254526f0fe5d22681555bd4a00b7ee96fee1dc1Paul Duffin
67e254526f0fe5d22681555bd4a00b7ee96fee1dc1Paul DuffinLOCAL_MODULE := android.test.mock.stubs
68e254526f0fe5d22681555bd4a00b7ee96fee1dc1Paul Duffin
69e254526f0fe5d22681555bd4a00b7ee96fee1dc1Paul DuffinLOCAL_SOURCE_FILES_ALL_GENERATED := true
70e254526f0fe5d22681555bd4a00b7ee96fee1dc1Paul Duffin
71e254526f0fe5d22681555bd4a00b7ee96fee1dc1Paul Duffin# Make sure to run droiddoc first to generate the stub source files.
72e254526f0fe5d22681555bd4a00b7ee96fee1dc1Paul DuffinLOCAL_ADDITIONAL_DEPENDENCIES := $(android_test_mock_gen_stamp)
73e254526f0fe5d22681555bd4a00b7ee96fee1dc1Paul Duffinandroid_test_mock_gen_stamp :=
74e254526f0fe5d22681555bd4a00b7ee96fee1dc1Paul Duffin
75bd97e3dd4e5d395f336114016b000ef3cfb26053Paul DuffinLOCAL_SDK_VERSION := current
76bd97e3dd4e5d395f336114016b000ef3cfb26053Paul Duffin
77e254526f0fe5d22681555bd4a00b7ee96fee1dc1Paul Duffininclude $(BUILD_STATIC_JAVA_LIBRARY)
78e254526f0fe5d22681555bd4a00b7ee96fee1dc1Paul Duffin
79e254526f0fe5d22681555bd4a00b7ee96fee1dc1Paul Duffin# Archive a copy of the classes.jar in SDK build.
80e254526f0fe5d22681555bd4a00b7ee96fee1dc1Paul Duffin$(call dist-for-goals,sdk win_sdk,$(full_classes_jar):android.test.mock.stubs.jar)
81e254526f0fe5d22681555bd4a00b7ee96fee1dc1Paul Duffin
82e254526f0fe5d22681555bd4a00b7ee96fee1dc1Paul Duffin# Check that the android.test.mock.stubs library has not changed
83e254526f0fe5d22681555bd4a00b7ee96fee1dc1Paul Duffin# ==============================================================
84e254526f0fe5d22681555bd4a00b7ee96fee1dc1Paul Duffin
85e254526f0fe5d22681555bd4a00b7ee96fee1dc1Paul Duffin# Check that the API we're building hasn't changed from the not-yet-released
86e254526f0fe5d22681555bd4a00b7ee96fee1dc1Paul Duffin# SDK version.
87e254526f0fe5d22681555bd4a00b7ee96fee1dc1Paul Duffin$(eval $(call check-api, \
88e254526f0fe5d22681555bd4a00b7ee96fee1dc1Paul Duffin    check-android-test-mock-api-current, \
89e254526f0fe5d22681555bd4a00b7ee96fee1dc1Paul Duffin    $(ANDROID_TEST_MOCK_API_FILE), \
90e254526f0fe5d22681555bd4a00b7ee96fee1dc1Paul Duffin    $(ANDROID_TEST_MOCK_OUTPUT_API_FILE), \
91e254526f0fe5d22681555bd4a00b7ee96fee1dc1Paul Duffin    $(ANDROID_TEST_MOCK_REMOVED_API_FILE), \
92e254526f0fe5d22681555bd4a00b7ee96fee1dc1Paul Duffin    $(ANDROID_TEST_MOCK_OUTPUT_REMOVED_API_FILE), \
93e254526f0fe5d22681555bd4a00b7ee96fee1dc1Paul Duffin    -error 2 -error 3 -error 4 -error 5 -error 6 \
94e254526f0fe5d22681555bd4a00b7ee96fee1dc1Paul Duffin    -error 7 -error 8 -error 9 -error 10 -error 11 -error 12 -error 13 -error 14 -error 15 \
95e254526f0fe5d22681555bd4a00b7ee96fee1dc1Paul Duffin    -error 16 -error 17 -error 18 -error 19 -error 20 -error 21 -error 23 -error 24 \
96e254526f0fe5d22681555bd4a00b7ee96fee1dc1Paul Duffin    -error 25 -error 26 -error 27, \
97e254526f0fe5d22681555bd4a00b7ee96fee1dc1Paul Duffin    cat $(LOCAL_PATH)/api/apicheck_msg_android_test_mock.txt, \
98e254526f0fe5d22681555bd4a00b7ee96fee1dc1Paul Duffin    check-android-test-mock-api, \
99e254526f0fe5d22681555bd4a00b7ee96fee1dc1Paul Duffin    $(call doc-timestamp-for,android-test-mock-api-stubs-gen) \
100e254526f0fe5d22681555bd4a00b7ee96fee1dc1Paul Duffin    ))
101e254526f0fe5d22681555bd4a00b7ee96fee1dc1Paul Duffin
102e254526f0fe5d22681555bd4a00b7ee96fee1dc1Paul Duffin.PHONY: check-android-test-mock-api
103e254526f0fe5d22681555bd4a00b7ee96fee1dc1Paul Duffincheckapi: check-android-test-mock-api
104e254526f0fe5d22681555bd4a00b7ee96fee1dc1Paul Duffin
105e254526f0fe5d22681555bd4a00b7ee96fee1dc1Paul Duffin.PHONY: update-android-test-mock-api
106e254526f0fe5d22681555bd4a00b7ee96fee1dc1Paul Duffinupdate-api: update-android-test-mock-api
107e254526f0fe5d22681555bd4a00b7ee96fee1dc1Paul Duffin
108e254526f0fe5d22681555bd4a00b7ee96fee1dc1Paul Duffinupdate-android-test-mock-api: $(ANDROID_TEST_MOCK_OUTPUT_API_FILE) | $(ACP)
109e254526f0fe5d22681555bd4a00b7ee96fee1dc1Paul Duffin	@echo Copying current.txt
110e254526f0fe5d22681555bd4a00b7ee96fee1dc1Paul Duffin	$(hide) $(ACP) $(ANDROID_TEST_MOCK_OUTPUT_API_FILE) $(ANDROID_TEST_MOCK_API_FILE)
111e254526f0fe5d22681555bd4a00b7ee96fee1dc1Paul Duffin	@echo Copying removed.txt
112e254526f0fe5d22681555bd4a00b7ee96fee1dc1Paul Duffin	$(hide) $(ACP) $(ANDROID_TEST_MOCK_OUTPUT_REMOVED_API_FILE) $(ANDROID_TEST_MOCK_REMOVED_API_FILE)
113e254526f0fe5d22681555bd4a00b7ee96fee1dc1Paul Duffin
114e254526f0fe5d22681555bd4a00b7ee96fee1dc1Paul Duffinendif  # not TARGET_BUILD_APPS not TARGET_BUILD_PDK=true
115