Bug 1645986 - Move most GeneratedFile generation to top-level backend.mk. r=firefox-build-system-reviewers,rstewart

While ideally we'd just move all of them at the top-level, there are
other things that depend on them that wouldn't then get the right
dependencies. One of them is install steps in dist/something, but there
are others, and that's a rather long pole of things requiring many
changes along with chances to break things.

So instead, we go with a simpler and more limited approach, where we
still recurse into directories to run their export tier (to run whatever
else than GeneratedFiles they have), but ensure the GeneratedFiles we
moved at the top-level are built before recursing by making
directory/export depend on them.

Differential Revision: https://phabricator.services.mozilla.com/D80608
This commit is contained in:
Mike Hommey 2020-06-24 04:23:02 +00:00
Родитель 47bca8b390
Коммит a87a1c3b54
3 изменённых файлов: 27 добавлений и 11 удалений

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

@ -169,10 +169,10 @@ widget/android/bindings/export: mobile/android/base/export
widget/android/export: mobile/android/base/export
# CSS2Properties.webidl needs ServoCSSPropList.py from layout/style
dom/bindings/export: layout/style/export
dom/bindings/export: layout/style/ServoCSSPropList.py
# Various telemetry histogram files need ServoCSSPropList.py from layout/style
toolkit/components/telemetry/export: layout/style/export
toolkit/components/telemetry/export: layout/style/ServoCSSPropList.py
# The update agent needs to link to the updatecommon library, but the build system does not
# currently have a good way of expressing this dependency.

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

@ -81,7 +81,7 @@ class MakeBackend(CommonBackend):
# Android localized resources have special Makefile
# handling.
ret.append('%s%s: %s' % (
tier, ':' if tier != 'default' else '', stub_file))
tier, ':' if tier in ('export', 'libs', 'misc') else '', stub_file))
for output in outputs:
ret.append('%s: %s ;' % (output, stub_file))
ret.append('GARBAGE += %s' % output)

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

@ -397,11 +397,19 @@ class RecursiveMakeBackend(MakeBackend):
return summary
def _get_backend_file_for(self, obj):
if obj.objdir not in self._backend_files:
self._backend_files[obj.objdir] = \
BackendMakeFile(obj.srcdir, obj.objdir, obj.config,
# For generated files that we put in the export or misc tiers, we use the
# top-level backend file.
if isinstance(obj, GeneratedFile) and not obj.required_during_compile and \
not obj.localized:
objdir = self.environment.topobjdir
else:
objdir = obj.objdir
if objdir not in self._backend_files:
self._backend_files[objdir] = \
BackendMakeFile(obj.srcdir, objdir, obj.config,
obj.topsrcdir, self.environment.topobjdir, self.dry_run)
return self._backend_files[obj.objdir]
return self._backend_files[objdir]
def consume_object(self, obj):
"""Write out build files necessary to build with recursive make."""
@ -543,11 +551,17 @@ class RecursiveMakeBackend(MakeBackend):
else:
tier = 'misc'
if tier:
self._no_skip[tier].add(backend_file.relobjdir)
relobjdir = mozpath.relpath(obj.objdir, self.environment.topobjdir)
self._no_skip[tier].add(relobjdir)
backend_file.write_once('include $(topsrcdir)/config/AB_rCD.mk\n')
relobjdir = mozpath.relpath(obj.objdir, backend_file.objdir)
# For generated files that we handle in the top-level backend file,
# we want to have a `directory/tier` target depending on the file.
# For the others, we want a `tier` target.
if tier and relobjdir:
tier = '%s/%s' % (relobjdir, tier)
for stmt in self._format_statements_for_generated_file(
obj, tier,
extra_dependencies='backend.mk' if obj.flags else ''):
obj, tier, extra_dependencies='backend.mk' if obj.flags else ''):
backend_file.write(stmt + '\n')
elif isinstance(obj, JARManifest):
@ -1771,4 +1785,6 @@ class RecursiveMakeBackend(MakeBackend):
return self._pretty_path(path, self._get_backend_file_for(obj))
def _format_generated_file_output_name(self, path, obj):
return path
if not isinstance(path, Path):
path = ObjDirPath(obj._context, '!' + path)
return self._pretty_path(path, self._get_backend_file_for(obj))