--- a/python/mozbuild/mozbuild/backend/common.py
+++ b/python/mozbuild/mozbuild/backend/common.py
@@ -19,16 +19,17 @@ from mozbuild.frontend.context import (
VARIABLES,
)
from mozbuild.frontend.data import (
BaseProgram,
ChromeManifestEntry,
ConfigFileSubstitution,
ExampleWebIDLInterface,
IPDLFile,
+ FinalTargetBabeledFiles,
FinalTargetPreprocessedFiles,
FinalTargetFiles,
GeneratedEventWebIDLFile,
GeneratedWebIDLFile,
PreprocessedTestWebIDLFile,
PreprocessedWebIDLFile,
SharedLibrary,
TestWebIDLFile,
@@ -440,16 +441,17 @@ class CommonBackend(BuildBackend):
install_target = obj.install_target
if jarinfo.base:
install_target = mozpath.normpath(
mozpath.join(install_target, jarinfo.base))
jar_context['FINAL_TARGET'] = install_target
if obj.defines:
jar_context['DEFINES'] = obj.defines.defines
files = jar_context['FINAL_TARGET_FILES']
+ files_babel = jar_context['FINAL_TARGET_BABEL_FILES']
files_pp = jar_context['FINAL_TARGET_PP_FILES']
for e in jarinfo.entries:
if e.is_locale:
if jarinfo.relativesrcdir:
src = '/%s' % jarinfo.relativesrcdir
else:
src = ''
@@ -478,21 +480,29 @@ class CommonBackend(BuildBackend):
(src, output_basename))
path = mozpath.dirname(mozpath.join(jarinfo.name, e.output))
if e.preprocess:
if '*' in e.source:
raise Exception('%s: Wildcards are not supported with '
'preprocessing' % obj.path)
files_pp[path] += [src]
+ elif e.babel:
+ if '*' in e.source:
+ raise Exception('%s: Wildcards are not supported with '
+ 'babeling' % obj.path)
+ files_babel[path] += [src]
else:
files[path] += [src]
if files:
self.consume_object(FinalTargetFiles(jar_context, files))
+ if files_babel:
+ self.consume_object(
+ FinalTargetBabeledFiles(jar_context, files_babel))
if files_pp:
self.consume_object(
FinalTargetPreprocessedFiles(jar_context, files_pp))
for m in jarinfo.chrome_manifests:
entry = parse_manifest_line(
mozpath.dirname(jarinfo.name),
m.replace('%', mozpath.basename(jarinfo.name) + '/'))
--- a/python/mozbuild/mozbuild/backend/fastermake.py
+++ b/python/mozbuild/mozbuild/backend/fastermake.py
@@ -6,16 +6,17 @@ from __future__ import absolute_import,
from mozbuild.backend.base import PartialBackend
from mozbuild.backend.common import CommonBackend
from mozbuild.frontend.context import (
ObjDirPath,
)
from mozbuild.frontend.data import (
ChromeManifestEntry,
+ FinalTargetBabeledFiles,
FinalTargetPreprocessedFiles,
FinalTargetFiles,
JARManifest,
XPIDLFile,
)
from mozbuild.makeutil import Makefile
from mozbuild.util import OrderedDefaultDict
from mozpack.manifests import InstallManifest
@@ -29,16 +30,23 @@ class FasterMakeBackend(CommonBackend, P
self._manifest_entries = OrderedDefaultDict(set)
self._install_manifests = OrderedDefaultDict(InstallManifest)
self._dependencies = OrderedDefaultDict(list)
self._has_xpidl = False
+ def _add_babel(self, obj, path, dest, target=None):
+ if target is None:
+ target = mozpath.basename(path)
+ self._install_manifests[obj.install_target].add_babel(
+ mozpath.join(obj.srcdir, path),
+ mozpath.join(dest, target))
+
def _add_preprocess(self, obj, path, dest, target=None, **kwargs):
if target is None:
target = mozpath.basename(path)
# This matches what PP_TARGETS do in config/rules.
if target.endswith('.in'):
target = target[:-3]
if target.endswith('.css'):
kwargs['marker'] = '%'
@@ -52,24 +60,28 @@ class FasterMakeBackend(CommonBackend, P
**kwargs)
def consume_object(self, obj):
if isinstance(obj, JARManifest) and \
obj.install_target.startswith('dist/bin'):
self._consume_jar_manifest(obj)
elif isinstance(obj, (FinalTargetFiles,
+ FinalTargetBabeledFiles,
FinalTargetPreprocessedFiles)) and \
obj.install_target.startswith('dist/bin'):
defines = obj.defines or {}
if defines:
defines = defines.defines
for path, files in obj.files.walk():
for f in files:
- if isinstance(obj, FinalTargetPreprocessedFiles):
+ if isinstance(obj, FinalTargetBabeledFiles):
+ self._add_babel(obj, f.full_path, path,
+ target=f.target_basename)
+ elif isinstance(obj, FinalTargetPreprocessedFiles):
self._add_preprocess(obj, f.full_path, path,
target=f.target_basename,
defines=defines)
elif '*' in f:
def _prefix(s):
for p in mozpath.split(s):
if '*' not in p:
yield p + '/'
--- a/python/mozbuild/mozbuild/backend/recursivemake.py
+++ b/python/mozbuild/mozbuild/backend/recursivemake.py
@@ -38,16 +38,17 @@ from ..frontend.data import (
ChromeManifestEntry,
ConfigFileSubstitution,
ContextDerived,
ContextWrapped,
Defines,
DirectoryTraversal,
ExternalLibrary,
FinalTargetFiles,
+ FinalTargetBabeledFiles,
FinalTargetPreprocessedFiles,
GeneratedFile,
GeneratedSources,
HostDefines,
HostLibrary,
HostProgram,
HostRustProgram,
HostSimpleProgram,
@@ -90,16 +91,17 @@ MOZBUILD_VARIABLES = [
b'ANDROID_GENERATED_RESFILES',
b'ANDROID_RES_DIRS',
b'ASFLAGS',
b'CMSRCS',
b'CMMSRCS',
b'CPP_UNIT_TESTS',
b'DIRS',
b'DIST_INSTALL',
+ b'EXTRA_BABEL_JS_MODULES',
b'EXTRA_DSO_LDOPTS',
b'EXTRA_JS_MODULES',
b'EXTRA_PP_COMPONENTS',
b'EXTRA_PP_JS_MODULES',
b'FORCE_SHARED_LIB',
b'FORCE_STATIC_LIB',
b'FINAL_LIBRARY',
b'HOST_CFLAGS',
@@ -635,16 +637,19 @@ class RecursiveMakeBackend(CommonBackend
self._process_objdir_files(obj, obj.files, backend_file)
elif isinstance(obj, ObjdirPreprocessedFiles):
self._process_final_target_pp_files(obj, obj.files, backend_file, 'OBJDIR_PP_FILES')
elif isinstance(obj, FinalTargetFiles):
self._process_final_target_files(obj, obj.files, backend_file)
+ elif isinstance(obj, FinalTargetBabeledFiles):
+ self._process_final_target_babel_files(obj, obj.files, backend_file, 'DIST_FILES')
+
elif isinstance(obj, FinalTargetPreprocessedFiles):
self._process_final_target_pp_files(obj, obj.files, backend_file, 'DIST_FILES')
elif isinstance(obj, AndroidResDirs):
# Order matters.
for p in obj.paths:
backend_file.write('ANDROID_RES_DIRS += %s\n' % p.full_path)
@@ -1404,16 +1409,28 @@ class RecursiveMakeBackend(CommonBackend
tier = 'export' if obj.install_target == 'dist/include' else 'misc'
self._no_skip[tier].add(backend_file.relobjdir)
backend_file.write('%s_DEST := $(DEPTH)/%s\n'
% (target_var,
mozpath.join(target, path)))
backend_file.write('%s_TARGET := %s\n' % (target_var, tier))
backend_file.write('INSTALL_TARGETS += %s\n' % target_var)
+ def _process_final_target_babel_files(self, obj, files, backend_file, name):
+ for i, (path, files) in enumerate(files.walk()):
+ self._no_skip['misc'].add(backend_file.relobjdir)
+ var = '%s_%d' % (name, i)
+ for f in files:
+ backend_file.write('%s += %s\n' % (
+ var, self._pretty_path(f, backend_file)))
+ backend_file.write('%s_PATH := $(DEPTH)/%s\n'
+ % (var, mozpath.join(obj.install_target, path)))
+ backend_file.write('%s_TARGET := misc\n' % var)
+ backend_file.write('BABEL_TARGETS += %s\n' % var)
+
def _process_final_target_pp_files(self, obj, files, backend_file, name):
# Bug 1177710 - We'd like to install these via manifests as
# preprocessed files. But they currently depend on non-standard flags
# being added via some Makefiles, so for now we just pass them through
# to the underlying Makefile.in.
#
# Note that if this becomes a manifest, OBJDIR_PP_FILES will likely
# still need to use PP_TARGETS internally because we can't have an
--- a/python/mozbuild/mozbuild/backend/tup.py
+++ b/python/mozbuild/mozbuild/backend/tup.py
@@ -18,16 +18,17 @@ from mozpack.files import (
)
from .common import CommonBackend
from ..frontend.data import (
ChromeManifestEntry,
ContextDerived,
Defines,
FinalTargetFiles,
+ FinalTargetBabeledFiles,
FinalTargetPreprocessedFiles,
GeneratedFile,
HostDefines,
JARManifest,
ObjdirFiles,
)
from ..util import (
FileAvoidWrite,
@@ -207,16 +208,18 @@ class TupOnly(CommonBackend, PartialBack
self._manifest_entries[top_level].add(entry)
self._manifest_entries[obj.path].add(str(obj.entry))
elif isinstance(obj, Defines):
self._process_defines(backend_file, obj)
elif isinstance(obj, HostDefines):
self._process_defines(backend_file, obj, host=True)
elif isinstance(obj, FinalTargetFiles):
self._process_final_target_files(obj)
+ elif isinstance(obj, FinalTargetBabeledFiles):
+ self._process_final_target_babel_files(obj, backend_file)
elif isinstance(obj, FinalTargetPreprocessedFiles):
self._process_final_target_pp_files(obj, backend_file)
elif isinstance(obj, JARManifest):
self._consume_jar_manifest(obj)
return True
def consume_finished(self):
@@ -367,16 +370,22 @@ class TupOnly(CommonBackend, PartialBack
if f.context.relobjdir not in ('layout/style/test',
'toolkit/library'):
output = mozpath.join('$(MOZ_OBJ_ROOT)', target, path,
f.target_basename)
gen_backend_file = self._get_backend_file(f.context.relobjdir)
gen_backend_file.symlink_rule(f.full_path, output=output,
output_group=self._installed_files)
+ def _process_final_target_babel_files(self, obj, backend_file):
+ for i, (path, files) in enumerate(obj.files.walk()):
+ for f in files:
+ self._babel(backend_file, f.full_path,
+ destdir=mozpath.join(self.environment.topobjdir, obj.install_target, path))
+
def _process_final_target_pp_files(self, obj, backend_file):
for i, (path, files) in enumerate(obj.files.walk()):
for f in files:
self._preprocess(backend_file, f.full_path,
destdir=mozpath.join(self.environment.topobjdir, obj.install_target, path))
def _handle_idl_manager(self, manager):
if self.environment.is_artifact_build:
@@ -420,16 +429,34 @@ class TupOnly(CommonBackend, PartialBack
for manifest, entries in manager.interface_manifests.items():
for xpt in entries:
self._manifest_entries[manifest].add('interfaces %s' % xpt)
for m in manager.chrome_manifests:
self._manifest_entries[m].add('manifest components/interfaces.manifest')
+ def _babel(self, backend_file, input_file, destdir=None):
+ # XXXTODO
+ cmd = self._py_action('preprocessor')
+ cmd.extend([shell_quote(d) for d in backend_file.defines])
+ cmd.extend(['$(ACDEFINES)', '%f', '-o', '%o', '--marker=%s' % marker])
+
+ base_input = mozpath.basename(input_file)
+ if base_input.endswith('.in'):
+ base_input = mozpath.splitext(base_input)[0]
+ output = mozpath.join(destdir, base_input) if destdir else base_input
+
+ backend_file.rule(
+ inputs=[input_file],
+ display='Babel %o',
+ cmd=cmd,
+ outputs=[output],
+ )
+
def _preprocess(self, backend_file, input_file, destdir=None):
# .css files use '%' as the preprocessor marker, which must be scaped as
# '%%' in the Tupfile.
marker = '%%' if input_file.endswith('.css') else '#'
cmd = self._py_action('preprocessor')
cmd.extend([shell_quote(d) for d in backend_file.defines])
cmd.extend(['$(ACDEFINES)', '%f', '-o', '%o', '--marker=%s' % marker])
--- a/python/mozbuild/mozbuild/frontend/context.py
+++ b/python/mozbuild/mozbuild/frontend/context.py
@@ -1106,16 +1106,20 @@ VARIABLES = {
FINAL_TARGET_FILES.images['do-not-use'] += ['bar.svg']
"""),
'DISABLE_STL_WRAPPING': (bool, bool,
"""Disable the wrappers for STL which allow it to work with C++ exceptions
disabled.
"""),
+ 'FINAL_TARGET_BABEL_FILES': (ContextDerivedTypedHierarchicalStringList(Path), list,
+ """Like ``FINAL_TARGET_FILES``, with babeling.
+ """),
+
'FINAL_TARGET_PP_FILES': (ContextDerivedTypedHierarchicalStringList(Path), list,
"""Like ``FINAL_TARGET_FILES``, with preprocessing.
"""),
'OBJDIR_FILES': (ContextDerivedTypedHierarchicalStringList(Path), list,
"""List of files to be installed anywhere in the objdir. Use sparingly.
``OBJDIR_FILES`` is similar to FINAL_TARGET_FILES, but it allows copying
@@ -2088,16 +2092,23 @@ SPECIAL_VARIABLES = {
'EXTRA_JS_MODULES': (lambda context: context['FINAL_TARGET_FILES'].modules, list,
"""Additional JavaScript files to distribute.
This variable contains a list of files to copy into
``$(FINAL_TARGET)/modules.
"""),
+ 'EXTRA_BABEL_JS_MODULES': (lambda context: context['FINAL_TARGET_BABEL_FILES'].modules, list,
+ """Additional JavaScript files to distribute.
+
+ This variable contains a list of files to copy into
+ ``$(FINAL_TARGET)/modules``, after babeling.
+ """),
+
'EXTRA_PP_JS_MODULES': (lambda context: context['FINAL_TARGET_PP_FILES'].modules, list,
"""Additional JavaScript files to distribute.
This variable contains a list of files to copy into
``$(FINAL_TARGET)/modules``, after preprocessing.
"""),
'TESTING_JS_MODULES': (lambda context: context['TEST_HARNESS_FILES'].modules, list,
--- a/python/mozbuild/mozbuild/frontend/data.py
+++ b/python/mozbuild/mozbuild/frontend/data.py
@@ -922,16 +922,32 @@ class FinalTargetFiles(ContextDerived):
"""
__slots__ = ('files')
def __init__(self, sandbox, files):
ContextDerived.__init__(self, sandbox)
self.files = files
+class FinalTargetBabeledFiles(ContextDerived):
+ """Sandbox container object for FINAL_TARGET_BABEL_FILES, which is a
+ HierarchicalStringList.
+
+ We need an object derived from ContextDerived for use in the backend, so
+ this object fills that role. It just has a reference to the underlying
+ HierarchicalStringList, which is created when parsing
+ FINAL_TARGET_BABEL_FILES.
+ """
+ __slots__ = ('files')
+
+ def __init__(self, sandbox, files):
+ ContextDerived.__init__(self, sandbox)
+ self.files = files
+
+
class FinalTargetPreprocessedFiles(ContextDerived):
"""Sandbox container object for FINAL_TARGET_PP_FILES, which is a
HierarchicalStringList.
We need an object derived from ContextDerived for use in the backend, so
this object fills that role. It just has a reference to the underlying
HierarchicalStringList, which is created when parsing
FINAL_TARGET_PP_FILES.
--- a/python/mozbuild/mozbuild/frontend/emitter.py
+++ b/python/mozbuild/mozbuild/frontend/emitter.py
@@ -31,16 +31,17 @@ from .data import (
BrandingFiles,
ChromeManifestEntry,
ConfigFileSubstitution,
ContextWrapped,
Defines,
DirectoryTraversal,
Exports,
FinalTargetFiles,
+ FinalTargetBabeledFiles,
FinalTargetPreprocessedFiles,
GeneratedEventWebIDLFile,
GeneratedFile,
GeneratedSources,
GeneratedWebIDLFile,
ExampleWebIDLInterface,
ExternalStaticLibrary,
ExternalSharedLibrary,
@@ -1008,16 +1009,17 @@ class TreeMetadataEmitter(LoggingMixin):
generated_files.update(['%s%s' % (k, self.config.substs.get('BIN_SUFFIX', '')) for k in self._binaries.keys()])
components = []
for var, cls in (
('BRANDING_FILES', BrandingFiles),
('EXPORTS', Exports),
('FINAL_TARGET_FILES', FinalTargetFiles),
+ ('FINAL_TARGET_BABEL_FILES', FinalTargetBabeledFiles),
('FINAL_TARGET_PP_FILES', FinalTargetPreprocessedFiles),
('OBJDIR_FILES', ObjdirFiles),
('OBJDIR_PP_FILES', ObjdirPreprocessedFiles),
('TEST_HARNESS_FILES', TestHarnessFiles),
):
all_files = context.get(var)
if not all_files:
continue
@@ -1033,17 +1035,18 @@ class TreeMetadataEmitter(LoggingMixin):
'Cannot install files to the root of TEST_HARNESS_FILES', context)
if base == 'components':
components.extend(files)
if base == 'defaults/pref':
has_prefs = True
if mozpath.split(base)[0] == 'res':
has_resources = True
for f in files:
- if ((var == 'FINAL_TARGET_PP_FILES' or
+ if ((var == 'FINAL_TARGET_BABEL_FILES' or
+ var == 'FINAL_TARGET_PP_FILES' or
var == 'OBJDIR_PP_FILES') and
not isinstance(f, SourcePath)):
raise SandboxValidationError(
('Only source directory paths allowed in ' +
'%s: %s')
% (var, f,), context)
if not isinstance(f, ObjDirPath):
path = f.full_path
--- a/python/mozbuild/mozbuild/jar.py
+++ b/python/mozbuild/mozbuild/jar.py
@@ -59,21 +59,22 @@ class ZipEntry(object):
def getModTime(aPath):
if not os.path.isfile(aPath):
return 0
mtime = os.stat(aPath).st_mtime
return localtime(mtime)
class JarManifestEntry(object):
- def __init__(self, output, source, is_locale=False, preprocess=False):
+ def __init__(self, output, source, is_locale=False, preprocess=False, babel=False):
self.output = output
self.source = source
self.is_locale = is_locale
self.preprocess = preprocess
+ self.babel = babel
class JarInfo(object):
def __init__(self, base_or_jarinfo, name=None):
if name is None:
assert isinstance(base_or_jarinfo, JarInfo)
self.base = base_or_jarinfo.base
self.name = base_or_jarinfo.name
@@ -101,17 +102,17 @@ class JarManifestParser(object):
(?:\[(?P<base>[\w\d.\-\_\\\/{}@]+)\]\s*)? # optional [base/path]
(?P<jarfile>[\w\d.\-\_\\\/{}]+).jar\: # filename.jar:
|
(?:\s*(\#.*)?) # comment
)\s*$ # whitespaces
''', re.VERBOSE)
relsrcline = re.compile('relativesrcdir\s+(?P<relativesrcdir>.+?):')
regline = re.compile('\%\s+(.*)$')
- entryre = '(?P<optPreprocess>\*)?(?P<optOverwrite>\+?)\s+'
+ entryre = '(?P<optBabel>\&)?(?P<optPreprocess>\*)?(?P<optOverwrite>\+?)\s+'
entryline = re.compile(entryre
+ '(?P<output>[\w\d.\-\_\\\/\+\@]+)\s*(\((?P<locale>\%?)(?P<source>[\w\d.\-\_\\\/\@\*]+)\))?\s*$'
)
def __init__(self):
self._current_jar = None
self._jars = []
@@ -176,16 +177,17 @@ class JarManifestParser(object):
if m.group('optOverwrite'):
raise DeprecatedJarManifest(
'The "+" prefix is not supported anymore')
self._current_jar.entries.append(JarManifestEntry(
m.group('output'),
m.group('source') or mozpath.basename(m.group('output')),
is_locale=bool(m.group('locale')),
preprocess=bool(m.group('optPreprocess')),
+ babel=bool(m.group('optBabel')),
))
return
self._current_jar = None
self.write(line)
def __iter__(self):
return iter(self._jars)
--- a/python/mozbuild/mozpack/files.py
+++ b/python/mozbuild/mozpack/files.py
@@ -470,16 +470,64 @@ class ExistingFile(BaseFile):
if not self.required:
return
if not dest.exists():
errors.fatal("Required existing file doesn't exist: %s" %
dest.path)
+class BabeledFile(BaseFile):
+ '''
+ File class for a file that is run through babel. BabeledFile.copy() runs
+ babel on the file to create the output.
+ '''
+ def __init__(self, path):
+ self.path = path
+
+ def copy(self, dest, skip_if_older=True):
+ '''
+ Invokes babel to create the destination file.
+ '''
+ if isinstance(dest, basestring):
+ dest = Dest(dest)
+ else:
+ assert isinstance(dest, Dest)
+
+ # We have to account for the case where the destination exists and is a
+ # symlink to something. Since we know the preprocessor is certainly not
+ # going to create a symlink, we can just remove the existing one. If the
+ # destination is not a symlink, we leave it alone, since we're going to
+ # overwrite its contents anyway.
+ # If symlinks aren't supported at all, we can skip this step.
+ if hasattr(os, 'symlink'):
+ if os.path.islink(dest.path):
+ os.remove(dest.path)
+
+ if skip_if_older and dest.exists() and BaseFile.is_older(self.path, dest.path):
+ return False
+
+ try:
+ args = []
+ args.append('babel')
+ args.extend(['-o', dest.path])
+ args.append(self.path)
+ subprocess.check_output(args, stderr=subprocess.STDOUT)
+ except subprocess.CalledProcessError as e:
+ errors.warn('Babel failed for %s:' % (self.path))
+ # Prefix each line with "Warning:" so mozharness doesn't
+ # think these error messages are real errors.
+ for line in e.output.splitlines():
+ errors.warn(line)
+
+ raise e
+
+ return True
+
+
class PreprocessedFile(BaseFile):
'''
File class for a file that is preprocessed. PreprocessedFile.copy() runs
the preprocessor on the file to create the output.
'''
def __init__(self, path, depfile_path, marker, defines, extra_depends=None,
silence_missing_directive_warnings=False):
self.path = path
--- a/python/mozbuild/mozpack/manifests.py
+++ b/python/mozbuild/mozpack/manifests.py
@@ -8,16 +8,17 @@ from contextlib import contextmanager
import json
from .files import (
AbsoluteSymlinkFile,
ExistingFile,
File,
FileFinder,
GeneratedFile,
+ BabeledFile,
PreprocessedFile,
)
import mozpack.path as mozpath
# This probably belongs in a more generic module. Where?
@contextmanager
def _auto_fileobj(path, fileobj, mode='r'):
@@ -67,16 +68,19 @@ class InstallManifest(object):
exist.
patternsymlink -- Paths matched by the expression in the source path
will be symlinked to the destination directory.
patterncopy -- Similar to patternsymlink except files are copied, not
symlinked.
+ babel -- The file specified at the source path will be run through babel
+ and the output will be written to the destination path.
+
preprocess -- The file specified at the source path will be run through
the preprocessor, and the output will be written to the destination
path.
content -- The destination file will be created with the given content.
Version 1 of the manifest was the initial version.
Version 2 added optional path support
@@ -94,16 +98,17 @@ class InstallManifest(object):
SYMLINK = 1
COPY = 2
REQUIRED_EXISTS = 3
OPTIONAL_EXISTS = 4
PATTERN_SYMLINK = 5
PATTERN_COPY = 6
PREPROCESS = 7
CONTENT = 8
+ BABEL = 9
def __init__(self, path=None, fileobj=None):
"""Create a new InstallManifest entry.
If path is defined, the manifest will be populated with data from the
file path.
If fileobj is defined, the manifest will be populated with data read
@@ -157,16 +162,22 @@ class InstallManifest(object):
self.add_pattern_symlink(base, pattern, dest)
continue
if record_type == self.PATTERN_COPY:
_, base, pattern, dest = fields[1:]
self.add_pattern_copy(base, pattern, dest)
continue
+ if record_type == self.BABEL:
+ dest, source = fields[1:]
+
+ self.add_babel(source, dest)
+ continue
+
if record_type == self.PREPROCESS:
dest, source, deps, marker, defines, warnings = fields[1:]
self.add_preprocess(source, dest, deps, marker,
self._decode_field_entry(defines),
silence_missing_directive_warnings=bool(int(warnings)))
continue
@@ -295,16 +306,27 @@ class InstallManifest(object):
def add_pattern_copy(self, base, pattern, dest):
"""Add a pattern match that results in copies.
See ``add_pattern_symlink()`` for usage.
"""
self._add_entry(mozpath.join(base, pattern, dest),
(self.PATTERN_COPY, base, pattern, dest))
+ def add_babel(self, source, dest):
+ """Add a babeled file to this manifest.
+
+ ``source`` will be passed through babel, and the output will be
+ written to ``dest``.
+ """
+ self._add_entry(dest, (
+ self.BABEL,
+ source,
+ ))
+
def add_preprocess(self, source, dest, deps, marker='#', defines={},
silence_missing_directive_warnings=False):
"""Add a preprocessed file to this manifest.
``source`` will be passed through preprocessor.py, and the output will be
written to ``dest``.
"""
self._add_entry(dest, (
@@ -370,16 +392,21 @@ class InstallManifest(object):
cls = File
for path in paths:
source = mozpath.join(base, path)
registry.add(mozpath.join(dest, path), cls(source))
continue
+ if install_type == self.BABEL:
+ registry.add(dest, BabeledFile(entry[1]))
+
+ continue
+
if install_type == self.PREPROCESS:
defines = self._decode_field_entry(entry[4])
if defines_override:
defines.update(defines_override)
registry.add(dest, PreprocessedFile(entry[1],
depfile_path=entry[2],
marker=entry[3],
defines=defines,
--- a/toolkit/modules/moz.build
+++ b/toolkit/modules/moz.build
@@ -159,16 +159,20 @@ MOCHITEST_CHROME_MANIFESTS += ['tests/ch
TESTING_JS_MODULES += [
'tests/modules/MockDocument.jsm',
'tests/modules/PromiseTestUtils.jsm',
'tests/xpcshell/TestIntegration.jsm',
]
SPHINX_TREES['toolkit_modules'] = 'docs'
+EXTRA_BABEL_JS_MODULES += [
+ 'Preferences.jsm',
+]
+
EXTRA_JS_MODULES += [
'addons/MatchPattern.jsm',
'addons/WebNavigation.jsm',
'addons/WebNavigationContent.js',
'addons/WebNavigationFrames.jsm',
'addons/WebRequest.jsm',
'addons/WebRequestCommon.jsm',
'addons/WebRequestContent.js',
@@ -212,17 +216,16 @@ EXTRA_JS_MODULES += [
'Memory.jsm',
'NewTabUtils.jsm',
'NLP.jsm',
'ObjectUtils.jsm',
'PageMenu.jsm',
'PageMetadata.jsm',
'PermissionsUtils.jsm',
'PopupNotifications.jsm',
- 'Preferences.jsm',
'PrivateBrowsingUtils.jsm',
'ProfileAge.jsm',
'Promise-backend.js',
'Promise.jsm',
'PromiseMessage.jsm',
'PromiseUtils.jsm',
'RemoteController.jsm',
'RemoteFinder.jsm',