@ -677,6 +677,16 @@ $(hide) echo '' >> $5
e n d e f
# -----------------------------------------------------------------
# Merge an individual apkcerts output into the final apkcerts.txt output.
# Use a macro to make it compatible with _apkcerts_write_line
# $1 apkcerts file to be merged
# $2 output file
d e f i n e _ a p k c e r t s _ m e r g e
$( hide ) c a t $ 1 > > $ 2
e n d e f
name := $( TARGET_PRODUCT)
i f e q ( $( TARGET_BUILD_TYPE ) , d e b u g )
name := $( name) _debug
@ -685,6 +695,8 @@ name := $(name)-apkcerts-$(FILE_NAME_TAG)
intermediates := \
$( call intermediates-dir-for,PACKAGING,apkcerts)
APKCERTS_FILE := $( intermediates) /$( name) .txt
all_apkcerts_files := $( sort $( foreach p,$( PACKAGES) ,$( PACKAGES.$( p) .APKCERTS_FILE) ) )
$(APKCERTS_FILE) : $( all_apkcerts_files )
# We don't need to really build all the modules.
# TODO: rebuild APKCERTS_FILE if any app change its cert.
$(APKCERTS_FILE) :
@ -692,9 +704,11 @@ $(APKCERTS_FILE):
@mkdir -p $( dir $@ )
@rm -f $@
$( foreach p,$( PACKAGES) ,\
$( if $( PACKAGES.$( p) .EXTERNAL_KEY) ,\
$( call _apkcerts_write_line,$( p) ,"EXTERNAL" ,"" ,$( PACKAGES.$( p) .COMPRESSED) ,$@ ) ,\
$( call _apkcerts_write_line,$( p) ,$( PACKAGES.$( p) .CERTIFICATE) ,$( PACKAGES.$( p) .PRIVATE_KEY) ,$( PACKAGES.$( p) .COMPRESSED) ,$@ ) ) )
$( if $( PACKAGES.$( p) .APKCERTS_FILE) ,\
$( call _apkcerts_merge,$( PACKAGES.$( p) .APKCERTS_FILE) , $@ ) ,\
$( if $( PACKAGES.$( p) .EXTERNAL_KEY) ,\
$( call _apkcerts_write_line,$( p) ,"EXTERNAL" ,"" ,$( PACKAGES.$( p) .COMPRESSED) ,$@ ) ,\
$( call _apkcerts_write_line,$( p) ,$( PACKAGES.$( p) .CERTIFICATE) ,$( PACKAGES.$( p) .PRIVATE_KEY) ,$( PACKAGES.$( p) .COMPRESSED) ,$@ ) ) ) )
# In case value of PACKAGES is empty.
$( hide) touch $@