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