Bug 1445398 - Do not re-generate buildid.h for every Tup build. r=mshal

MozReview-Commit-ID: ErkTDOU8lYH

--HG--
extra : rebase_source : 085b0cb43b625fbb2691aa6bc788b62549927a02
This commit is contained in:
Chris Manchester 2018-03-22 16:03:12 -07:00
Родитель 2f468a0fcb
Коммит fcf16fe1e7
2 изменённых файлов: 19 добавлений и 11 удалений

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

@ -151,15 +151,12 @@ endif
.PHONY: tup
tup:
$(call BUILDSTATUS,TIERS $(if $(MOZ_ARTIFACT_BUILDS),artifact )make tup)
$(call BUILDSTATUS,TIERS $(if $(MOZ_ARTIFACT_BUILDS),artifact )tup)
ifdef MOZ_ARTIFACT_BUILDS
$(call BUILDSTATUS,TIER_START artifact)
$(MAKE) recurse_artifact
$(call BUILDSTATUS,TIER_FINISH artifact)
endif
$(call BUILDSTATUS,TIER_START make)
$(MAKE) buildid.h source-repo.h
$(call BUILDSTATUS,TIER_FINISH make)
$(call BUILDSTATUS,TIER_START tup)
@$(TUP) $(if $(findstring s,$(filter-out --%,$(MAKEFLAGS))),,--verbose)
$(call BUILDSTATUS,TIER_FINISH tup)

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

@ -188,6 +188,10 @@ class TupOnly(CommonBackend, PartialBackend):
# will be built before any rules that list this as an input.
self._installed_idls = '$(MOZ_OBJ_ROOT)/<installed-idls>'
self._installed_files = '$(MOZ_OBJ_ROOT)/<installed-files>'
# The preprocessor including source-repo.h and buildid.h creates
# dependencies that aren't specified by moz.build and cause errors
# in Tup. Express these as a group dependency.
self._early_generated_files = '$(MOZ_OBJ_ROOT)/<early-generated-files>'
def _get_backend_file(self, relobjdir):
objdir = mozpath.normpath(mozpath.join(self.environment.topobjdir, relobjdir))
@ -221,14 +225,10 @@ class TupOnly(CommonBackend, PartialBackend):
backend_file = self._get_backend_file_for(obj)
if isinstance(obj, GeneratedFile):
# These files are already generated by make before tup runs.
skip_files = (
'buildid.h',
'source-repo.h',
)
skip_files = []
if self.environment.is_artifact_build:
skip_files = skip_files + self._compile_env_gen_files
skip_files = self._compile_env_gen_files
for f in obj.outputs:
if any(mozpath.match(f, p) for p in skip_files):
@ -271,6 +271,12 @@ class TupOnly(CommonBackend, PartialBackend):
elif isinstance(obj, VariablePassthru):
backend_file.variables = obj.variables
# The top-level Makefile.in still contains our driver target and some
# things related to artifact builds, so as a special case ensure the
# make backend generates a Makefile there.
if obj.objdir == self.environment.topobjdir:
return False
return True
def consume_finished(self):
@ -347,7 +353,11 @@ class TupOnly(CommonBackend, PartialBackend):
outputs.extend(obj.outputs)
outputs.append('%s.pp' % obj.outputs[0])
extra_outputs = [self._installed_files] if obj.required_for_compile else None
if any(f in obj.outputs for f in ('source-repo.h', 'buildid.h')):
extra_outputs = [self._early_generated_files]
else:
extra_outputs = [self._installed_files] if obj.required_for_compile else []
full_inputs += [self._early_generated_files]
backend_file.rule(
display='python {script}:{method} -> [%o]'.format(script=obj.script, method=obj.method),
@ -514,6 +524,7 @@ class TupOnly(CommonBackend, PartialBackend):
backend_file.rule(
inputs=[input_file],
extra_inputs=[self._early_generated_files],
display='Preprocess %o',
cmd=cmd,
outputs=[output],