Commit a179d833 authored by Andrew Grieve's avatar Andrew Grieve Committed by Commit Bot

Android: Make "fetch_all.py --debug" output gradle logs

Change-Id: I07460e38136338fd944adee6dabd837380b6df97
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1903960
Auto-Submit: Andrew Grieve <agrieve@chromium.org>
Reviewed-by: default avatarPeter Wen <wnwen@chromium.org>
Commit-Queue: Peter Wen <wnwen@chromium.org>
Cr-Commit-Position: refs/heads/master@{#713463}
parent 613f2b7f
...@@ -118,7 +118,7 @@ def RaiseCommandException(args, returncode, output, error): ...@@ -118,7 +118,7 @@ def RaiseCommandException(args, returncode, output, error):
raise Exception(message) raise Exception(message)
def RunCommand(args): def RunCommand(args, print_stdout=False):
"""Run a new shell command. """Run a new shell command.
This function runs without printing anything. This function runs without printing anything.
...@@ -130,7 +130,8 @@ def RunCommand(args): ...@@ -130,7 +130,8 @@ def RunCommand(args):
return status, and standard output + error merged in a single message. return status, and standard output + error merged in a single message.
""" """
logging.debug('Run %s', args) logging.debug('Run %s', args)
p = subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) stdout = None if print_stdout else subprocess.PIPE
p = subprocess.Popen(args, stdout=stdout)
pout, _ = p.communicate() pout, _ = p.communicate()
if p.returncode != 0: if p.returncode != 0:
RaiseCommandException(args, p.returncode, None, pout) RaiseCommandException(args, p.returncode, None, pout)
...@@ -390,7 +391,8 @@ def main(): ...@@ -390,7 +391,8 @@ def main():
build_gradle = ReadFile(build_gradle_path) build_gradle = ReadFile(build_gradle_path)
print('# Resetting and re-syncing workspace. (may take a while).') print('# Resetting and re-syncing workspace. (may take a while).')
RunCommand(['gclient', 'sync', '--reset', '--nohooks', '-r', 'src@HEAD']) RunCommand(['gclient', 'sync', '--reset', '--nohooks', '-r', 'src@HEAD'],
print_stdout=args.debug)
print('# Restoring build.gradle.') print('# Restoring build.gradle.')
WriteFile(build_gradle_path, build_gradle) WriteFile(build_gradle_path, build_gradle)
...@@ -440,7 +442,7 @@ def main(): ...@@ -440,7 +442,7 @@ def main():
if args.debug: if args.debug:
gradle_cmd.append('--debug') gradle_cmd.append('--debug')
RunCommand(gradle_cmd) RunCommand(gradle_cmd, print_stdout=args.debug)
libs_dir = os.path.join(build_dir, args.git_dir, _ANDROID_DEPS_LIBS_SUBDIR) libs_dir = os.path.join(build_dir, args.git_dir, _ANDROID_DEPS_LIBS_SUBDIR)
...@@ -449,7 +451,7 @@ def main(): ...@@ -449,7 +451,7 @@ def main():
'gn', 'format', 'gn', 'format',
os.path.join(build_dir, args.git_dir, _ANDROID_DEPS_BUILD_GN) os.path.join(build_dir, args.git_dir, _ANDROID_DEPS_BUILD_GN)
] ]
RunCommand(gn_args) RunCommand(gn_args, print_stdout=args.debug)
print('# Generate Android .aar info and third-party license files.') print('# Generate Android .aar info and third-party license files.')
aar_files = FindInDirectory(libs_dir, '*.aar') aar_files = FindInDirectory(libs_dir, '*.aar')
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment