1#
2# Copyright (C) 2014 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#########################################
20# The prebuilt support libraries.
21
22include $(CLEAR_VARS)
23
24define define-prebuilt
25    $(eval tw := $(subst :, ,$(strip $(1)))) \
26    $(eval include $(CLEAR_VARS)) \
27    $(eval LOCAL_MODULE := $(word 1,$(tw))) \
28    $(eval LOCAL_MODULE_TAGS := optional) \
29    $(eval LOCAL_MODULE_CLASS := JAVA_LIBRARIES) \
30    $(eval LOCAL_SRC_FILES := $(word 2,$(tw))) \
31    $(eval LOCAL_UNINSTALLABLE_MODULE := true) \
32    $(eval LOCAL_SDK_VERSION := current) \
33    $(eval include $(BUILD_PREBUILT))
34endef
35
36# For apps (unbundled) build, replace the typical
37# make target artifacts with prebuilts.
38ifneq (,$(TARGET_BUILD_APPS)$(filter true,$(TARGET_BUILD_PDK)))
39    # Set up prebuilts for Multidex library artifacts.
40    multidex_jars := \
41      $(patsubst $(LOCAL_PATH)/%,%,\
42        $(shell find $(LOCAL_PATH)/multidex -name "*.jar"))
43    prebuilts := $(foreach jar,$(multidex_jars),\
44        $(basename $(notdir $(jar))):$(jar))
45
46    # Set up prebuilts for optional libraries. Need to specify them explicitly
47    # as the target name does not match the JAR name.
48    prebuilts += \
49        android.test.base.stubs:optional/android.test.base.jar \
50        android.test.mock.stubs:optional/android.test.mock.jar \
51        android.test.runner.stubs:optional/android.test.runner.jar
52
53    $(foreach p,$(prebuilts),\
54        $(call define-prebuilt,$(p)))
55
56    prebuilts :=
57endif  # TARGET_BUILD_APPS not empty or TARGET_BUILD_PDK set to True
58
59
60# Include all Support Library modules as prebuilts.
61include $(call all-makefiles-under,$(LOCAL_PATH))
62