From 693a67cd38fa47775f1432ebc9f479a97fba5f00 Mon Sep 17 00:00:00 2001 From: Nathan Froyd Date: Fri, 13 Sep 2013 15:09:53 -0400 Subject: [PATCH] Bug 916257 - part 3 - write ALL_IPDLSRCS and CPPSRCS in one go; r=gps --- .../mozbuild/backend/recursivemake.py | 29 ++++++++++--------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/python/mozbuild/mozbuild/backend/recursivemake.py b/python/mozbuild/mozbuild/backend/recursivemake.py index 7244e9e36b31..069017976338 100644 --- a/python/mozbuild/mozbuild/backend/recursivemake.py +++ b/python/mozbuild/mozbuild/backend/recursivemake.py @@ -5,6 +5,7 @@ from __future__ import unicode_literals import errno +import itertools import logging import os import types @@ -289,21 +290,23 @@ class RecursiveMakeBackend(CommonBackend): 'ipc', 'ipdl', 'ipdlsrcs.mk')) mk = mozmakeutil.Makefile() - for p in sorted(self._ipdl_sources): - mk.add_statement('ALL_IPDLSRCS += %s\n' % p) - def files_from(ipdl): - base = os.path.basename(ipdl) - root, ext = os.path.splitext(base) + sorted_ipdl_sources = list(sorted(self._ipdl_sources)) + mk.add_statement('ALL_IPDLSRCS := %s\n' % ' '.join(sorted_ipdl_sources)) - # Both .ipdl and .ipdlh become .cpp files - files = ['%s.cpp' % root] - if ext == '.ipdl': - # .ipdl also becomes Child/Parent.cpp files - files.extend(['%sChild.cpp' % root, - '%sParent.cpp' % root]) - return files + def files_from(ipdl): + base = os.path.basename(ipdl) + root, ext = os.path.splitext(base) - mk.add_statement('CPPSRCS += %s\n' % ' '.join(files_from(p))) + # Both .ipdl and .ipdlh become .cpp files + files = ['%s.cpp' % root] + if ext == '.ipdl': + # .ipdl also becomes Child/Parent.cpp files + files.extend(['%sChild.cpp' % root, + '%sParent.cpp' % root]) + return files + + ipdl_cppsrcs = itertools.chain(*[files_from(p) for p in sorted_ipdl_sources]) + mk.add_statement('CPPSRCS := %s\n' % ' '.join(ipdl_cppsrcs)) mk.add_statement('IPDLDIRS := %s\n' % ' '.join(sorted(set(os.path.dirname(p) for p in self._ipdl_sources))))