• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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# Skip for unbundled builds that don't produce a platform image.
21ifeq (,$(TARGET_BUILD_UNBUNDLED))
22
23# Filter FAKE and NON_INSTALLABLE modules out and then collect those are not
24# available for platform
25_modules_not_available_for_platform := \
26$(strip $(foreach m,$(product_MODULES),\
27  $(if $(filter-out FAKE,$(ALL_MODULES.$(m).CLASS)),\
28    $(if $(ALL_MODULES.$(m).INSTALLED),\
29      $(if $(filter true,$(ALL_MODULES.$(m).NOT_AVAILABLE_FOR_PLATFORM)),\
30        $(m))))))
31
32ifndef ALLOW_MISSING_DEPENDENCIES
33  _violators_with_path := $(foreach m,$(sort $(_modules_not_available_for_platform)),\
34    $(m):$(word 1,$(ALL_MODULES.$(m).PATH))\
35  )
36
37  $(call maybe-print-list-and-error,$(_violators_with_path),\
38Following modules are requested to be installed. But are not available \
39for platform because they do not have "//apex_available:platform" or \
40they depend on other modules that are not available for platform)
41
42else
43
44# Don't error out immediately when ALLOW_MISSING_DEPENDENCIES is set.
45# Instead, add a dependency on a rule that prints the error message.
46  define not_available_for_platform_rule
47    not_installable_file := $(patsubst $(OUT_DIR)/%,$(OUT_DIR)/NOT_AVAILABLE_FOR_PLATFORM/%,$(1))
48    $(1): $$(not_installable_file)
49    $$(not_installable_file):
50	$(call echo-error,$(2),Module is requested to be installed but is not \
51available for platform because it does not have "//apex_available:platform" or \
52it depends on other modules that are not available for platform.)
53	exit 1
54  endef
55
56  $(foreach m,$(_modules_not_available_for_platform),\
57    $(foreach i,$(filter-out $(HOST_OUT)/%,$(ALL_MODULES.$(m).INSTALLED)),\
58      $(eval $(call not_available_for_platform_rule,$(i),$(m)))))
59endif
60
61endif
62