Bug 916257 - part 2 - separate out files-from-this-ipdl logic from writing CPPSRCS; r=gps

This commit is contained in:
Nathan Froyd 2013-09-13 15:03:15 -04:00
Родитель ca8aa75ab6
Коммит 5f1bce160d
2 изменённых файлов: 23 добавлений и 14 удалений

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

@ -559,15 +559,19 @@ class RecursiveMakeBackend(CommonBackend):
for p in sorted(self._ipdl_sources):
mk.add_statement('ALL_IPDLSRCS += %s\n' % p)
base = os.path.basename(p)
root, ext = os.path.splitext(base)
def files_from(ipdl):
base = os.path.basename(ipdl)
root, ext = os.path.splitext(base)
# Both .ipdl and .ipdlh become .cpp files
mk.add_statement('CPPSRCS += %s.cpp\n' % root)
if ext == '.ipdl':
# .ipdl also becomes Child/Parent.cpp files
mk.add_statement('CPPSRCS += %sChild.cpp\n' % root)
mk.add_statement('CPPSRCS += %sParent.cpp\n' % root)
# 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
mk.add_statement('CPPSRCS += %s\n' % ' '.join(files_from(p)))
mk.add_statement('IPDLDIRS := %s\n' % ' '.join(sorted(set(os.path.dirname(p)
for p in self._ipdl_sources))))

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

@ -468,18 +468,23 @@ class TestRecursiveMakeBackend(BackendTester):
expected = [
"ALL_IPDLSRCS += %s/bar/bar.ipdl" % topsrcdir,
"CPPSRCS += bar.cpp",
"CPPSRCS += barChild.cpp",
"CPPSRCS += barParent.cpp",
"",
"CPPSRCS += bar.cpp barChild.cpp barParent.cpp",
"",
"ALL_IPDLSRCS += %s/bar/bar2.ipdlh" % topsrcdir,
"",
"CPPSRCS += bar2.cpp",
"",
"ALL_IPDLSRCS += %s/foo/foo.ipdl" % topsrcdir,
"CPPSRCS += foo.cpp",
"CPPSRCS += fooChild.cpp",
"CPPSRCS += fooParent.cpp",
"",
"CPPSRCS += foo.cpp fooChild.cpp fooParent.cpp",
"",
"ALL_IPDLSRCS += %s/foo/foo2.ipdlh" % topsrcdir,
"",
"CPPSRCS += foo2.cpp",
"",
"IPDLDIRS := %s/bar %s/foo" % (topsrcdir, topsrcdir),
"",
]
self.assertEqual(lines, expected)