Bug 1487840 - Trim tup's display of rust build scripts; r=chmanchester

We already trim the display of output lists for GENERATED_FILES scripts
that produce many outputs, so we should do the same for rust build
scripts. This makes the terminal output of the build and the nodes from
'tup graph' more readable.

MozReview-Commit-ID: AftmrA4qJlr

Differential Revision: https://phabricator.services.mozilla.com/D4797

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Mike Shal 2018-08-31 20:48:22 +00:00
Родитель 21676b6ed7
Коммит 58e7879466
1 изменённых файлов: 11 добавлений и 7 удалений

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

@ -358,6 +358,14 @@ class TupBackend(CommonBackend):
return [mozpath.relpath(mozpath.join(l.objdir, l.import_name), objdir)
for l in libs]
def _trim_outputs(self, outputs):
# Trim an output list for display to at most 3 entries
if len(outputs) > 3:
display_outputs = ', '.join(outputs[0:3]) + ', ...'
else:
display_outputs = ', '.join(outputs)
return display_outputs
def _gen_shared_library(self, backend_file):
shlib = backend_file.shared_lib
@ -771,8 +779,8 @@ class TupBackend(CommonBackend):
def display_name(invocation):
output_str = ''
if invocation['outputs']:
output_str = ' -> %s' % ' '.join([os.path.basename(f)
for f in invocation['outputs']])
outputs = [os.path.basename(f) for f in invocation['outputs']]
output_str = ' -> [%s]' % self._trim_outputs(outputs)
return '{name} v{version} {kind}{output}'.format(
name=invocation['package_name'],
version=invocation['package_version'],
@ -929,14 +937,10 @@ class TupBackend(CommonBackend):
'dependendentlibs.list.gtest')):
extra_inputs += [self._shlibs]
if len(outputs) > 3:
display_outputs = ', '.join(outputs[0:3]) + ', ...'
else:
display_outputs = ', '.join(outputs)
display = 'python {script}:{method} -> [{display_outputs}]'.format(
script=obj.script,
method=obj.method,
display_outputs=display_outputs
display_outputs=self._trim_outputs(outputs),
)
backend_file.rule(
display=display,