mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1229241 - Use FINAL_TARGET{,_PP}_FILES for JS_PREFERENCE{,_PP}_FILES. r=gps
This commit is contained in:
parent
cb2ed43ba3
commit
75d3ac49f6
@ -1138,9 +1138,8 @@ export:: $(FINAL_TARGET)
|
||||
endif
|
||||
|
||||
################################################################################
|
||||
# Copy each element of PREF_JS_EXPORTS
|
||||
|
||||
# The default location for PREF_JS_EXPORTS 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 = defaults/pref
|
||||
|
||||
# If DIST_SUBDIR is defined it indicates that app and gre dirs are
|
||||
@ -1150,16 +1149,6 @@ ifneq (,$(DIST_SUBDIR)$(XPI_NAME))
|
||||
PREF_DIR = defaults/preferences
|
||||
endif
|
||||
|
||||
ifneq ($(PREF_JS_EXPORTS),)
|
||||
ifndef NO_DIST_INSTALL
|
||||
PREF_JS_EXPORTS_PATH := $(FINAL_TARGET)/$(PREF_DIR)
|
||||
# We preprocess these, but they don't necessarily have preprocessor directives,
|
||||
# so tell them preprocessor to not complain about that.
|
||||
PREF_JS_EXPORTS_FLAGS := $(PREF_PPFLAGS) --silence-missing-directive-warnings
|
||||
PP_TARGETS += PREF_JS_EXPORTS
|
||||
endif
|
||||
endif
|
||||
|
||||
################################################################################
|
||||
# Copy each element of AUTOCFG_JS_EXPORTS to $(FINAL_TARGET)/defaults/autoconfig
|
||||
|
||||
|
@ -13,7 +13,6 @@ from mozbuild.frontend.data import (
|
||||
FinalTargetFiles,
|
||||
JARManifest,
|
||||
JavaScriptModules,
|
||||
JsPreferenceFile,
|
||||
Resources,
|
||||
XPIDLFile,
|
||||
)
|
||||
@ -90,29 +89,6 @@ class FasterMakeBackend(CommonBackend):
|
||||
elif obj.flavor == 'extra_pp':
|
||||
self._add_preprocess(obj, f, base, defines=defines)
|
||||
|
||||
elif isinstance(obj, JsPreferenceFile) and \
|
||||
obj.install_target.startswith('dist/bin'):
|
||||
# The condition for the directory value in config/rules.mk is:
|
||||
# ifneq (,$(DIST_SUBDIR)$(XPI_NAME))
|
||||
# - when XPI_NAME is set, obj.install_target will start with
|
||||
# dist/xpi-stage
|
||||
# - when DIST_SUBDIR is set, obj.install_target will start with
|
||||
# dist/bin/$(DIST_SUBDIR)
|
||||
# So an equivalent condition that is not cumbersome for us and that
|
||||
# is enough at least for now is checking if obj.install_target is
|
||||
# different from dist/bin.
|
||||
if obj.install_target == 'dist/bin':
|
||||
pref_dir = 'defaults/pref'
|
||||
else:
|
||||
pref_dir = 'defaults/preferences'
|
||||
|
||||
dest = mozpath.join(obj.install_target, pref_dir,
|
||||
mozpath.basename(obj.path))
|
||||
# We preprocess these, but they don't necessarily have preprocessor
|
||||
# directives, so tell the preprocessor to not complain about that.
|
||||
self._add_preprocess(obj, obj.path, pref_dir, defines=defines,
|
||||
silence_missing_directive_warnings=True)
|
||||
|
||||
elif isinstance(obj, Resources) and \
|
||||
obj.install_target.startswith('dist/bin'):
|
||||
for path, strings in obj.resources.walk():
|
||||
|
@ -58,7 +58,6 @@ from ..frontend.data import (
|
||||
JARManifest,
|
||||
JavaJarData,
|
||||
JavaScriptModules,
|
||||
JsPreferenceFile,
|
||||
Library,
|
||||
LocalInclude,
|
||||
PerSourceFlag,
|
||||
@ -539,12 +538,6 @@ class RecursiveMakeBackend(CommonBackend):
|
||||
elif isinstance(obj, BrandingFiles):
|
||||
self._process_branding_files(obj, obj.files, backend_file)
|
||||
|
||||
elif isinstance(obj, JsPreferenceFile):
|
||||
if obj.path.startswith('/'):
|
||||
backend_file.write('PREF_JS_EXPORTS += $(topsrcdir)%s\n' % obj.path)
|
||||
else:
|
||||
backend_file.write('PREF_JS_EXPORTS += $(srcdir)/%s\n' % obj.path)
|
||||
|
||||
elif isinstance(obj, JARManifest):
|
||||
backend_file.write('JAR_MANIFEST := %s\n' % obj.path)
|
||||
|
||||
|
@ -1089,17 +1089,6 @@ VARIABLES = {
|
||||
populated by calling add_java_jar().
|
||||
""", 'libs'),
|
||||
|
||||
'JS_PREFERENCE_FILES': (StrictOrderingOnAppendList, list,
|
||||
"""Exported javascript files.
|
||||
|
||||
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.
|
||||
""", 'libs'),
|
||||
|
||||
'JS_PREFERENCE_PP_FILES': (StrictOrderingOnAppendList, list,
|
||||
"""Like JS_PREFERENCE_FILES, preprocessed..
|
||||
""", 'libs'),
|
||||
|
||||
'LIBRARY_DEFINES': (OrderedDict, dict,
|
||||
"""Dictionary of compiler defines to declare for the entire library.
|
||||
|
||||
@ -1974,6 +1963,17 @@ SPECIAL_VARIABLES = {
|
||||
files will be installed in the ``/components`` directory of the distribution.
|
||||
"""),
|
||||
|
||||
'JS_PREFERENCE_FILES': (lambda context: context['FINAL_TARGET_FILES'].defaults.pref._strings, list,
|
||||
"""Exported javascript files.
|
||||
|
||||
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.
|
||||
"""),
|
||||
|
||||
'JS_PREFERENCE_PP_FILES': (lambda context: context['FINAL_TARGET_PP_FILES'].defaults.pref._strings, list,
|
||||
"""Like JS_PREFERENCE_FILES, preprocessed..
|
||||
"""),
|
||||
|
||||
}
|
||||
|
||||
# Deprecation hints.
|
||||
|
@ -249,16 +249,6 @@ class BrandingFiles(ContextDerived):
|
||||
ContextDerived.__init__(self, sandbox)
|
||||
self.files = files
|
||||
|
||||
class JsPreferenceFile(ContextDerived):
|
||||
"""Context derived container object for a Javascript preference file.
|
||||
|
||||
Paths are assumed to be relative to the srcdir."""
|
||||
__slots__ = ('path')
|
||||
|
||||
def __init__(self, context, path):
|
||||
ContextDerived.__init__(self, context)
|
||||
self.path = path
|
||||
|
||||
class IPDLFile(ContextDerived):
|
||||
"""Describes an individual .ipdl source file."""
|
||||
|
||||
|
@ -54,7 +54,6 @@ from .data import (
|
||||
IPDLFile,
|
||||
JARManifest,
|
||||
JavaScriptModules,
|
||||
JsPreferenceFile,
|
||||
Library,
|
||||
Linkable,
|
||||
LinkageWrongKindError,
|
||||
@ -637,10 +636,6 @@ class TreeMetadataEmitter(LoggingMixin):
|
||||
'XPI_NAME.', context)
|
||||
yield Resources(context, resources)
|
||||
|
||||
for pref in sorted(context['JS_PREFERENCE_FILES'] +
|
||||
context['JS_PREFERENCE_PP_FILES']):
|
||||
yield JsPreferenceFile(context, pref)
|
||||
|
||||
self._handle_programs(context)
|
||||
|
||||
extra_js_modules = context.get('EXTRA_JS_MODULES')
|
||||
@ -689,9 +684,12 @@ class TreeMetadataEmitter(LoggingMixin):
|
||||
raise SandboxValidationError(
|
||||
'%s cannot be used with DIST_INSTALL = False' % var,
|
||||
context)
|
||||
has_prefs = False
|
||||
for base, files in all_files.walk():
|
||||
if base == 'components':
|
||||
components.extend(files)
|
||||
if base == 'defaults/pref':
|
||||
has_prefs = True
|
||||
for f in files:
|
||||
path = os.path.join(context.srcdir, f)
|
||||
if not os.path.exists(path):
|
||||
@ -699,6 +697,16 @@ class TreeMetadataEmitter(LoggingMixin):
|
||||
'File listed in %s does not exist: %s'
|
||||
% (var, f), context)
|
||||
|
||||
# Addons (when XPI_NAME is defined) and Applications (when
|
||||
# DIST_SUBDIR is defined) use a different preferences directory
|
||||
# (default/preferences) from the one the GRE uses (defaults/pref).
|
||||
# Hence, we move the files from the latter to the former in that
|
||||
# case.
|
||||
if has_prefs and (context.get('XPI_NAME') or
|
||||
context.get('DIST_SUBDIR')):
|
||||
all_files.defaults.preferences += all_files.defaults.pref
|
||||
del all_files.defaults._children['pref']
|
||||
|
||||
yield cls(context, all_files, context['FINAL_TARGET'])
|
||||
|
||||
# Check for manifest declarations in EXTRA_{PP_,}COMPONENTS.
|
||||
|
@ -1,12 +0,0 @@
|
||||
# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
|
||||
# Any copyright is dedicated to the Public Domain.
|
||||
# http://creativecommons.org/publicdomain/zero/1.0/
|
||||
|
||||
JS_PREFERENCE_FILES = ['aa/aa.js', 'bb/bb.js']
|
||||
JS_PREFERENCE_FILES += ['cc/cc.js', 'dd/dd.js']
|
||||
JS_PREFERENCE_FILES += ['/ee/ee.js', '/ff/ff.js']
|
||||
|
||||
if CONFIG['_INVALID_CONFIG_VALUE']:
|
||||
JS_PREFERENCE_FILES += ['invalid_val/prefs.js']
|
||||
else:
|
||||
JS_PREFERENCE_FILES += ['valid_val/prefs.js']
|
@ -422,24 +422,6 @@ class TestRecursiveMakeBackend(BackendTester):
|
||||
self.assertIn('quux.png', m)
|
||||
self.assertIn('icons/foo.ico', m)
|
||||
|
||||
def test_js_preference_files(self):
|
||||
"""Ensure PREF_JS_EXPORTS is written out correctly."""
|
||||
env = self._consume('js_preference_files', RecursiveMakeBackend)
|
||||
|
||||
backend_path = os.path.join(env.topobjdir, 'backend.mk')
|
||||
lines = [l.strip() for l in open(backend_path, 'rt').readlines()]
|
||||
|
||||
# Avoid positional parameter and async related breakage
|
||||
var = 'PREF_JS_EXPORTS'
|
||||
found = [val for val in lines if val.startswith(var)]
|
||||
|
||||
# Assignment[aa], append[cc], conditional[valid]
|
||||
expected = ('aa/aa.js', 'bb/bb.js', 'cc/cc.js', 'dd/dd.js', 'valid_val/prefs.js')
|
||||
expected_top = ('ee/ee.js', 'ff/ff.js')
|
||||
self.assertEqual(found,
|
||||
['PREF_JS_EXPORTS += $(topsrcdir)/%s' % val for val in expected_top] +
|
||||
['PREF_JS_EXPORTS += $(srcdir)/%s' % val for val in expected])
|
||||
|
||||
def test_test_manifests_files_written(self):
|
||||
"""Ensure test manifests get turned into files."""
|
||||
env = self._consume('test-manifests-written', RecursiveMakeBackend)
|
||||
|
@ -1,11 +0,0 @@
|
||||
# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
|
||||
# Any copyright is dedicated to the Public Domain.
|
||||
# http://creativecommons.org/publicdomain/zero/1.0/
|
||||
|
||||
JS_PREFERENCE_FILES = ['ww/ww.js', 'xx/xx.js']
|
||||
JS_PREFERENCE_FILES += ['yy/yy.js']
|
||||
|
||||
if CONFIG['_INVALID_CONFIG_VALUE']:
|
||||
JS_PREFERENCE_FILES += ['invalid_val/prefs.js']
|
||||
else:
|
||||
JS_PREFERENCE_FILES += ['valid_val/prefs.js']
|
@ -24,7 +24,6 @@ from mozbuild.frontend.data import (
|
||||
HostSources,
|
||||
IPDLFile,
|
||||
JARManifest,
|
||||
JsPreferenceFile,
|
||||
LocalInclude,
|
||||
Program,
|
||||
Resources,
|
||||
@ -340,21 +339,6 @@ class TestEmitterBasic(unittest.TestCase):
|
||||
|
||||
self.assertEqual(icons._strings, ['quux.icns'])
|
||||
|
||||
def test_preferences_js(self):
|
||||
reader = self.reader('js_preference_files')
|
||||
objs = self.read_topsrcdir(reader)
|
||||
|
||||
prefs = [o.path for o in objs if isinstance(o, JsPreferenceFile)]
|
||||
|
||||
prefsByDir = [
|
||||
'valid_val/prefs.js',
|
||||
'ww/ww.js',
|
||||
'xx/xx.js',
|
||||
'yy/yy.js',
|
||||
]
|
||||
|
||||
self.assertEqual(sorted(prefs), prefsByDir)
|
||||
|
||||
def test_program(self):
|
||||
reader = self.reader('program')
|
||||
objs = self.read_topsrcdir(reader)
|
||||
|
Loading…
Reference in New Issue
Block a user