Fix depfile output from dexpreopt strip script

strip.sh uses $2.d to write the depfile, while this had been passing in
$@.tmp in as $2. Instead, move the file first, then use strip.sh with
the real output file so that we can find the depfile.

Also don't specify a depfile (or other dependencies) when
LOCAL_CERTIFICATE==PRESIGNED, as we'll skip all of that in the rule in
that case.

Bug: 121058584
Test: NINJA_ARGS="-w missingdepfile=true" m
Change-Id: I1323e775e3a6ce5a06a19d59f3fb07495f116f34
This commit is contained in:
Dan Willemsen 2019-01-07 13:58:37 -08:00
parent 4ab7bb3ee8
commit 07b73576e4
2 changed files with 6 additions and 4 deletions

View File

@ -678,8 +678,8 @@ ifneq ($(BUILD_PLATFORM_ZIP),)
@# Keep a copy of apk with classes.dex unstripped
$(hide) cp -f $@ $(dir $@)package.dex.apk
endif # BUILD_PLATFORM_ZIP
$(PRIVATE_STRIP_SCRIPT) $@ $@.tmp
mv -f $@.tmp $@
mv -f $@ $@.tmp
$(PRIVATE_STRIP_SCRIPT) $@.tmp $@
endif # LOCAL_DEX_PREOPT
$(sign-package)
ifdef LOCAL_COMPRESSED_MODULE

View File

@ -357,12 +357,14 @@ endif
ifneq ($(BUILD_PLATFORM_ZIP),)
$(built_module) : .KATI_IMPLICIT_OUTPUTS := $(dir $(LOCAL_BUILT_MODULE))package.dex.apk
endif
ifneq ($(LOCAL_CERTIFICATE),PRESIGNED)
ifdef LOCAL_DEX_PREOPT
$(built_module) : PRIVATE_STRIP_SCRIPT := $(intermediates)/strip.sh
$(built_module) : $(intermediates)/strip.sh
$(built_module) : | $(DEXPREOPT_GEN_DEPS)
$(built_module) : .KATI_DEPFILE := $(built_module).d
endif
endif
$(built_module) : $(my_prebuilt_src_file) | $(ZIPALIGN) $(ZIP2ZIP) $(SIGNAPK_JAR)
$(transform-prebuilt-to-target)
$(uncompress-prebuilt-embedded-jni-libs)
@ -387,8 +389,8 @@ endif
$(run-appcompat)
endif # module_run_appcompat
ifdef LOCAL_DEX_PREOPT
$(PRIVATE_STRIP_SCRIPT) $@ $@.tmp
mv -f $@.tmp $@
mv -f $@ $@.tmp
$(PRIVATE_STRIP_SCRIPT) $@.tmp $@
endif # LOCAL_DEX_PREOPT
$(sign-package)
# No need for align-package because sign-package takes care of alignment