Bug 1317778 - Emit a depfile with python configure dependencies so Make will know when to re-run configure. r=glandium

MozReview-Commit-ID: AuTHadY7KqO
This commit is contained in:
Chris Manchester 2016-12-02 10:05:57 -08:00
Родитель bd0e833124
Коммит eb8660f21f
3 изменённых файлов: 27 добавлений и 2 удалений

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

@ -329,6 +329,10 @@ CONFIG_STATUS_DEPS := \
$(OBJDIR)/.mozconfig.json \
$(NULL)
# Include a dep file emitted by configure to track Python files that
# may influence the result of configure.
-include $(OBJDIR)/configure.d
CONFIGURE_ENV_ARGS += \
MAKE='$(MAKE)' \
$(NULL)

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

@ -5,6 +5,7 @@
from __future__ import print_function, unicode_literals
import codecs
import itertools
import os
import subprocess
import sys
@ -14,6 +15,8 @@ import textwrap
base_dir = os.path.abspath(os.path.dirname(__file__))
sys.path.insert(0, os.path.join(base_dir, 'python', 'mozbuild'))
from mozbuild.configure import ConfigureSandbox
from mozbuild.makeutil import Makefile
from mozbuild.pythonutil import iter_modules_in_path
from mozbuild.util import (
indented_repr,
encode,
@ -46,7 +49,8 @@ def config_status(config):
sanitized_config = {}
sanitized_config['substs'] = {
k: sanitized_bools(v) for k, v in config.iteritems()
if k not in ('DEFINES', 'non_global_defines', 'TOPSRCDIR', 'TOPOBJDIR')
if k not in ('DEFINES', 'non_global_defines', 'TOPSRCDIR', 'TOPOBJDIR',
'ALL_CONFIGURE_PATHS')
}
sanitized_config['defines'] = {
k: sanitized_bools(v) for k, v in config['DEFINES'].iteritems()
@ -84,6 +88,17 @@ def config_status(config):
config_status(**args)
'''))
# Write out a depfile so Make knows to re-run configure when relevant Python
# changes.
mk = Makefile()
rule = mk.create_rule()
rule.add_targets(["$(OBJDIR)/config.status"])
rule.add_dependencies(itertools.chain(config['ALL_CONFIGURE_PATHS'],
iter_modules_in_path(config['TOPOBJDIR'],
config['TOPSRCDIR'])))
with open('configure.d', 'w') as fh:
mk.dump(fh)
# Other things than us are going to run this file, so we need to give it
# executable permissions.
os.chmod('config.status', 0o755)

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

@ -338,4 +338,10 @@ def nsis_binary_type(nsis):
# Fallthrough to autoconf-based configure
include('build/moz.configure/old.configure')
# Please do not add anything after the include of old.configure.
@imports('__sandbox__')
def all_paths():
return __sandbox__._all_paths
set_config('ALL_CONFIGURE_PATHS', all_paths())
# Please do not add anything after setting ALL_CONFIGURE_PATHS.