Bug 1455892 - Use a tracking stub file rather than a phony target to speed up ipdl in incremental builds. r=froydnj
☠☠ backed out by b63df024b612 ☠ ☠
authorChris Manchester <cmanchester@mozilla.com>
Thu, 03 May 2018 12:54:21 -0700
changeset 472909 23400e395408c6816d3afc0d4c192013b4cd8e69
parent 472908 2df67c1f498034276cb118e3476d099b80a2807f
child 472910 4701762470f24c26fce7f1e18cec46e6a7d15f29
push id1728
push userjlund@mozilla.com
push dateMon, 18 Jun 2018 21:12:27 +0000
treeherdermozilla-release@c296fde26f5f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfroydnj
bugs1455892
milestone61.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
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
ipc/ipdl/Makefile.in
ipc/ipdl/ipdl.py
--- a/ipc/ipdl/Makefile.in
+++ b/ipc/ipdl/Makefile.in
@@ -7,27 +7,32 @@ GARBAGE += ipdl_lextab.py ipdl_yacctab.p
 
 ifdef COMPILE_ENVIRONMENT
 
 # This file is generated by the moz.build backend.
 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 \
 	  --sync-msg-list=$(srcdir)/sync-messages.ini \
 	  --msg-metadata=$(srcdir)/message-metadata.ini \
 	  --outheaders-dir=_ipdlheaders \
 	  --outcpp-dir=. \
 	  $(IPDLDIRS:%=-I%) \
-	  $^
+	  $(ALL_IPDLSRCS)
+	touch $@
 
-.PHONY: ipdl
-
-export:: ipdl
+export:: ipdl.track
 endif
 
--- a/ipc/ipdl/ipdl.py
+++ b/ipc/ipdl/ipdl.py
@@ -1,17 +1,15 @@
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 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
 
 def log(minv, fmt, *args):
     if _verbosity >= minv:
         print fmt % args
 
@@ -49,70 +47,16 @@ cppdir = options.cppdir
 includedirs = [ os.path.abspath(incdir) for incdir in options.includedirs ]
 
 if not len(files):
     op.error("No IPDL files specified")
 
 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)
 
 allmessages = {}
 allmessageprognames = []
 allprotocols = []
 
 def normalizedFilename(f):