• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#
2# Copyright (C) 2011 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# Restrict the vendor module owners here.
18_vendor_owner_whitelist := \
19        asus \
20        audience \
21        broadcom \
22        csr \
23        elan \
24        google \
25        imgtec \
26        invensense \
27        lge \
28        nvidia \
29        nxp \
30        qcom \
31        samsung \
32        samsung_arm \
33        ti \
34        trusted_logic \
35        widevine
36
37
38ifneq (,$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_RESTRICT_VENDOR_FILES))
39
40_vendor_check_modules := $(sort $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_PACKAGES))
41$(call expand-required-modules,_vendor_check_modules,$(_vendor_check_modules))
42
43_vendor_module_owner_info :=
44# Restrict owners
45ifneq (,$(filter true owner all, $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_RESTRICT_VENDOR_FILES)))
46
47ifneq (,$(filter vendor/%, $(PRODUCT_PACKAGE_OVERLAYS) $(DEVICE_PACKAGE_OVERLAYS)))
48$(error Error: Product "$(TARGET_PRODUCT)" cannot have overlay in vendor tree: \
49    $(filter vendor/%, $(PRODUCT_PACKAGE_OVERLAYS) $(DEVICE_PACKAGE_OVERLAYS)))
50endif
51_vendor_check_copy_files := $(filter vendor/%, $(PRODUCT_COPY_FILES))
52ifneq (,$(_vendor_check_copy_files))
53$(foreach c, $(_vendor_check_copy_files), \
54  $(if $(filter $(_vendor_owner_whitelist), $(call word-colon,3,$(c))),,\
55    $(error Error: vendor PRODUCT_COPY_FILES file "$(c)" has unknown owner))\
56  $(eval _vendor_module_owner_info += $(call word-colon,2,$(c)):$(call word-colon,3,$(c))))
57endif
58_vendor_check_copy_files :=
59
60$(foreach m, $(_vendor_check_modules), \
61  $(if $(filter vendor/%, $(ALL_MODULES.$(m).PATH)),\
62    $(if $(filter $(_vendor_owner_whitelist), $(ALL_MODULES.$(m).OWNER)),,\
63      $(error Error: vendor module "$(m)" in $(ALL_MODULES.$(m).PATH) with unknown owner \
64        "$(ALL_MODULES.$(m).OWNER)" in product "$(TARGET_PRODUCT)"))\
65    $(if $(ALL_MODULES.$(m).INSTALLED),\
66      $(eval _vendor_module_owner_info += $(patsubst $(PRODUCT_OUT)/%,%,$(ALL_MODULES.$(m).INSTALLED)):$(ALL_MODULES.$(m).OWNER)))))
67
68endif
69
70
71# Restrict paths
72ifneq (,$(filter path all, $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_RESTRICT_VENDOR_FILES)))
73
74$(foreach m, $(_vendor_check_modules), \
75  $(if $(filter vendor/%, $(ALL_MODULES.$(m).PATH)),\
76    $(if $(filter $(TARGET_OUT_VENDOR)/%, $(ALL_MODULES.$(m).INSTALLED)),,\
77      $(error Error: vendor module "$(m)" in $(ALL_MODULES.$(m).PATH) \
78        in product "$(TARGET_PRODUCT)" being installed to \
79        $(ALL_MODULES.$(m).INSTALLED) which is not in the vendor tree))))
80
81endif
82
83_vendor_module_owner_info_txt := $(call intermediates-dir-for,PACKAGING,vendor_owner_info)/vendor_owner_info.txt
84$(_vendor_module_owner_info_txt): PRIVATE_INFO := $(_vendor_module_owner_info)
85$(_vendor_module_owner_info_txt):
86	@echo "Write vendor module owner info $@"
87	@mkdir -p $(dir $@) && rm -f $@
88ifdef _vendor_module_owner_info
89	@for w in $(PRIVATE_INFO); \
90	  do \
91	    echo $$w >> $@; \
92	done
93else
94	@echo "No vendor module owner info." > $@
95endif
96
97$(call dist-for-goals, droidcore, $(_vendor_module_owner_info_txt))
98
99_vendor_module_owner_info_txt :=
100_vendor_module_owner_info :=
101_vendor_check_modules :=
102endif
103