Reputation: 24857
I'm having trouble adding a set of prebuilt apk's to my custom build of AOSP. What I am trying to accomplish is to allow developers of these apps to simply drop them in a directory under source control and the next CI build of the image will just include those applications. I have tried this using the code below to add all apks inside the included_apks
directory but it's not working as expected.
define add_included_apks
include $(CLEAR_VARS)
LOCAL_MODULE := $(1:included_apks/%.apk=%)
LOCAL_MODULE_TAGS := eng userdebug
LOCAL_MODULE_CLASS := APPS
LOCAL_MODULE_SUFFIX := $(COMMON_ANDROID_PACKAGE_SUFFIX)
LOCAL_SRC_FILES := $1
LOCAL_CERTIFICATE := PRESIGNED
include $(BUILD_PREBUILT)
endef
APKS := $(call find-subdir-subdir-files, included_apks, '*.apk')
$(foreach item, $(APKS), $(eval $(call add_included_apks, $(item))))
The problem with this approach seems to be inside the add_included_apks
function and how it is evaluated. When I print out $(1:included_apks/%.apk=%)
it's the correct value but if I print out LOCAL_MODULE
it's the last value set on it before this loop even though I'm calling include $(CLEAR_VARS)
. And in the end the module is not included in the system image. Am I misunderstanding how a foreach
call works in a make file?
Edit Answer is correct, but the real AOSP bug is this:
The LOCAL_MODULE_TAGS := eng userdebug
should be LOCAL_MODULE_TAGS := eng debug
to be included in a userdebug build variant. The make syntax was correct for what I was attempting to do.
Upvotes: 1
Views: 689
Reputation: 721
'LOCAL_MODULE_TAGS := eng debug'
will not include this in user builds, but eng and userdebug. If you want to have it included in user builds. It has to be 'optional'
and your device/.../BoardConfig.mk
has to add those into:
PRODUCT_PACKAGES += your_local_module1 \
your_local_module2 end so on...
Upvotes: 0
Reputation: 1008
When you want to print inside a define like that you have to escape the $ with another $.
define add_included_apks
include $(CLEAR_VARS)
LOCAL_MODULE := $(1:included_apks/%.apk=%)
$$(error $$(LOCAL_MODULE))
LOCAL_MODULE_TAGS := eng userdebug
LOCAL_MODULE_CLASS := APPS
LOCAL_MODULE_SUFFIX := $(COMMON_ANDROID_PACKAGE_SUFFIX)
LOCAL_SRC_FILES := $1
LOCAL_CERTIFICATE := PRESIGNED
include $(BUILD_PREBUILT)
endef
Upvotes: 3