Bug 1533051 - Package GeckoView prefs at architecture-specific paths for Android fat AAR/GeckoView multi-architecture builds. r=glandium

Bug 1533425 makes Gecko try to load from $ARCH/greprefs.js, etc on
Android.  This patch teaches the packager to put preferences into
those architecture-specific locations for that code to find.

Differential Revision: https://phabricator.services.mozilla.com/D24984

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Nick Alexander 2019-03-27 17:35:26 +00:00
Родитель 56a5006aee
Коммит 3dce09e76f
7 изменённых файлов: 34 добавлений и 11 удалений

Просмотреть файл

@ -967,13 +967,17 @@ endif
################################################################################ ################################################################################
# The default location for prefs is the gre prefs directory. # The default location for prefs is the gre prefs directory.
# PREF_DIR is used for L10N_PREF_JS_EXPORTS in various locales/ directories. # PREF_DIR is used for L10N_PREF_JS_EXPORTS in various locales/ directories.
PREF_DIR = defaults/pref PREF_DIR := defaults/pref
# If DIST_SUBDIR is defined it indicates that app and gre dirs are # If DIST_SUBDIR is defined it indicates that app and gre dirs are
# different and that we are building app related resources. Hence, # different and that we are building app related resources. Hence,
# PREF_DIR should point to the app prefs location. # PREF_DIR should point to the app prefs location.
ifneq (,$(DIST_SUBDIR)$(XPI_NAME)) ifneq (,$(DIST_SUBDIR)$(XPI_NAME))
PREF_DIR = defaults/preferences PREF_DIR := defaults/preferences
endif
ifeq ($(MOZ_BUILD_APP),mobile/android)
PREF_DIR := $(PREF_DIR)/$(ANDROID_CPU_ARCH)
endif endif
################################################################################ ################################################################################

Просмотреть файл

@ -164,7 +164,7 @@
#endif #endif
@BINPATH@/@PREF_DIR@/channel-prefs.js @BINPATH@/@PREF_DIR@/channel-prefs.js
@BINPATH@/ua-update.json @BINPATH@/ua-update.json
@BINPATH@/greprefs.js @BINPATH@/@ANDROID_CPU_ARCH@/greprefs.js
@BINPATH@/defaults/autoconfig/prefcalls.js @BINPATH@/defaults/autoconfig/prefcalls.js
; [Layout Engine Resources] ; [Layout Engine Resources]
@ -260,7 +260,7 @@
@BINPATH@/chrome/marionette.manifest @BINPATH@/chrome/marionette.manifest
@BINPATH@/components/marionette.manifest @BINPATH@/components/marionette.manifest
@BINPATH@/components/marionette.js @BINPATH@/components/marionette.js
@BINPATH@/defaults/pref/marionette.js @BINPATH@/@PREF_DIR@/marionette.js
#endif #endif
#ifdef PKG_LOCALE_MANIFEST #ifdef PKG_LOCALE_MANIFEST

Просмотреть файл

@ -43,7 +43,7 @@ libs-%: AB_CD=$*
libs-%: libs-%:
$(if $(filter en-US,$(AB_CD)),, $(MAKE) merge-$*) $(if $(filter en-US,$(AB_CD)),, $(MAKE) merge-$*)
$(MAKE) -C $(DEPTH)/mobile/locales libs-$* $(MAKE) -C $(DEPTH)/mobile/locales libs-$*
$(MAKE) libs AB_CD=$* XPI_NAME=locale-$* PREF_DIR=defaults/pref $(MAKE) libs AB_CD=$* XPI_NAME=locale-$* PREF_DIR=defaults/pref/$(ANDROID_CPU_ARCH)
$(MAKE) multilocale.txt-$* AB_CD=$* XPI_NAME=locale-$* $(MAKE) multilocale.txt-$* AB_CD=$* XPI_NAME=locale-$*
ifeq ($(OS_TARGET),Android) ifeq ($(OS_TARGET),Android)
$(MAKE) -C $(DEPTH)/mobile/android/base AB_CD=$* XPI_NAME=locale-$* $(MAKE) -C $(DEPTH)/mobile/android/base AB_CD=$* XPI_NAME=locale-$*

Просмотреть файл

@ -20,7 +20,7 @@ libs-%: AB_CD=$*
libs-%: libs-%:
$(NSINSTALL) -D $(DIST)/install $(NSINSTALL) -D $(DIST)/install
@$(MAKE) -C $(DEPTH)/toolkit/locales libs-$* @$(MAKE) -C $(DEPTH)/toolkit/locales libs-$*
@$(MAKE) libs AB_CD=$* XPI_NAME=locale-$* PREF_DIR=defaults/pref @$(MAKE) libs AB_CD=$* XPI_NAME=locale-$* PREF_DIR=defaults/pref/$(ANDROID_CPU_ARCH)
@$(MAKE) -C $(DEPTH)/$(MOZ_BRANDING_DIRECTORY)/locales AB_CD=$* XPI_NAME=locale-$* @$(MAKE) -C $(DEPTH)/$(MOZ_BRANDING_DIRECTORY)/locales AB_CD=$* XPI_NAME=locale-$*
# Tailored target to just add the chrome processing for multi-locale builds # Tailored target to just add the chrome processing for multi-locale builds

Просмотреть файл

@ -49,6 +49,9 @@ DEFINES['MOZ_WIDGET_TOOLKIT'] = CONFIG['MOZ_WIDGET_TOOLKIT']
if CONFIG['MOZ_ENABLE_WEBRENDER']: if CONFIG['MOZ_ENABLE_WEBRENDER']:
DEFINES['MOZ_ENABLE_WEBRENDER'] = True DEFINES['MOZ_ENABLE_WEBRENDER'] = True
FINAL_TARGET_PP_FILES += [ grepref_location = FINAL_TARGET_PP_FILES
if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'android':
grepref_location = grepref_location[CONFIG['ANDROID_CPU_ARCH']]
grepref_location += [
'greprefs.js', 'greprefs.js',
] ]

Просмотреть файл

@ -2336,6 +2336,20 @@ FUNCTIONS = {
TestDirsPlaceHolder = List() TestDirsPlaceHolder = List()
def default_prefs_for(context, var):
"""Return default location for pref files.
On Android, the location varies by architecture to accommodate "fat
AAR" packages that contain native libraries for multiple architectures
and must have corresponding architecture-specific Gecko preferences."""
arch = context.config.substs.get('ANDROID_CPU_ARCH')
if arch:
return context[var].defaults.pref[arch]
else:
return context[var].defaults.pref
# Special variables. These complement VARIABLES. # Special variables. These complement VARIABLES.
# #
# Each entry is a tuple of: # Each entry is a tuple of:
@ -2407,15 +2421,15 @@ SPECIAL_VARIABLES = {
files will be installed in the ``/components`` directory of the distribution. files will be installed in the ``/components`` directory of the distribution.
"""), """),
'JS_PREFERENCE_FILES': (lambda context: context['FINAL_TARGET_FILES'].defaults.pref._strings, list, 'JS_PREFERENCE_FILES': (lambda context: default_prefs_for(context, 'FINAL_TARGET_FILES')._strings, list,
"""Exported JavaScript files. """Exported JavaScript files.
A list of files copied into the dist directory for packaging and installation. A list of files copied into the dist directory for packaging and installation.
Path will be defined for gre or application prefs dir based on what is building. Path will be defined for gre or application prefs dir based on what is building.
"""), """),
'JS_PREFERENCE_PP_FILES': (lambda context: context['FINAL_TARGET_PP_FILES'].defaults.pref._strings, list, 'JS_PREFERENCE_PP_FILES': (lambda context: default_prefs_for(context, 'FINAL_TARGET_PP_FILES')._strings, list,
"""Like JS_PREFERENCE_FILES, preprocessed.. """Like JS_PREFERENCE_FILES, preprocessed.
"""), """),
'RESOURCE_FILES': (lambda context: context['FINAL_TARGET_FILES'].res, list, 'RESOURCE_FILES': (lambda context: context['FINAL_TARGET_FILES'].res, list,

Просмотреть файл

@ -328,11 +328,13 @@ class OmniJarSubFormatter(PiecemealFormatter):
return len(path) != 3 or \ return len(path) != 3 or \
not (path[2] == 'channel-prefs.js' and not (path[2] == 'channel-prefs.js' and
path[1] in ['pref', 'preferences']) path[1] in ['pref', 'preferences'])
if len(path) <= 2 and path[-1] == 'greprefs.js':
# Accommodate `greprefs.js` and `$ANDROID_CPU_ARCH/greprefs.js`.
return True
return path[0] in [ return path[0] in [
'modules', 'modules',
'actors', 'actors',
'dictionaries', 'dictionaries',
'greprefs.js',
'hyphenation', 'hyphenation',
'localization', 'localization',
'update.locale', 'update.locale',