2 # Copyright (C) 2011 The Android Open Source Project
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
8 # http://www.apache.org/licenses/LICENSE-2.0
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.
17 # Restrict the vendor module owners here.
18 _vendor_owner_whitelist := \
49 ifneq (,$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_RESTRICT_VENDOR_FILES))
51 _vendor_check_modules := $(product_MODULES)
53 _vendor_module_owner_info :=
55 ifneq (,$(filter true owner all, $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_RESTRICT_VENDOR_FILES)))
57 ifneq (,$(filter vendor/%, $(PRODUCT_PACKAGE_OVERLAYS) $(DEVICE_PACKAGE_OVERLAYS)))
58 $(error Error: Product "$(TARGET_PRODUCT)" cannot have overlay in vendor tree: \
59 $(filter vendor/%, $(PRODUCT_PACKAGE_OVERLAYS) $(DEVICE_PACKAGE_OVERLAYS)))
61 _vendor_check_copy_files := $(filter vendor/%, $(PRODUCT_COPY_FILES))
62 ifneq (,$(_vendor_check_copy_files))
63 $(foreach c, $(_vendor_check_copy_files), \
64 $(if $(filter $(_vendor_owner_whitelist), $(call word-colon,3,$(c))),,\
65 $(error Error: vendor PRODUCT_COPY_FILES file "$(c)" has unknown owner))\
66 $(eval _vendor_module_owner_info += $(call word-colon,2,$(c)):$(call word-colon,3,$(c))))
68 _vendor_check_copy_files :=
70 $(foreach m, $(_vendor_check_modules), \
71 $(if $(filter vendor/%, $(ALL_MODULES.$(m).PATH)),\
72 $(if $(filter-out FAKE, $(ALL_MODULES.$(m).CLASS)),\
73 $(if $(filter $(_vendor_owner_whitelist), $(ALL_MODULES.$(m).OWNER)),,\
74 $(error Error: vendor module "$(m)" in $(ALL_MODULES.$(m).PATH) with unknown owner \
75 "$(ALL_MODULES.$(m).OWNER)" in product "$(TARGET_PRODUCT)"))\
76 $(if $(ALL_MODULES.$(m).INSTALLED),\
77 $(eval _vendor_module_owner_info += $(patsubst $(PRODUCT_OUT)/%,%,$(ALL_MODULES.$(m).INSTALLED)):$(ALL_MODULES.$(m).OWNER))))))
83 ifneq (,$(filter path all, $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_RESTRICT_VENDOR_FILES)))
85 $(foreach m, $(_vendor_check_modules), \
86 $(if $(filter vendor/%, $(ALL_MODULES.$(m).PATH)),\
87 $(if $(filter-out FAKE, $(ALL_MODULES.$(m).CLASS)),\
88 $(if $(filter-out ,$(ALL_MODULES.$(m).INSTALLED)),\
89 $(if $(filter $(TARGET_OUT_VENDOR)/% $(HOST_OUT)/%, $(ALL_MODULES.$(m).INSTALLED)),,\
90 $(error Error: vendor module "$(m)" in $(ALL_MODULES.$(m).PATH) \
91 in product "$(TARGET_PRODUCT)" being installed to \
92 $(ALL_MODULES.$(m).INSTALLED) which is not in the vendor tree))))))
96 _vendor_module_owner_info_txt := $(call intermediates-dir-for,PACKAGING,vendor_owner_info)/vendor_owner_info.txt
97 $(_vendor_module_owner_info_txt): PRIVATE_INFO := $(_vendor_module_owner_info)
98 $(_vendor_module_owner_info_txt):
99 @echo "Write vendor module owner info $@"
100 @mkdir -p $(dir $@) && rm -f $@
101 ifdef _vendor_module_owner_info
102 @for w in $(PRIVATE_INFO); \
107 @echo "No vendor module owner info." > $@
110 $(call dist-for-goals, droidcore, $(_vendor_module_owner_info_txt))
112 _vendor_module_owner_info_txt :=
113 _vendor_module_owner_info :=
114 _vendor_check_modules :=