1#
2# Copyright (C) 2020 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# Check whether there is any module that isn't available for platform
18# is installed to the platform.
19
20# Filter FAKE and NON_INSTALLABLE modules out and then collect those are not
21# available for platform
22_modules_not_available_for_platform := \
23$(strip $(foreach m,$(product_MODULES),\
24  $(if $(filter-out FAKE,$(ALL_MODULES.$(m).CLASS)),\
25    $(if $(ALL_MODULES.$(m).INSTALLED),\
26      $(if $(filter true,$(ALL_MODULES.$(m).NOT_AVAILABLE_FOR_PLATFORM)),\
27        $(m))))))
28
29_violators_with_path := $(foreach m,$(sort $(_modules_not_available_for_platform)),\
30    $(m):$(word 1,$(ALL_MODULES.$(m).PATH))\
31)
32
33$(call maybe-print-list-and-error,$(_violators_with_path),\
34Following modules are requested to be installed. But are not available \
35for platform because they do not have "//apex_available:platform" or \
36they depend on other modules that are not available for platform)
37