Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

overriding PRODUCT_COPY_FILES entries

631 views
Skip to first unread message

Testing 33

unread,
Jul 8, 2024, 12:34:34 PM7/8/24
to Android Building
Hi, can we override specific PRODUCT_COPY_FILES entry ?
Example: if A.mk and B.mk are copying different files but at same destination. then i want that B.mk's PRODUCT_COPY_FILES line should override A.mk and that too without making any changes in A.mk.

chris simmonds

unread,
Jul 9, 2024, 11:54:42 AM7/9/24
to android-...@googlegroups.com
Yes, make sure that B.mk is parsed before A.mk, because it is the first PRODUCT_COPY_FILES for a given destination that matters. For example, if I want to override the init.cutf_cvm.rc provided by aosp_cf.mk I can do it like this:

PRODUCT_COPY_FILES += $(LOCAL_PATH)/init.cutf_cvm.rc:vendor/etc/init/hw/init.cutf_cvm.rc
$(call inherit-product, device/google/cuttlefish/vsoc_x86_64/phone/aosp_cf.mk)

I suspect this works "by accident", but I have been using this trick in my device config for many years so I think it is reliable

HTH,
Chris Simmonds

On Mon, 8 Jul 2024 at 17:34, Testing 33 <testing...@gmail.com> wrote:
Hi, can we override specific PRODUCT_COPY_FILES entry ?
Example: if A.mk and B.mk are copying different files but at same destination. then i want that B.mk's PRODUCT_COPY_FILES line should override A.mk and that too without making any changes in A.mk.

--
--
You received this message because you are subscribed to the "Android Building" mailing list.
To post to this group, send email to android-...@googlegroups.com
To unsubscribe from this group, send email to
android-buildi...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-building?hl=en

---
You received this message because you are subscribed to the Google Groups "Android Building" group.
To unsubscribe from this group and stop receiving emails from it, send an email to android-buildi...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/android-building/a628996b-6338-4a96-b00c-ba357e8fcdb1n%40googlegroups.com.

Dan Willemsen

unread,
Jul 9, 2024, 12:20:34 PM7/9/24
to android-...@googlegroups.com
Yes, the "first" entry in PRODUCT_COPY_FILES for a destination wins, and any others are ignored (and written to $OUT/product_copy_files_ignored.txt during `dist` builds, though you can explicitly ask for it to be built with `m` as well).

"first" can be a complicated topic with inherit-product however, so I'd recommend verifying your changes carefully. The order between local modifications to PRODUCT_* variables and inherit-product within a makefile doesn't matter -- inherit-product just saves a list of files to be included later, then combined into the inheritance tree.

- Dan

Reply all
Reply to author
Forward
0 new messages