2012-05-21 11:12:37 +00:00
|
|
|
# This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
2010-06-21 21:26:55 +00:00
|
|
|
|
2014-06-11 18:00:17 +00:00
|
|
|
# Ensure ANDROID_SDK is defined before including this file.
|
2010-06-21 21:26:55 +00:00
|
|
|
# We use common android defaults for boot class path and java version.
|
|
|
|
ifndef ANDROID_SDK
|
|
|
|
$(error ANDROID_SDK must be defined before including android-common.mk)
|
|
|
|
endif
|
|
|
|
|
2013-06-20 18:50:28 +00:00
|
|
|
# DEBUG_JARSIGNER always debug signs.
|
2013-10-16 22:55:16 +00:00
|
|
|
DEBUG_JARSIGNER=$(PYTHON) $(abspath $(topsrcdir)/mobile/android/debug_sign_tool.py) \
|
2013-06-26 18:49:27 +00:00
|
|
|
--keytool=$(KEYTOOL) \
|
|
|
|
--jarsigner=$(JARSIGNER) \
|
|
|
|
$(NULL)
|
2010-06-21 21:26:55 +00:00
|
|
|
|
2014-09-19 20:52:54 +00:00
|
|
|
# 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)
|
2016-03-15 23:01:44 +00:00
|
|
|
#
|
|
|
|
# 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.
|
2014-09-19 20:52:54 +00:00
|
|
|
RELEASE_SIGN_ANDROID_APK = \
|
|
|
|
cp $(1) $(2)-unaligned.apk && \
|
2016-03-15 23:01:44 +00:00
|
|
|
($(ZIP) -d $(2)-unaligned.apk 'META-INF/*' > /dev/null || true) && \
|
2014-09-19 20:52:54 +00:00
|
|
|
$(RELEASE_JARSIGNER) $(2)-unaligned.apk && \
|
|
|
|
$(ZIPALIGN) -f -v 4 $(2)-unaligned.apk $(2) && \
|
|
|
|
$(RM) $(2)-unaligned.apk
|
|
|
|
|
2014-08-29 10:44:27 +00:00
|
|
|
# For Android, we default to 1.7
|
2010-06-21 21:26:55 +00:00
|
|
|
ifndef JAVA_VERSION
|
2014-08-29 10:44:27 +00:00
|
|
|
JAVA_VERSION = 1.7
|
2010-06-21 21:26:55 +00:00
|
|
|
endif
|
|
|
|
|
|
|
|
JAVAC_FLAGS = \
|
|
|
|
-target $(JAVA_VERSION) \
|
2011-11-15 23:49:21 +00:00
|
|
|
-source $(JAVA_VERSION) \
|
2012-01-05 18:49:33 +00:00
|
|
|
-encoding UTF8 \
|
2012-01-30 18:45:23 +00:00
|
|
|
-g:source,lines \
|
2012-01-28 03:37:05 +00:00
|
|
|
-Werror \
|
2010-06-21 21:26:55 +00:00
|
|
|
$(NULL)
|