Bug 1065773 - Part 1: Extract Android release signing bits into config/android-common.mk. r=mshal
authorNick Alexander <nalexander@mozilla.com>
Fri, 19 Sep 2014 13:52:54 -0700
changeset 206263 7897c831b7a7900cd99802b62762d1a1193c57f8
parent 206262 dca3955efe70afc240cc71287e531ab3e16a5688
child 206264 a044f9ca2e1be2a5512b51a8aff35f2ddb0f9941
push id8865
push usernalexander@mozilla.com
push dateFri, 19 Sep 2014 20:53:48 +0000
treeherderfx-team@3a8b8b81aeb9 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmshal
bugs1065773
milestone35.0a1
Bug 1065773 - Part 1: Extract Android release signing bits into config/android-common.mk. r=mshal
config/android-common.mk
toolkit/mozapps/installer/packager.mk
--- a/config/android-common.mk
+++ b/config/android-common.mk
@@ -9,16 +9,32 @@ ifndef ANDROID_SDK
 endif
 
 # DEBUG_JARSIGNER always debug signs.
 DEBUG_JARSIGNER=$(PYTHON) $(abspath $(topsrcdir)/mobile/android/debug_sign_tool.py) \
   --keytool=$(KEYTOOL) \
   --jarsigner=$(JARSIGNER) \
   $(NULL)
 
+# RELEASE_JARSIGNER release signs if possible.
+ifdef MOZ_SIGN_CMD
+RELEASE_JARSIGNER := $(MOZ_SIGN_CMD) -f jar
+else
+RELEASE_JARSIGNER := $(DEBUG_JARSIGNER)
+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)
+RELEASE_SIGN_ANDROID_APK = \
+  cp $(1) $(2)-unaligned.apk && \
+  $(RELEASE_JARSIGNER) $(2)-unaligned.apk && \
+  $(ZIPALIGN) -f -v 4 $(2)-unaligned.apk $(2) && \
+  $(RM) $(2)-unaligned.apk
+
 # For Android, this defaults to $(ANDROID_SDK)/android.jar
 ifndef JAVA_BOOTCLASSPATH
   JAVA_BOOTCLASSPATH = $(ANDROID_SDK)/android.jar
 endif
 
 # For Android, we default to 1.7
 ifndef JAVA_VERSION
   JAVA_VERSION = 1.7
--- a/toolkit/mozapps/installer/packager.mk
+++ b/toolkit/mozapps/installer/packager.mk
@@ -272,24 +272,16 @@ INNER_UNMAKE_PACKAGE = $(error Try using
 endif #Create an RPM file
 
 
 ifeq ($(MOZ_PKG_FORMAT),APK)
 
 JAVA_CLASSPATH = $(ANDROID_SDK)/android.jar
 include $(MOZILLA_DIR)/config/android-common.mk
 
-# DEBUG_JARSIGNER is defined by android-common.mk and always debug
-# signs.  We want to release sign if possible.
-ifdef MOZ_SIGN_CMD
-RELEASE_JARSIGNER := $(MOZ_SIGN_CMD) -f jar
-else
-RELEASE_JARSIGNER := $(DEBUG_JARSIGNER)
-endif
-
 DIST_FILES =
 
 # Place the files in the order they are going to be opened by the linker
 DIST_FILES += libmozalloc.so
 ifndef MOZ_FOLD_LIBS
 DIST_FILES += \
   libnspr4.so \
   libplc4.so \
@@ -350,24 +342,16 @@ UPLOAD_EXTRA_FILES += robocop.apk
 UPLOAD_EXTRA_FILES += fennec_ids.txt
 UPLOAD_EXTRA_FILES += geckoview_library/geckoview_library.zip
 UPLOAD_EXTRA_FILES += geckoview_library/geckoview_assets.zip
 UPLOAD_EXTRA_FILES += ../embedding/android/geckoview_example/geckoview_example.apk
 
 # Robocop/Robotium tests, Android Background tests, and Fennec need to
 # be signed with the same key, which means release signing them all.
 
-# $(1) is the full path to input:  foo-debug-unsigned-unaligned.apk.
-# $(2) is the full path to output: foo.apk.
-RELEASE_SIGN_ANDROID_APK = \
-  cp $(1) $(2)-unaligned.apk && \
-  $(RELEASE_JARSIGNER) $(2)-unaligned.apk && \
-  $(ZIPALIGN) -f -v 4 $(2)-unaligned.apk $(2) && \
-  $(RM) $(2)-unaligned.apk
-
 ROBOCOP_PATH = $(abspath $(_ABS_DIST)/../build/mobile/robocop)
 # Normally, $(NSINSTALL) would be used instead of cp, but INNER_ROBOCOP_PACKAGE
 # is used in a series of commands that run under a "cd something", while
 # $(NSINSTALL) is relative.
 INNER_ROBOCOP_PACKAGE= \
   cp $(GECKO_APP_AP_PATH)/fennec_ids.txt $(_ABS_DIST) && \
   $(call RELEASE_SIGN_ANDROID_APK,$(ROBOCOP_PATH)/robocop-debug-unsigned-unaligned.apk,$(_ABS_DIST)/robocop.apk)