Skip to content

Commit

Permalink
Bug 1258760 - Allow re-signing already signed APK files. r=gps
Browse files Browse the repository at this point in the history
Gradle produces signed, unaligned APK files.  We expect unsigned,
unaligned APK files.  This change discards any existing signature,
turning a signed, unaligned APK into an unsigned, unaligned APK.

Sadly |zip -q| does not silence a warning message about "nothing to
do" so we pipe to /dev/null.

MozReview-Commit-ID: DnSGJCvHsym

--HG--
extra : rebase_source : ee7884847767c0a075e3cfd404ba695d07f47e93
extra : histedit_source : 6aaa07eac03d69668f8556b84d1c1bae51c8ea22
  • Loading branch information
ncalexan committed Mar 15, 2016
1 parent 1783c85 commit f2c9cde
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions config/android-common.mk
Expand Up @@ -24,8 +24,15 @@ endif
# $(1) is the full path to input: foo-debug-unsigned-unaligned.apk.
# $(2) is the full path to output: foo.apk.
# Use this like: $(call RELEASE_SIGN_ANDROID_APK,foo-debug-unsigned-unaligned.apk,foo.apk)
#
# The |zip -d| there to handle re-signing previously signed APKs. Gradle
# produces signed, unaligned APK files, but this expects unsigned, unaligned
# APK files. The |zip -d| discards any existing signature, turning a signed,
# unaligned APK into an unsigned, unaligned APK. Sadly |zip -q| doesn't
# silence a warning about "nothing to do" so we pipe to /dev/null.
RELEASE_SIGN_ANDROID_APK = \
cp $(1) $(2)-unaligned.apk && \
($(ZIP) -d $(2)-unaligned.apk 'META-INF/*' > /dev/null || true) && \
$(RELEASE_JARSIGNER) $(2)-unaligned.apk && \
$(ZIPALIGN) -f -v 4 $(2)-unaligned.apk $(2) && \
$(RM) $(2)-unaligned.apk
Expand Down

0 comments on commit f2c9cde

Please sign in to comment.