зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1490463 - part 1 - emit a srcdir_rel variable in every directory; r=mshal
Many Windows tools don't deal well with absolute paths for filenames, oddly enough, so we want to pass relative paths into the source directory where possible. These relative paths also mean that they look like "normal" unix paths to WSL and therefore don't require any special handling.
This commit is contained in:
Родитель
de99592416
Коммит
e268670d4f
|
@ -317,6 +317,7 @@ class BuildBackend(LoggingMixin):
|
|||
top_srcdir=obj.topsrcdir,
|
||||
topobjdir=obj.topobjdir,
|
||||
srcdir=srcdir,
|
||||
srcdir_rel=mozpath.relpath(srcdir, mozpath.dirname(obj.output_path)),
|
||||
relativesrcdir=mozpath.relpath(srcdir, obj.topsrcdir) or '.',
|
||||
DEPTH=mozpath.relpath(obj.topobjdir, mozpath.dirname(obj.output_path)) or '.',
|
||||
)
|
||||
|
|
|
@ -1677,6 +1677,7 @@ class RecursiveMakeBackend(CommonBackend):
|
|||
pp.handleLine(b'topobjdir := @topobjdir@\n')
|
||||
pp.handleLine(b'topsrcdir := @top_srcdir@\n')
|
||||
pp.handleLine(b'srcdir := @srcdir@\n')
|
||||
pp.handleLine(b'srcdir_rel := @srcdir_rel@\n')
|
||||
pp.handleLine(b'VPATH := @srcdir@\n')
|
||||
pp.handleLine(b'relativesrcdir := @relativesrcdir@\n')
|
||||
pp.handleLine(b'include $(DEPTH)/config/@autoconfmk@\n')
|
||||
|
|
|
@ -225,6 +225,7 @@ class TestRecursiveMakeBackend(BackendTester):
|
|||
'topobjdir := %s' % env.topobjdir,
|
||||
'topsrcdir := %s' % env.topsrcdir,
|
||||
'srcdir := %s' % env.topsrcdir,
|
||||
'srcdir_rel := %s' % mozpath.relpath(env.topsrcdir, env.topobjdir),
|
||||
'VPATH := %s' % env.topsrcdir,
|
||||
'relativesrcdir := .',
|
||||
'include $(DEPTH)/config/autoconf.mk',
|
||||
|
@ -242,7 +243,7 @@ class TestRecursiveMakeBackend(BackendTester):
|
|||
self.assertTrue(os.path.exists(p))
|
||||
|
||||
lines = [l.strip() for l in open(p, 'rt').readlines()]
|
||||
self.assertEqual(len(lines), 10)
|
||||
self.assertEqual(len(lines), 11)
|
||||
|
||||
self.assertTrue(lines[0].startswith('# THIS FILE WAS AUTOMATICALLY'))
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче