gecko/mobile/android/base/Makefile.in
Chris Kitching a053b765bb Bug 913985: Part 3 - Update the annotation processor to generate wrapper classes. r=kats
--HG--
rename : build/annotationProcessors/MethodWithAnnotationInfo.java => build/annotationProcessors/AnnotationInfo.java
rename : build/annotationProcessors/utils/AlphabeticMethodComparator.java => build/annotationProcessors/utils/AlphabeticAnnotatableEntityComparator.java
rename : build/annotationProcessors/utils/GeneratableEntryPointIterator.java => build/annotationProcessors/utils/GeneratableElementIterator.java
2013-11-21 20:41:28 +00:00

263 lines
9.5 KiB
Makefile

# 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/.
DIST_FILES := package-name.txt.in
ifdef MOZ_ANDROID_ANR_REPORTER
DEFINES += -DMOZ_ANDROID_ANR_REPORTER=1
endif
ifneq (,$(findstring -march=armv7,$(OS_CFLAGS)))
MIN_CPU_VERSION=7
else
MIN_CPU_VERSION=5
endif
MOZ_APP_BUILDID=$(shell cat $(DEPTH)/config/buildid)
ifeq (,$(ANDROID_VERSION_CODE))
ifeq ($(CPU_ARCH),arm)
ifeq ($(MIN_CPU_VERSION),7)
ANDROID_VERSION_CODE=$(shell cat $(DEPTH)/config/buildid | cut -c1-10)
else
# decrement the version code by 1 for armv6 builds so armv7 builds will win any compatability ties
ANDROID_VERSION_CODE=$(shell echo $$((`cat $(DEPTH)/config/buildid | cut -c1-10` - 1)))
endif
else #not arm, so x86
# increment the version code by 1 for x86 builds so they are offered to x86 phones that have arm emulators
ANDROID_VERSION_CODE=$(shell echo $$((`cat $(DEPTH)/config/buildid | cut -c1-10` + 1)))
endif
endif
UA_BUILDID=$(shell echo $(ANDROID_VERSION_CODE) | cut -c1-8)
MOZ_BUILD_TIMESTAMP=$(shell echo `$(PYTHON) $(topsrcdir)/toolkit/xre/make-platformini.py --print-timestamp`)
ifdef MOZ_UPDATER
DEFINES += -DMOZ_UPDATER=$(MOZ_UPDATER)
endif
# Mangle our package name to avoid Bug 750548.
DEFINES += \
-DMANGLED_ANDROID_PACKAGE_NAME=$(subst fennec,f3nn3c,$(ANDROID_PACKAGE_NAME)) \
-DANDROID_PACKAGE_NAME=$(ANDROID_PACKAGE_NAME) \
-DANDROID_CPU_ARCH=$(ANDROID_CPU_ARCH) \
-DANDROID_VERSION_CODE=$(ANDROID_VERSION_CODE) \
-DCPU_ARCH=$(CPU_ARCH) \
-DGRE_MILESTONE=$(GRE_MILESTONE) \
-DMOZILLA_OFFICIAL=$(MOZILLA_OFFICIAL) \
-DMOZ_ANDROID_SHARED_ID="$(MOZ_ANDROID_SHARED_ID)" \
-DMOZ_ANDROID_SHARED_ACCOUNT_TYPE="$(MOZ_ANDROID_SHARED_ACCOUNT_TYPE)" \
-DMOZ_APP_ABI=$(TARGET_XPCOM_ABI) \
-DMOZ_APP_BASENAME=$(MOZ_APP_BASENAME) \
-DMOZ_APP_BUILDID=$(MOZ_APP_BUILDID) \
-DMOZ_APP_DISPLAYNAME="$(MOZ_APP_DISPLAYNAME)" \
-DMOZ_APP_ID=$(MOZ_APP_ID) \
-DMOZ_APP_NAME=$(MOZ_APP_NAME) \
-DMOZ_APP_VENDOR=$(MOZ_APP_VENDOR) \
-DMOZ_APP_VERSION=$(MOZ_APP_VERSION) \
-DMOZ_BUILD_TIMESTAMP=$(MOZ_BUILD_TIMESTAMP) \
-DMOZ_CHILD_PROCESS_NAME=$(MOZ_CHILD_PROCESS_NAME) \
-DMOZ_CRASHREPORTER=$(MOZ_CRASHREPORTER) \
-DMOZ_MIN_CPU_VERSION=$(MIN_CPU_VERSION) \
-DMOZ_UPDATE_CHANNEL=$(MOZ_UPDATE_CHANNEL) \
-DOMNIJAR_NAME=$(OMNIJAR_NAME) \
-DOS_TARGET=$(OS_TARGET) \
-DTARGET_XPCOM_ABI=$(TARGET_XPCOM_ABI) \
-DUA_BUILDID=$(UA_BUILDID) \
$(NULL)
ifdef MOZ_PKG_SPECIAL
DEFINES += -DMOZ_PKG_SPECIAL=$(MOZ_PKG_SPECIAL)
endif
ifdef MOZ_LINKER_EXTRACT
DEFINES += -DMOZ_LINKER_EXTRACT=1
endif
GARBAGE += \
AndroidManifest.xml \
classes.dex \
gecko.ap_ \
res/values/strings.xml \
.aapt.deps \
fennec_ids.txt \
javah.out \
jni-stubs.inc \
GeneratedJNIWrappers.cpp \
GeneratedJNIWrappers.h \
$(NULL)
GARBAGE_DIRS += classes db jars res sync services generated
# Bug 567884 - Need a way to find appropriate icons during packaging
ifeq ($(MOZ_APP_NAME),fennec)
ICON_PATH = $(topsrcdir)/$(MOZ_BRANDING_DIRECTORY)/content/fennec_48x48.png
ICON_PATH_HDPI = $(topsrcdir)/$(MOZ_BRANDING_DIRECTORY)/content/fennec_72x72.png
ICON_PATH_XHDPI = $(topsrcdir)/$(MOZ_BRANDING_DIRECTORY)/content/fennec_96x96.png
ICON_PATH_XXHDPI = $(topsrcdir)/$(MOZ_BRANDING_DIRECTORY)/content/fennec_144x144.png
else
ICON_PATH = $(topsrcdir)/$(MOZ_BRANDING_DIRECTORY)/content/icon48.png
ICON_PATH_HDPI = $(topsrcdir)/$(MOZ_BRANDING_DIRECTORY)/content/icon64.png
endif
JAVA_CLASSPATH = $(ANDROID_SDK)/android.jar
ALL_JARS = \
gecko-browser.jar \
gecko-mozglue.jar \
gecko-util.jar \
sync-thirdparty.jar \
websockets.jar \
$(NULL)
ifdef MOZ_WEBRTC
ALL_JARS += webrtc.jar
endif
include $(topsrcdir)/config/config.mk
# Note that we're going to set up a dependency directly between embed_android.dex and the java files
# Instead of on the .class files, since more than one .class file might be produced per .java file
# Sync dependencies are provided in a single jar. Sync classes themselves are delivered as source,
# because Android resource classes must be compiled together in order to avoid overlapping resource
# indices.
classes.dex: $(ALL_JARS)
@echo "DX classes.dex"
$(DX) --dex --output=classes.dex $(ALL_JARS) $(ANDROID_COMPAT_LIB)
CLASSES_WITH_JNI= \
org.mozilla.gecko.GeckoAppShell \
org.mozilla.gecko.GeckoJavaSampler \
org.mozilla.gecko.gfx.NativePanZoomController \
org.mozilla.gecko.ANRReporter \
$(NULL)
ifdef MOZ_WEBSMS_BACKEND
# Note: if you are building with MOZ_WEBSMS_BACKEND turned on, then
# you will get a build error because the generated jni-stubs.inc will
# be different than the one checked in (i.e. it will have the sms-related
# JNI stubs as well). Just copy the generated file to mozglue/android/
# like the error message says and rebuild. All should be well after that.
CLASSES_WITH_JNI += org.mozilla.gecko.GeckoSmsManager
endif
jni-stubs.inc: gecko-browser.jar gecko-mozglue.jar gecko-util.jar sync-thirdparty.jar
$(JAVAH) -o javah.out -bootclasspath $(JAVA_BOOTCLASSPATH) -classpath $(subst $(NULL) $(NULL),:,$^) $(CLASSES_WITH_JNI)
$(PYTHON) $(topsrcdir)/mobile/android/base/jni-generator.py javah.out $@
ANNOTATION_PROCESSOR_JAR_FILES := $(DEPTH)/build/annotationProcessors/annotationProcessors.jar
GeneratedJNIWrappers.cpp: $(ANNOTATION_PROCESSOR_JAR_FILES)
GeneratedJNIWrappers.cpp: $(ALL_JARS)
$(JAVA) -classpath gecko-mozglue.jar:$(JAVA_BOOTCLASSPATH):$(ANNOTATION_PROCESSOR_JAR_FILES) org.mozilla.gecko.annotationProcessors.AnnotationProcessor $(ALL_JARS)
gecko_package_dir = generated/org/mozilla/gecko
# Like generated/org/mozilla/fennec_$USERID.
android_package_dir = $(addprefix generated/,$(subst .,/,$(ANDROID_PACKAGE_NAME)))
# These _PP_JAVAFILES are specified in moz.build and defined in
# backend.mk, which is included by config.mk. Therefore this needs to
# be defined after config.mk is included.
PP_JAVAFILES := $(filter-out $(gecko_package_dir)/R.java,$(gecko-mozglue_PP_JAVAFILES) $(gecko-browser_PP_JAVAFILES))
manifest := \
AndroidManifest.xml.in \
$(NULL)
PP_TARGETS += manifest
# Certain source files need to be preprocessed. This special rule
# generates these files into generated/org/mozilla/gecko for
# consumption by the build system and IDEs.
preprocessed := $(addsuffix .in,$(subst $(gecko_package_dir)/,,$(filter $(gecko_package_dir)/%,$(PP_JAVAFILES))))
preprocessed_PATH := $(gecko_package_dir)
preprocessed_KEEP_PATH := 1
PP_TARGETS += preprocessed
# Certain source files have Java package name @ANDROID_PACKAGE_NAME@.
# We hate these files but they are necessary for backwards
# compatibility. These special rules generate these files into
# generated/org/mozilla/{firefox,firefox_beta,fennec,fennec_$USER} for
# consumption by the build system and IDEs.
preprocessed_package := $(addsuffix .in,$(subst $(android_package_dir)/,,$(filter $(android_package_dir)/%,$(PP_JAVAFILES))))
preprocessed_package_PATH := $(android_package_dir)
preprocessed_package_KEEP_PATH := 1
PP_TARGETS += preprocessed_package
res/drawable-mdpi/icon.png: $(ICON_PATH)
$(NSINSTALL) -D res/drawable-mdpi
cp $(ICON_PATH) $@
res/drawable-hdpi/icon.png: $(ICON_PATH_HDPI)
$(NSINSTALL) -D res/drawable-hdpi
cp $(ICON_PATH_HDPI) $@
res/drawable-xhdpi/icon.png: $(ICON_PATH_XHDPI)
$(NSINSTALL) -D res/drawable-xhdpi
cp $(ICON_PATH_XHDPI) $@
res/drawable-xxhdpi/icon.png: $(ICON_PATH_XXHDPI)
$(NSINSTALL) -D res/drawable-xxhdpi
cp $(ICON_PATH_XXHDPI) $@
ANDROID_RESDIRS := $(subst resources/,res/,$(sort $(dir $(ANDROID_RESFILES))))
$(call mkdir_deps,$(ANDROID_RESDIRS)): $(ANDROID_RESFILES) Makefile
$(RM) -r $(@D)
$(NSINSTALL) -D $(@D)
$(TOUCH) $@
$(subst resources/,res/,$(ANDROID_RESFILES)): $(call mkdir_deps,$(ANDROID_RESDIRS)) $(ANDROID_RESFILES)
@echo "creating $@"
$(NSINSTALL) $(subst res/,$(srcdir)/resources/,$@) $(dir $@)
res/values/strings.xml: $(call mkdir_deps,res/values)
$(MAKE) -C locales
# With multilocale builds, there will be multiple strings.xml files. We need to
# rebuild gecko.ap_ if any of them change.
MULTILOCALE_STRINGS_XML_FILES := $(wildcard res/values-*/strings.xml)
all_resources = \
$(MULTILOCALE_STRINGS_XML_FILES) \
AndroidManifest.xml \
$(subst resources/,res/,$(ANDROID_RESFILES)) \
$(ANDROID_GENERATED_RESFILES) \
$(NULL)
# generated/org/mozilla/gecko/R.java and gecko.ap_ are both produced
# by aapt; this saves an aapt invocation.
$(gecko_package_dir)/R.java: .aapt.deps
gecko.ap_: .aapt.deps
.aapt.deps: $(all_resources)
$(AAPT) package -f -M AndroidManifest.xml -I $(ANDROID_SDK)/android.jar -S res --custom-package org.mozilla.gecko --non-constant-id \
-J $(gecko_package_dir)/ \
-F gecko.ap_
@$(TOUCH) $@
fennec_ids.txt: $(gecko_package_dir)/R.java fennec-ids-generator.py
$(PYTHON) $(topsrcdir)/mobile/android/base/fennec-ids-generator.py -i $< -o $@
# We process ANDROID_RESFILES specially for now; the following flag
# disables the default processing.
IGNORE_ANDROID_RESFILES=1
include $(topsrcdir)/config/rules.mk
# Override the Java settings with some specific android settings
include $(topsrcdir)/config/android-common.mk
libs:: classes.dex jni-stubs.inc GeneratedJNIWrappers.cpp fennec_ids.txt
$(INSTALL) classes.dex $(FINAL_TARGET)
@(diff jni-stubs.inc $(topsrcdir)/mozglue/android/jni-stubs.inc >/dev/null && diff GeneratedJNIWrappers.cpp $(topsrcdir)/widget/android/GeneratedJNIWrappers.cpp >/dev/null) || \
(echo "*** Error: The generated JNI code has changed. Please run cp $(CURDIR)/jni-stubs.inc $(topsrcdir)/mozglue/android && cp $(CURDIR)/GeneratedJNIWrappers.* $(topsrcdir)/widget/android and repeat the build." && exit 1)