Fuchsia: Re-land build of VM with Observatory with better debug output.

Review URL: https://codereview.chromium.org/2555813004 .
This commit is contained in:
Zachary Anderson 2016-12-07 13:01:59 -08:00
parent 59ecf032b6
commit 82f3ca2b1d
2 changed files with 85 additions and 80 deletions

View file

@ -607,37 +607,35 @@ template("dart_executable") {
} }
} }
if (!defined(is_fuchsia) || !is_fuchsia) { dart_executable("dart") {
dart_executable("dart") { extra_deps = [
extra_deps = [ "..:libdart",
"..:libdart", ":dart_snapshot_cc",
":dart_snapshot_cc", "../observatory:standalone_observatory_archive",
"../observatory:standalone_observatory_archive", ]
] extra_sources = [ "builtin_nolib.cc" ]
extra_sources = [ "builtin_nolib.cc" ] }
}
dart_executable("dart_noopt") { dart_executable("dart_noopt") {
extra_configs = [ "..:dart_precompiler_config" ] extra_configs = [ "..:dart_precompiler_config" ]
extra_deps = [ extra_deps = [
"..:libdart_noopt", "..:libdart_noopt",
":dart_snapshot_cc", ":dart_snapshot_cc",
"../observatory:standalone_observatory_archive", "../observatory:standalone_observatory_archive",
] ]
extra_sources = [ "builtin_nolib.cc" ] extra_sources = [ "builtin_nolib.cc" ]
} }
dart_executable("dart_precompiled_runtime") { dart_executable("dart_precompiled_runtime") {
extra_configs = [ "..:dart_precompiled_runtime_config" ] extra_configs = [ "..:dart_precompiled_runtime_config" ]
extra_deps = [ extra_deps = [
"..:libdart_precompiled_runtime", "..:libdart_precompiled_runtime",
"../observatory:standalone_observatory_archive", "../observatory:standalone_observatory_archive",
] ]
extra_sources = [ extra_sources = [
"builtin_nolib.cc", "builtin_nolib.cc",
"snapshot_empty.cc", "snapshot_empty.cc",
] ]
}
} }
dart_executable("dart_bootstrap") { dart_executable("dart_bootstrap") {

View file

@ -38,6 +38,19 @@ IGNORE_PATTERNS = shutil.ignore_patterns(
usage = """observatory_tool.py [options]""" usage = """observatory_tool.py [options]"""
# Run |command|. If its return code is 0, return 0 and swallow its output.
# If its return code is non-zero, emit its output unless |always_silent| is
# True, and return the return code.
def RunCommand(command, always_silent=False):
try:
subprocess.check_output(command, stderr=subprocess.STDOUT)
return 0
except subprocess.CalledProcessError as e:
if not always_silent:
print ("Command failed: " + ' '.join(command) + "\n" +
"output: " + e.output)
return e.returncode
def CreateTimestampFile(options): def CreateTimestampFile(options):
if options.stamp != '': if options.stamp != '':
dir_name = os.path.dirname(options.stamp) dir_name = os.path.dirname(options.stamp)
@ -75,45 +88,41 @@ def ProcessOptions(options, args):
print "--sdk expects 'True' or 'False' argument." print "--sdk expects 'True' or 'False' argument."
return False return False
with open(os.devnull, 'wb') as silent_sink: # Required options.
# Required options. if options.command is None or options.directory is None:
if options.command is None or options.directory is None: return False
return False
# Set a default value for pub_snapshot. # Set a default value for pub_snapshot.
options.pub_snapshot = None options.pub_snapshot = None
# If we have a working pub executable, try and use that. # If we have a working pub executable, try and use that.
# TODO(whesse): Drop the pub-executable option if it isn't used. # TODO(whesse): Drop the pub-executable option if it isn't used.
if options.pub_executable is not None: if options.pub_executable is not None:
try: try:
if 0 == subprocess.call([options.pub_executable, '--version'], if 0 == RunCommand([options.pub_executable, '--version'],
stdout=silent_sink, always_silent=True):
stderr=silent_sink): return True
return True except OSError as e:
except OSError as e: pass
pass options.pub_executable = None
options.pub_executable = None
if options.sdk and utils.CheckedInSdkCheckExecutable(): if options.sdk and utils.CheckedInSdkCheckExecutable():
# Use the checked in pub executable. # Use the checked in pub executable.
options.pub_snapshot = os.path.join(utils.CheckedInSdkPath(), options.pub_snapshot = os.path.join(utils.CheckedInSdkPath(),
'bin', 'bin',
'snapshots', 'snapshots',
'pub.dart.snapshot'); 'pub.dart.snapshot');
try: try:
if 0 == subprocess.call([utils.CheckedInSdkExecutable(), if 0 == RunCommand([utils.CheckedInSdkExecutable(),
options.pub_snapshot, options.pub_snapshot,
'--version'], '--version'], always_silent=True):
stdout=silent_sink, return True
stderr=silent_sink): except OSError as e:
return True pass
except OSError as e: options.pub_snapshot = None
pass
options.pub_snapshot = None
# We need a dart executable. # We need a dart executable.
return (options.dart_executable is not None) return (options.dart_executable is not None)
def ChangeDirectory(directory): def ChangeDirectory(directory):
os.chdir(directory); os.chdir(directory);
@ -138,23 +147,21 @@ def PubCommand(dart_executable,
pub_snapshot, pub_snapshot,
command, command,
silent): silent):
with open(os.devnull, 'wb') as silent_sink: if pub_executable is not None:
if pub_executable is not None: executable = [pub_executable]
executable = [pub_executable] elif pub_snapshot is not None:
elif pub_snapshot is not None: executable = [utils.CheckedInSdkExecutable(), pub_snapshot]
executable = [utils.CheckedInSdkExecutable(), pub_snapshot] else:
else:
DisplayBootstrapWarning()
executable = [dart_executable, PUB_PATH]
# Prevent the bootstrap Dart executable from running in regular
# development flow.
# REMOVE THE FOLLOWING LINE TO USE the dart_bootstrap binary.
# return False
if not silent: if not silent:
print >> sys.stderr, ('Running command "%s"') % (executable + command) DisplayBootstrapWarning()
return subprocess.call(executable + command, executable = [dart_executable, PUB_PATH]
stdout=silent_sink if silent else None, # Prevent the bootstrap Dart executable from running in regular
stderr=silent_sink if silent else None) # development flow.
# REMOVE THE FOLLOWING LINE TO USE the dart_bootstrap binary.
# return False
if not silent:
print >> sys.stderr, ('Running command "%s"') % (executable + command)
return RunCommand(executable + command)
def Deploy(input_dir, output_dir): def Deploy(input_dir, output_dir):
shutil.rmtree(output_dir) shutil.rmtree(output_dir)