打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
Android编译PRODUCT

Android编译脚本中,PRODUCT_COPY_FILES保存的是一组src:dest的字符串列表,如果碰到里面有重复的dest怎么办?


参见/build/core/Makefile中关于其处理:
  1. # filter out the duplicate <source file>:<dest file> pairs.  
  2. unique_product_copy_files_pairs :=  
  3. $(foreach cf,$(PRODUCT_COPY_FILES), \  
  4.     $(if $(filter $(unique_product_copy_files_pairs),$(cf)),,\  
  5.         $(eval unique_product_copy_files_pairs += $(cf))))  

  1. unique_product_copy_files_destinations :=  
  2. $(foreach cf,$(unique_product_copy_files_pairs), \  
  3.     $(eval _src := $(call word-colon,1,$(cf))) \  
  4.     $(eval _dest := $(call word-colon,2,$(cf))) \  
  5.     $(call check-product-copy-files,$(cf)) \  
  6.     $(if $(filter $(unique_product_copy_files_destinations),$(_dest)), \  
  7.         $(info PRODUCT_COPY_FILES $(cf) ignored.), \  
  8.         $(eval _fulldest := $(call append-path,$(PRODUCT_OUT),$(_dest))) \  
  9.         $(if $(filter %.xml,$(_dest)),\  
  10.             $(eval $(call copy-xml-file-checked,$(_src),$(_fulldest))),\  
  11.             $(eval $(call copy-one-file,$(_src),$(_fulldest)))) \  
  12.         $(eval ALL_DEFAULT_INSTALLED_MODULES += $(_fulldest)) \  
  13.         $(eval unique_product_copy_files_destinations += $(_dest))))  

明显,第一部将src:dest的重复去除,第二步,将dest的重复去除。

从去除重复的算法来看,是从第一个字符串开始,如果目标中没有就添加,如果已经有就不做任何处理,因此只有最先描述的目标有效。

如果在两个地方定义system/etc/apns-conf.xml:

  1. ./device/lge/mako/full_mako.mk:28:PRODUCT_COPY_FILES := device/lge/mako/apns-full-conf.xml:system/etc/apns-conf.xml  
  2. ./build/target/product/full_base_telephony.mk:PRODUCT_COPY_FILES :=  device/generic/goldfish/data/etc/apns-conf.xml:system/etc/apns-conf.xml   

则先出现定义的有效,即device/lge/mako/apns-full-conf.xml会有效。


本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
Android 的main.mk完整分析
Ant学习指南
让外语APP统统显示中国话
诗意代码 – PoemCode ? Android SDK Add
原创|高潜学习笔记:初识Android应用的逆向解析
Android逆向之旅---反编译利器Apktool和Jadx源码分析以及错误纠正
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服