1#
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
17###########################################################
18## Rules for resolving Support Library dependencies.
19##
20## The following variables may be modified:
21## - LOCAL_JAVA_LIBRARIES
22## - LOCAL_STATIC_JAVA_LIBRARIES
23## - LOCAL_SHARED_ANDROID_LIBRARIES
24## - LOCAL_STATIC_ANDROID_LIBRARIES
25###########################################################
26
27# Some projects don't work correctly yet. Allow them to skip resolution.
28ifndef LOCAL_DISABLE_RESOLVE_SUPPORT_LIBRARIES
29
30# Aggregate all requested Support Library modules.
31requested_support_libs := $(filter $(SUPPORT_LIBRARIES_JARS) $(SUPPORT_LIBRARIES_AARS), \
32    $(LOCAL_JAVA_LIBRARIES) $(LOCAL_STATIC_JAVA_LIBRARIES) \
33    $(LOCAL_SHARED_ANDROID_LIBRARIES) $(LOCAL_STATIC_ANDROID_LIBRARIES))
34
35# Filter the Support Library modules out of the library variables. We don't
36# trust developers to get these right, so they will be added back by the
37# build system based on the output of this file and the type of build.
38LOCAL_JAVA_LIBRARIES := $(filter-out $(requested_support_libs), \
39    $(LOCAL_JAVA_LIBRARIES))
40LOCAL_STATIC_JAVA_LIBRARIES := $(filter-out $(requested_support_libs), \
41    $(LOCAL_STATIC_JAVA_LIBRARIES))
42LOCAL_SHARED_ANDROID_LIBRARIES := $(filter-out $(requested_support_libs), \
43    $(LOCAL_SHARED_ANDROID_LIBRARIES))
44LOCAL_STATIC_ANDROID_LIBRARIES := $(filter-out $(requested_support_libs), \
45    $(LOCAL_STATIC_ANDROID_LIBRARIES))
46
47LOCAL_STATIC_ANDROID_LIBRARIES := $(strip $(LOCAL_STATIC_ANDROID_LIBRARIES) \
48    $(filter $(SUPPORT_LIBRARIES_AARS),$(requested_support_libs)))
49LOCAL_STATIC_JAVA_LIBRARIES := $(strip $(LOCAL_STATIC_JAVA_LIBRARIES) \
50    $(filter $(SUPPORT_LIBRARIES_JARS),$(requested_support_libs)))
51
52endif #LOCAL_DISABLE_RESOLVE_SUPPORT_LIBRARIES
53LOCAL_DISABLE_RESOLVE_SUPPORT_LIBRARIES :=
54