зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1254355 - Part 2: Generate AndroidManifest.xml using GENERATED_FILES. r=gps,mshal
MozReview-Commit-ID: BVYylS4qsP1 --HG-- extra : rebase_source : 6a9307175a8e876562571e0e5f276fff59c601db extra : source : 6a0e9a3f26735b442f289c65c231986e1f829f9e
This commit is contained in:
Родитель
8beb8af7d4
Коммит
2bb32a2659
|
@ -8,28 +8,6 @@ ifdef MOZ_BUILD_MOBILE_ANDROID_WITH_GRADLE
|
|||
.NOTPARALLEL:
|
||||
endif
|
||||
|
||||
MOZ_BUILDID := $(shell awk '{print $$3}' $(DEPTH)/buildid.h)
|
||||
|
||||
# Set the appropriate version code, based on the existance of the
|
||||
# MOZ_APP_ANDROID_VERSION_CODE variable.
|
||||
ifdef MOZ_APP_ANDROID_VERSION_CODE
|
||||
ANDROID_VERSION_CODE:=$(MOZ_APP_ANDROID_VERSION_CODE)
|
||||
else
|
||||
ANDROID_VERSION_CODE:=$(shell $(PYTHON) \
|
||||
$(topsrcdir)/python/mozbuild/mozbuild/android_version_code.py \
|
||||
--verbose \
|
||||
--with-android-cpu-arch=$(ANDROID_CPU_ARCH) \
|
||||
$(if $(MOZ_ANDROID_MIN_SDK_VERSION),--with-android-min-sdk=$(MOZ_ANDROID_MIN_SDK_VERSION)) \
|
||||
$(if $(MOZ_ANDROID_MAX_SDK_VERSION),--with-android-max-sdk=$(MOZ_ANDROID_MAX_SDK_VERSION)) \
|
||||
$(MOZ_BUILDID))
|
||||
endif
|
||||
|
||||
DEFINES += \
|
||||
-DANDROID_VERSION_CODE=$(ANDROID_VERSION_CODE) \
|
||||
-DMOZ_ANDROID_SHARED_ID="$(MOZ_ANDROID_SHARED_ID)" \
|
||||
-DMOZ_BUILDID=$(MOZ_BUILDID) \
|
||||
$(NULL)
|
||||
|
||||
GARBAGE += \
|
||||
classes.dex \
|
||||
gecko.ap_ \
|
||||
|
@ -309,7 +287,7 @@ classycle_jar := $(topsrcdir)/mobile/android/build/classycle/classycle-1.4.1.jar
|
|||
-outjars jars-proguarded \
|
||||
-libraryjars $(library_jars)
|
||||
|
||||
ANNOTATION_PROCESSOR_JAR_FILES := $(DEPTH)/build/annotationProcessors/annotationProcessors.jar
|
||||
ANNOTATION_PROCESSOR_JAR_FILES := $(abspath $(DEPTH)/build/annotationProcessors/annotationProcessors.jar)
|
||||
|
||||
# This annotation processing step also generates
|
||||
# GeneratedJNIWrappers.h and GeneratedJNINatives.h
|
||||
|
@ -375,7 +353,7 @@ res/raw/browsersearch.json: .locales.deps ;
|
|||
res/raw/suggestedsites.json: .locales.deps ;
|
||||
|
||||
all_resources = \
|
||||
$(DEPTH)/mobile/android/base/AndroidManifest.xml \
|
||||
AndroidManifest.xml \
|
||||
$(android_res_files) \
|
||||
$(ANDROID_GENERATED_RESFILES) \
|
||||
$(NULL)
|
||||
|
@ -479,8 +457,8 @@ ifdef MOZ_BUILD_MOBILE_ANDROID_WITH_GRADLE
|
|||
.aapt.nodeps: FORCE
|
||||
cp $(gradle_dir)/app/intermediates/res/resources-automation-debug.ap_ gecko-nodeps.ap_
|
||||
else
|
||||
# .aapt.nodeps: $(DEPTH)/mobile/android/base/AndroidManifest.xml FORCE
|
||||
$(eval $(call aapt_command,.aapt.nodeps,$(DEPTH)/mobile/android/base/AndroidManifest.xml FORCE,gecko-nodeps.ap_,gecko-nodeps/,gecko-nodeps/))
|
||||
# .aapt.nodeps: AndroidManifest.xml FORCE
|
||||
$(eval $(call aapt_command,.aapt.nodeps,AndroidManifest.xml FORCE,gecko-nodeps.ap_,gecko-nodeps/,gecko-nodeps/))
|
||||
endif
|
||||
|
||||
# Override the Java settings with some specific android settings
|
||||
|
@ -515,7 +493,7 @@ $(ABS_DIST)/fennec/$(OMNIJAR_NAME): FORCE
|
|||
|
||||
# Targets built very early during a Gradle build.
|
||||
gradle-targets: $(foreach f,$(constants_PP_JAVAFILES),$(f))
|
||||
gradle-targets: $(DEPTH)/mobile/android/base/AndroidManifest.xml
|
||||
gradle-targets: AndroidManifest.xml
|
||||
gradle-targets: $(ANDROID_GENERATED_RESFILES)
|
||||
|
||||
ifndef MOZILLA_OFFICIAL
|
||||
|
|
|
@ -28,6 +28,7 @@ import sys
|
|||
import buildconfig
|
||||
|
||||
from mozbuild import preprocessor
|
||||
from mozbuild.android_version_code import android_version_code
|
||||
|
||||
|
||||
def _defines():
|
||||
|
@ -62,6 +63,7 @@ def _defines():
|
|||
for var in ('ANDROID_CPU_ARCH',
|
||||
'ANDROID_PACKAGE_NAME',
|
||||
'GRE_MILESTONE',
|
||||
'MOZ_ANDROID_SHARED_ID',
|
||||
'MOZ_ANDROID_APPLICATION_CLASS',
|
||||
'MOZ_ANDROID_BROWSER_INTENT_CLASS',
|
||||
'MOZ_ANDROID_SEARCH_INTENT_CLASS',
|
||||
|
@ -101,6 +103,19 @@ def _defines():
|
|||
|
||||
DEFINES['MOZ_BUILDID'] = open(os.path.join(buildconfig.topobjdir, 'buildid.h')).readline().split()[2]
|
||||
|
||||
# Set the appropriate version code if not set by MOZ_APP_ANDROID_VERSION_CODE.
|
||||
if CONFIG.get('MOZ_APP_ANDROID_VERSION_CODE'):
|
||||
DEFINES['ANDROID_VERSION_CODE'] = \
|
||||
CONFIG.get('MOZ_APP_ANDROID_VERSION_CODE')
|
||||
else:
|
||||
min_sdk = int(CONFIG.get('MOZ_ANDROID_MIN_SDK_VERSION') or '0') or None
|
||||
max_sdk = int(CONFIG.get('MOZ_ANDROID_MAX_SDK_VERSION') or '0') or None
|
||||
DEFINES['ANDROID_VERSION_CODE'] = android_version_code(
|
||||
buildid=DEFINES['MOZ_BUILDID'],
|
||||
cpu_arch=CONFIG['ANDROID_CPU_ARCH'],
|
||||
min_sdk=min_sdk,
|
||||
max_sdk=max_sdk)
|
||||
|
||||
return DEFINES
|
||||
|
||||
|
||||
|
@ -108,6 +123,15 @@ def generate_java(output_file, input_filename):
|
|||
includes = preprocessor.preprocess(includes=[input_filename],
|
||||
defines=_defines(),
|
||||
output=output_file,
|
||||
marker="//#")
|
||||
marker='//#')
|
||||
includes.add(os.path.join(buildconfig.topobjdir, 'buildid.h'))
|
||||
return includes
|
||||
|
||||
|
||||
def generate_android_manifest(output_file, input_filename):
|
||||
includes = preprocessor.preprocess(includes=[input_filename],
|
||||
defines=_defines(),
|
||||
output=output_file,
|
||||
marker='#')
|
||||
includes.add(os.path.join(buildconfig.topobjdir, 'buildid.h'))
|
||||
return includes
|
||||
|
|
|
@ -119,6 +119,7 @@ DIRS += ['locales']
|
|||
|
||||
GENERATED_FILES += [
|
||||
'../geckoview/generated/preprocessed/org/mozilla/geckoview/BuildConfig.java',
|
||||
'AndroidManifest.xml',
|
||||
'generated/preprocessed/org/mozilla/gecko/AdjustConstants.java',
|
||||
'generated/preprocessed/org/mozilla/gecko/AppConstants.java',
|
||||
]
|
||||
|
@ -131,6 +132,9 @@ x.inputs += ['AdjustConstants.java.in']
|
|||
y = GENERATED_FILES['generated/preprocessed/org/mozilla/gecko/AppConstants.java']
|
||||
y.script = 'generate_build_config.py:generate_java'
|
||||
y.inputs += ['AppConstants.java.in']
|
||||
z = GENERATED_FILES['AndroidManifest.xml']
|
||||
z.script = 'generate_build_config.py:generate_android_manifest'
|
||||
z.inputs += ['AndroidManifest.xml.in']
|
||||
|
||||
include('android-services.mozbuild')
|
||||
|
||||
|
@ -1229,45 +1233,6 @@ if CONFIG['MOZ_ANDROID_DISTRIBUTION_DIRECTORY']:
|
|||
'%' + CONFIG['MOZ_ANDROID_DISTRIBUTION_DIRECTORY'] + '/assets',
|
||||
]
|
||||
|
||||
# We do not expose MOZ_ADJUST_SDK_KEY here because that # would leak the value
|
||||
# to build logs. Instead we expose the token quietly where appropriate in
|
||||
# Makefile.in.
|
||||
for var in ('MOZ_ANDROID_ANR_REPORTER', 'MOZ_DEBUG',
|
||||
'MOZ_ANDROID_SEARCH_ACTIVITY', 'MOZ_NATIVE_DEVICES', 'MOZ_ANDROID_MLS_STUMBLER',
|
||||
'MOZ_ANDROID_DOWNLOADS_INTEGRATION', 'MOZ_INSTALL_TRACKING',
|
||||
'MOZ_ANDROID_GCM', 'MOZ_ANDROID_EXCLUDE_FONTS', 'MOZ_LOCALE_SWITCHER',
|
||||
'MOZ_ANDROID_BEAM', 'MOZ_ANDROID_DOWNLOAD_CONTENT_SERVICE',
|
||||
'MOZ_SWITCHBOARD', 'MOZ_ANDROID_CUSTOM_TABS',
|
||||
'MOZ_ANDROID_ACTIVITY_STREAM'):
|
||||
if CONFIG[var]:
|
||||
DEFINES[var] = 1
|
||||
|
||||
for var in ('MOZ_UPDATER', 'MOZ_PKG_SPECIAL', 'MOZ_ANDROID_GCM_SENDERID'):
|
||||
if CONFIG[var]:
|
||||
DEFINES[var] = CONFIG[var]
|
||||
|
||||
for var in ('ANDROID_PACKAGE_NAME', 'ANDROID_CPU_ARCH',
|
||||
'GRE_MILESTONE', 'MOZ_APP_BASENAME', 'MOZ_MOZILLA_API_KEY',
|
||||
'MOZ_APP_DISPLAYNAME', 'MOZ_APP_UA_NAME', 'MOZ_APP_ID', 'MOZ_APP_NAME',
|
||||
'MOZ_APP_VENDOR', 'MOZ_APP_VERSION', 'MOZ_CHILD_PROCESS_NAME',
|
||||
'MOZ_ANDROID_APPLICATION_CLASS', 'MOZ_ANDROID_BROWSER_INTENT_CLASS', 'MOZ_ANDROID_SEARCH_INTENT_CLASS',
|
||||
'MOZ_CRASHREPORTER', 'MOZ_UPDATE_CHANNEL', 'OMNIJAR_NAME',
|
||||
'OS_TARGET', 'TARGET_XPCOM_ABI'):
|
||||
DEFINES[var] = CONFIG[var]
|
||||
|
||||
# Mangle our package name to avoid Bug 750548.
|
||||
DEFINES['MANGLED_ANDROID_PACKAGE_NAME'] = CONFIG['ANDROID_PACKAGE_NAME'].replace('fennec', 'f3nn3c')
|
||||
DEFINES['MOZ_APP_ABI'] = CONFIG['TARGET_XPCOM_ABI']
|
||||
if not CONFIG['COMPILE_ENVIRONMENT']:
|
||||
# These should really come from the included binaries, but that's not easy.
|
||||
DEFINES['MOZ_APP_ABI'] = 'arm-eabi-gcc3' # Observe quote differences here ...
|
||||
DEFINES['TARGET_XPCOM_ABI'] = '"arm-eabi-gcc3"' # ... and here.
|
||||
|
||||
if '-march=armv7' in CONFIG['OS_CFLAGS']:
|
||||
DEFINES['MOZ_MIN_CPU_VERSION'] = 7
|
||||
else:
|
||||
DEFINES['MOZ_MIN_CPU_VERSION'] = 5
|
||||
|
||||
if CONFIG['MOZ_ANDROID_SEARCH_ACTIVITY']:
|
||||
# The Search Activity is mostly independent of Fennec proper, but
|
||||
# it does depend on Geckoview. Therefore, we build it as a jar
|
||||
|
@ -1291,15 +1256,9 @@ if CONFIG['MOZ_ANDROID_SEARCH_ACTIVITY']:
|
|||
'gecko-view.jar',
|
||||
]
|
||||
|
||||
DEFINES['ANDROID_PACKAGE_NAME'] = CONFIG['ANDROID_PACKAGE_NAME']
|
||||
FINAL_TARGET_PP_FILES += ['package-name.txt.in']
|
||||
|
||||
DEFINES['OBJDIR'] = OBJDIR
|
||||
DEFINES['TOPOBJDIR'] = TOPOBJDIR
|
||||
|
||||
OBJDIR_PP_FILES.mobile.android.base += [
|
||||
'AndroidManifest.xml.in',
|
||||
]
|
||||
|
||||
gvjar.sources += ['generated/org/mozilla/gecko/' + x for x in [
|
||||
'IGeckoEditableChild.java',
|
||||
'IGeckoEditableParent.java',
|
||||
|
|
Загрузка…
Ссылка в новой задаче