Bug 1455892 - Use a tracking stub file rather than a phony target to speed up ipdl in incremental builds. r=froydnj

This commit removes some mtime checking logic in ipdl.py that is made redundant
with make's logic to re-invoke ipdl.py when dependencies have changed.


MozReview-Commit-ID: FJuYIZv5uym

--HG--
extra : rebase_source : 9e11ead04bd69eb1f30160fdb15b8ac74b183f87
This commit is contained in:
Chris Manchester 2018-05-03 12:54:21 -07:00
Родитель d63d487c3f
Коммит 5b50d3c787
2 изменённых файлов: 10 добавлений и 61 удалений

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

@ -12,10 +12,16 @@ include ipdlsrcs.mk
include $(topsrcdir)/config/rules.mk
ipdl_py_deps := \
$(wildcard $(srcdir)/*.py) \
$(wildcard $(srcdir)/ipdl/*.py) \
$(wildcard $(srcdir)/ipdl/cxx/*.py) \
$(wildcard $(topsrcdir)/other-licenses/ply/ply/*.py) \
$(NULL)
# NB: the IPDL compiler manages .ipdl-->.h/.cpp dependencies itself,
# which is why we don't have explicit .h/.cpp targets here
ipdl: $(ALL_IPDLSRCS)
ipdl.track: $(ALL_IPDLSRCS) $(srcdir)/sync-messages.ini $(srcdir)/message-metadata.ini $(ipdl_py_deps)
$(PYTHON) $(topsrcdir)/config/pythonpath.py \
$(PLY_INCLUDE) \
$(srcdir)/ipdl.py \
@ -24,10 +30,9 @@ ipdl: $(ALL_IPDLSRCS)
--outheaders-dir=_ipdlheaders \
--outcpp-dir=. \
$(IPDLDIRS:%=-I%) \
$^
$(ALL_IPDLSRCS)
touch $@
.PHONY: ipdl
export:: ipdl
export:: ipdl.track
endif

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

@ -4,9 +4,7 @@
import optparse, os, re, sys
from cStringIO import StringIO
from mozbuild.pythonutil import iter_modules_in_path
import mozpack.path as mozpath
import itertools
from ConfigParser import RawConfigParser
import ipdl
@ -54,60 +52,6 @@ if not len(files):
ipcmessagestartpath = os.path.join(headersdir, 'IPCMessageStart.h')
ipc_msgtype_name_path = os.path.join(cppdir, 'IPCMessageTypeName.cpp')
# Compiling the IPDL files can take a long time, even on a fast machine.
# Check to see whether we need to do any work.
latestipdlmod = max(os.stat(f).st_mtime
for f in itertools.chain(files,
iter_modules_in_path(mozpath.dirname(__file__))))
def outputModTime(f):
# A non-existant file is newer than everything.
if not os.path.exists(f):
return 0
return os.stat(f).st_mtime
# Because the IPDL headers are placed into directories reflecting their
# namespace, collect a list here so we can easily map output names without
# parsing the actual IPDL files themselves.
headersmap = {}
for (path, dirs, headers) in os.walk(headersdir):
for h in headers:
base = os.path.basename(h)
if base in headersmap:
root, ext = os.path.splitext(base)
print >>sys.stderr, 'A protocol named', root, 'exists in multiple namespaces'
sys.exit(1)
headersmap[base] = os.path.join(path, h)
def outputfiles(f):
base = os.path.basename(f)
root, ext = os.path.splitext(base)
suffixes = ['']
if ext == '.ipdl':
suffixes += ['Child', 'Parent']
for suffix in suffixes:
yield os.path.join(cppdir, "%s%s.cpp" % (root, suffix))
header = "%s%s.h" % (root, suffix)
# If the header already exists on disk, use that. Otherwise,
# just claim that the header is found in headersdir.
if header in headersmap:
yield headersmap[header]
else:
yield os.path.join(headersdir, header)
def alloutputfiles():
for f in files:
for s in outputfiles(f):
yield s
yield ipcmessagestartpath
earliestoutputmod = min(outputModTime(f) for f in alloutputfiles())
if latestipdlmod < earliestoutputmod:
sys.exit(0)
log(2, 'Generated C++ headers will be generated relative to "%s"', headersdir)
log(2, 'Generated C++ sources will be generated in "%s"', cppdir)