Bug 1319226 - Process JARManifests in the tup backend; r=chmanchester

The JARManifests are relatively straightforward since they can be
converted into FinalTargetFiles by _consume_jar_manifest(). Since these
can contain RenamedSourcePaths, we no longer assert an error for those.
The main difference is that some JARManifests can result in
preprocessing .css files, which use a different marker than the default.

The two odd cases are bookmarks.html.in and buildconfig.html. The first
relies on an l10n define in a Makefile, while the latter needs CXXFLAGS.
The faster make backend works around these by defining
BOOKMARKS_INCLUDE_DIR to the en-US version, and skips the CXXFLAGS case
by defining BUILD_FASTER=1, so that is what the tup backend does for now
as well.

MozReview-Commit-ID: LlmNjQ2g40j

--HG--
extra : rebase_source : 2665a8115fac5329f2ddb49887b08607bcd4aa84
This commit is contained in:
Mike Shal 2017-05-26 10:43:31 -04:00
parent 5f23da269d
commit 93714d3413

View File

@ -20,6 +20,7 @@ from ..frontend.data import (
FinalTargetPreprocessedFiles,
GeneratedFile,
HostDefines,
JARManifest,
ObjdirFiles,
)
from ..util import (
@ -27,7 +28,6 @@ from ..util import (
)
from ..frontend.context import (
AbsolutePath,
RenamedSourcePath,
ObjDirPath,
)
@ -187,6 +187,8 @@ class TupOnly(CommonBackend, PartialBackend):
self._process_final_target_files(obj)
elif isinstance(obj, FinalTargetPreprocessedFiles):
self._process_final_target_pp_files(obj, backend_file)
elif isinstance(obj, JARManifest):
self._consume_jar_manifest(obj)
return True
@ -208,6 +210,14 @@ class TupOnly(CommonBackend, PartialBackend):
# TODO: AB_CD only exists in Makefiles at the moment.
acdefines_flags += ' -DAB_CD=en-US'
# TODO: BOOKMARKS_INCLUDE_DIR is used by bookmarks.html.in, and is
# only defined in browser/locales/Makefile.in
acdefines_flags += ' -DBOOKMARKS_INCLUDE_DIR=%s/browser/locales/en-US/profile' % self.environment.topsrcdir
# Use BUILD_FASTER to avoid CXXFLAGS/CPPFLAGS in
# toolkit/content/buildconfig.html
acdefines_flags += ' -DBUILD_FASTER=1'
fh.write('MOZ_OBJ_ROOT = $(TUP_CWD)\n')
fh.write('DIST = $(MOZ_OBJ_ROOT)/dist\n')
fh.write('ACDEFINES = %s\n' % acdefines_flags)
@ -281,7 +291,6 @@ class TupOnly(CommonBackend, PartialBackend):
for path, files in obj.files.walk():
backend_file = self._get_backend_file(mozpath.join(target, path))
for f in files:
assert not isinstance(f, RenamedSourcePath)
if not isinstance(f, ObjDirPath):
if '*' in f:
if f.startswith('/') or isinstance(f, AbsolutePath):
@ -346,9 +355,13 @@ class TupOnly(CommonBackend, PartialBackend):
)
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(backend_file.defines)
cmd.extend(['$(ACDEFINES)', '%f', '-o', '%o'])
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'):