| Index: runtime/tools/create_snapshot_bin.py
|
| diff --git a/runtime/tools/create_snapshot_bin.py b/runtime/tools/create_snapshot_bin.py
|
| index c80df4d39b63560a9b93aafc1d1122cb768e34db..db948a16c8ad7ea76fa8d892ffb19b3ca1714fad 100755
|
| --- a/runtime/tools/create_snapshot_bin.py
|
| +++ b/runtime/tools/create_snapshot_bin.py
|
| @@ -59,83 +59,6 @@ def ProcessOptions(options):
|
| return True
|
|
|
|
|
| -def RunAdb(device, command):
|
| - """Run a raw adb command."""
|
| - return utils.RunCommand(["adb", "-s", device] + command)
|
| -
|
| -
|
| -def RunAdbShell(device, command):
|
| - RunAdb(device, ['shell'] + command)
|
| -
|
| -
|
| -def RunOnAndroid(options):
|
| - outputBin = options.output_bin
|
| -
|
| - android_workspace = os.getenv("ANDROID_DART", "/data/local/dart")
|
| - android_outputBin = join(android_workspace, basename(outputBin))
|
| -
|
| - executable = options.executable
|
| - android_executable = join(android_workspace, basename(executable))
|
| -
|
| - filesToPush = [] # (src, dest)
|
| - filesToPull = [] # (src, dest)
|
| -
|
| - # Setup arguments to the snapshot generator binary.
|
| - script_args = [android_executable]
|
| -
|
| - # First setup the snapshot output filename.
|
| - filesToPull.append((android_outputBin, outputBin))
|
| - script_args.append(''.join([ "--snapshot=", android_outputBin]))
|
| -
|
| - # We don't know what source files are needed to fully satisfy a dart script,
|
| - # so we can't support the general case of url mapping or script inclusion.
|
| - if options.url_mapping:
|
| - raise Exception("--url_mapping is not supported when building for Android")
|
| -
|
| - if options.script:
|
| - raise Exception("--script is not supported when building for Android")
|
| -
|
| - filesToPush.append((executable, android_executable))
|
| -
|
| - abi = options.abi or 'x86'
|
| - # We know we're run in the runtime directory, and we know the relative path
|
| - # to the tools we want to execute:
|
| - command = ["tools/android_finder.py", "--bootstrap", "--abi", abi]
|
| - if VERBOSE:
|
| - command += ['--verbose']
|
| - device = utils.RunCommand(command, errStream=sys.stderr)
|
| -
|
| - if device == None:
|
| - raise Exception("Could not find Android device for abi %s" % abi)
|
| -
|
| - device = device.strip()
|
| -
|
| - if VERBOSE:
|
| - sys.write.stderr('Using Android device %s for abi %s' % (device, abi))
|
| -
|
| - RunAdbShell(device, ["mkdir", android_workspace])
|
| -
|
| - try:
|
| - if VERBOSE:
|
| - sys.write.stderr('pushing files to %s' % device)
|
| - for src, dest in filesToPush:
|
| - RunAdb(device, ["push", src, dest])
|
| - if VERBOSE:
|
| - sys.write.stderr('running snapshot generator')
|
| - RunAdbShell(device, script_args)
|
| - if VERBOSE:
|
| - sys.write.stderr('retrieving snapshot')
|
| - for src, dest in filesToPull:
|
| - RunAdb(device, ["pull", src, dest])
|
| - finally:
|
| - if VERBOSE:
|
| - sys.write.stderr('cleaning intermediate files')
|
| - for src, dest in filesToPush:
|
| - RunAdbShell(device, ["rm", dest])
|
| - for src, dest in filesToPull:
|
| - RunAdbShell(device, ["rm", src])
|
| -
|
| -
|
| def Main():
|
| # Parse options.
|
| parser = BuildOptions()
|
| @@ -165,15 +88,12 @@ def Main():
|
| script_args.append(options.script)
|
|
|
| # Construct command line to execute the snapshot generator binary and invoke.
|
| - if options.target_os == 'android':
|
| - RunOnAndroid(options)
|
| - else:
|
| - command = [ options.executable ] + script_args
|
| - try:
|
| - utils.RunCommand(command, outStream=sys.stderr, errStream=sys.stderr,
|
| - verbose=options.verbose, printErrorInfo=True)
|
| - except Exception as e:
|
| - return -1
|
| + command = [ options.executable ] + script_args
|
| + try:
|
| + utils.RunCommand(command, outStream=sys.stderr, errStream=sys.stderr,
|
| + verbose=options.verbose, printErrorInfo=True)
|
| + except Exception as e:
|
| + return -1
|
|
|
| return 0
|
|
|
|
|