Bug 1204719 - Don't create interfaces.manifest files from the build backend. r=gps
authorMike Hommey <mh+mozilla@glandium.org>
Sat, 12 Sep 2015 11:44:53 +0900
changeset 295365 9a34f5c4aae7153c8903130b2536de884a5ad60c
parent 295364 f382a2b702e0187e684d68306a2dedce049385b3
child 295366 048e1162c002dca2e163e29e18cb97034176e7a3
push id5245
push userraliiev@mozilla.com
push dateThu, 29 Oct 2015 11:30:51 +0000
treeherdermozilla-beta@dac831dc1bd0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgps
bugs1204719
milestone43.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 1204719 - Don't create interfaces.manifest files from the build backend. r=gps
config/makefiles/xpidl/Makefile.in
python/mozbuild/mozbuild/action/buildlist.py
python/mozbuild/mozbuild/backend/recursivemake.py
--- a/config/makefiles/xpidl/Makefile.in
+++ b/config/makefiles/xpidl/Makefile.in
@@ -56,26 +56,32 @@ endif
 # if it does exist, make considers it to be up-to-date (as we have no inputs to
 # depend on). We use FORCE to ensure that we always add the interface manifest,
 # whether or not the chrome manifest already exists.
 %/chrome.manifest: FORCE
 	$(call py_action,buildlist,$@ 'manifest components/interfaces.manifest')
 
 chrome_manifests := @chrome_manifests@
 
+%/interfaces.manifest: Makefile
+	$(call py_action,buildlist,$@ $(foreach xpt,$(filter $*/%,$(registered_xpt_files)),'interfaces $(notdir $(xpt))'))
+
+interfaces_manifests := @interfaces_manifests@
+
 xpidl_modules := @xpidl_modules@
-xpt_files := @xpt_files@
+registered_xpt_files := @registered_xpt_files@
+xpt_files := $(registered_xpt_files) @xpt_files@
 
 @xpidl_rules@
 
 depends_files := $(foreach root,$(xpidl_modules),$(idl_deps_dir)/$(root).pp)
 
 GARBAGE += $(xpt_files) $(depends_files)
 
-xpidl:: $(xpt_files) $(chrome_manifests)
+xpidl:: $(xpt_files) $(chrome_manifests) $(interfaces_manifests)
 
 $(xpt_files): $(process_py) $(call mkdir_deps,$(idl_deps_dir) $(dist_include_dir))
 
 -include $(depends_files)
 
 define xpt_deps
 $(1): $(call mkdir_deps,$(dir $(1)))
 $(1): $(addsuffix .idl,$(addprefix $(dist_idl_dir)/,$($(basename $(notdir $(1)))_deps)))
--- a/python/mozbuild/mozbuild/action/buildlist.py
+++ b/python/mozbuild/mozbuild/action/buildlist.py
@@ -7,22 +7,26 @@ if the entry does not already exist.
 
 Usage: buildlist.py <filename> <entry> [<entry> ...]
 '''
 from __future__ import absolute_import, print_function
 
 import sys
 import os
 
-from mozbuild.util import lock_file
+from mozbuild.util import (
+    ensureParentDir,
+    lock_file,
+)
 
 def addEntriesToListFile(listFile, entries):
   """Given a file |listFile| containing one entry per line,
   add each entry in |entries| to the file, unless it is already
   present."""
+  ensureParentDir(listFile)
   lock = lock_file(listFile + ".lck")
   try:
     if os.path.exists(listFile):
       f = open(listFile)
       existing = set(x.strip() for x in f.readlines())
       f.close()
     else:
       existing = set()
--- a/python/mozbuild/mozbuild/backend/recursivemake.py
+++ b/python/mozbuild/mozbuild/backend/recursivemake.py
@@ -1095,16 +1095,17 @@ INSTALL_TARGETS += %(prefix)s
 
         for module in manager.modules:
             build_files.add_optional_exists(mozpath.join('.deps',
                 '%s.pp' % module))
 
         modules = manager.modules
         xpt_modules = sorted(modules.keys())
         xpt_files = set()
+        registered_xpt_files = set()
 
         mk = Makefile()
 
         for module in xpt_modules:
             install_target, sources = modules[module]
             deps = sorted(sources)
 
             # It may seem strange to have the .idl files listed as
@@ -1126,25 +1127,26 @@ INSTALL_TARGETS += %(prefix)s
                 prefix, subpath = path.split('/', 1)
                 key = 'dist_%s' % prefix
 
                 self._install_manifests[key].add_optional_exists(subpath)
 
         rules = StringIO()
         mk.dump(rules, removal_guard=False)
 
-        # Write out manifests defining interfaces
+        interfaces_manifests = []
         dist_dir = mozpath.join(self.environment.topobjdir, 'dist')
         for manifest, entries in manager.interface_manifests.items():
-            path = mozpath.join(self.environment.topobjdir, manifest)
-            with self._write_file(path) as fh:
-                for xpt in sorted(entries):
-                    fh.write('interfaces %s\n' % xpt)
+            interfaces_manifests.append(mozpath.join('$(DEPTH)', manifest))
+            for xpt in sorted(entries):
+                registered_xpt_files.add(mozpath.join(
+                    '$(DEPTH)', mozpath.dirname(manifest), xpt))
 
             if install_target.startswith('dist/'):
+                path = mozpath.join(self.environment.topobjdir, manifest)
                 path = mozpath.relpath(path, dist_dir)
                 prefix, subpath = path.split('/', 1)
                 key = 'dist_%s' % prefix
                 self._install_manifests[key].add_optional_exists(subpath)
 
         chrome_manifests = [mozpath.join('$(DEPTH)', m) for m in sorted(manager.chrome_manifests)]
 
         # Create dependency for output header so we force regeneration if the
@@ -1157,19 +1159,21 @@ INSTALL_TARGETS += %(prefix)s
             'makefiles', 'xpidl', 'Makefile')
         obj.input_path = mozpath.join(self.environment.topsrcdir, 'config',
             'makefiles', 'xpidl', 'Makefile.in')
         obj.topsrcdir = self.environment.topsrcdir
         obj.topobjdir = self.environment.topobjdir
         obj.config = self.environment
         self._create_makefile(obj, extra=dict(
             chrome_manifests = ' '.join(chrome_manifests),
+            interfaces_manifests = ' '.join(interfaces_manifests),
             xpidl_rules=rules.getvalue(),
             xpidl_modules=' '.join(xpt_modules),
-            xpt_files=' '.join(sorted(xpt_files)),
+            xpt_files=' '.join(sorted(xpt_files - registered_xpt_files)),
+            registered_xpt_files=' '.join(sorted(registered_xpt_files)),
         ))
 
     def _process_program(self, program, backend_file):
         backend_file.write('PROGRAM = %s\n' % program)
 
     def _process_host_program(self, program, backend_file):
         backend_file.write('HOST_PROGRAM = %s\n' % program)