Esempio n. 1
0
def main():
  logging.basicConfig()

  parser = argparse.ArgumentParser(usage=USAGE)

  debug_group = parser.add_mutually_exclusive_group()
  debug_group.add_argument('--debug', help='Debug build (default)',
                           default=True, action='store_true')
  debug_group.add_argument('--release', help='Release build', default=False,
                           dest='debug', action='store_false')
  parser.add_argument('--target-cpu', help='CPU architecture to run for.',
                      choices=['x64', 'x86', 'arm'], default='arm')
  parser.add_argument('--device', help='Serial number of the target device.')
  parser.add_argument('--gdb', help='Run gdb',
                      default=False, action='store_true')
  runner_args, args = parser.parse_known_args()

  config = Config(target_os=Config.OS_ANDROID,
                  target_cpu=runner_args.target_cpu,
                  is_debug=runner_args.debug,
                  apk_name="Mandoline.apk")
  shell = AndroidShell(config)
  shell.InitShell(None, runner_args.device)
  p = shell.ShowLogs()
  shell.StartActivity('MandolineActivity',
                      args,
                      sys.stdout,
                      p.terminate,
                      runner_args.gdb)
  return 0
Esempio n. 2
0
def main():
  logging.basicConfig()

  parser = argparse.ArgumentParser(usage=USAGE)

  debug_group = parser.add_mutually_exclusive_group()
  debug_group.add_argument('--debug', help='Debug build (default)',
                           default=True, action='store_true')
  debug_group.add_argument('--release', help='Release build', default=False,
                           dest='debug', action='store_false')
  parser.add_argument('--target-cpu', help='CPU architecture to run for.',
                      choices=['x64', 'x86', 'arm'])
  parser.add_argument('--origin', help='Origin for mojo: URLs.',
                      default='localhost')
  parser.add_argument('--target-device', help='Device to run on.')
  launcher_args, args = parser.parse_known_args()

  config = Config(target_os=Config.OS_ANDROID,
                  target_cpu=launcher_args.target_cpu,
                  is_debug=launcher_args.debug,
                  apk_name="MojoRunner.apk")
  paths = Paths(config)
  shell = AndroidShell(paths.target_mojo_shell_path, paths.build_dir,
                       paths.adb_path, launcher_args.target_device)

  extra_shell_args = shell.PrepareShellRun(launcher_args.origin)
  args.extend(extra_shell_args)

  shell.CleanLogs()
  p = shell.ShowLogs()
  shell.StartShell(args, sys.stdout, p.terminate)
  return 0
Esempio n. 3
0
def main():
    logging.basicConfig()

    parser = argparse.ArgumentParser(usage=USAGE)

    debug_group = parser.add_mutually_exclusive_group()
    debug_group.add_argument('--debug',
                             help='Debug build (default)',
                             default=True,
                             action='store_true')
    debug_group.add_argument('--release',
                             help='Release build',
                             default=False,
                             dest='debug',
                             action='store_false')
    parser.add_argument('--build-dir', help='Build directory')
    parser.add_argument('--target-cpu',
                        help='CPU architecture to run for.',
                        choices=['x64', 'x86', 'arm'],
                        default='arm')
    parser.add_argument('--device', help='Serial number of the target device.')
    parser.add_argument('--gdb',
                        help='Run gdb',
                        default=False,
                        action='store_true')
    runner_args, args = parser.parse_known_args()

    config = Config(build_dir=runner_args.build_dir,
                    target_os=Config.OS_ANDROID,
                    target_cpu=runner_args.target_cpu,
                    is_debug=runner_args.debug,
                    apk_name='Mandoline.apk')
    shell = AndroidShell(config)
    shell.InitShell(runner_args.device)
    p = shell.ShowLogs()

    temp_gdb_dir = None
    if runner_args.gdb:
        temp_gdb_dir = tempfile.mkdtemp()
        atexit.register(shutil.rmtree, temp_gdb_dir, True)
        _CreateSOLinks(temp_gdb_dir)

    shell.StartActivity('MandolineActivity', args, sys.stdout, p.terminate,
                        temp_gdb_dir)
    return 0
Esempio n. 4
0
def main():
    logging.basicConfig()

    parser = argparse.ArgumentParser(usage=USAGE)

    debug_group = parser.add_mutually_exclusive_group()
    debug_group.add_argument('--debug',
                             help='Debug build (default)',
                             default=True,
                             action='store_true')
    debug_group.add_argument('--release',
                             help='Release build',
                             default=False,
                             dest='debug',
                             action='store_false')
    parser.add_argument('--target-cpu',
                        help='CPU architecture to run for.',
                        choices=['x64', 'x86', 'arm'],
                        default='arm')
    parser.add_argument('--device', help='Serial number of the target device.')
    parser.add_argument('--verbose', default=False, action='store_true')
    parser.add_argument('--apk',
                        help='Name of the APK to run.',
                        default='MojoRunner.apk')
    runner_args, args = parser.parse_known_args()

    logger = logging.getLogger()
    logging.basicConfig(stream=sys.stdout, format='%(levelname)s:%(message)s')
    logger.setLevel(logging.DEBUG if runner_args.verbose else logging.WARNING)
    logger.debug('Initialized logging: level=%s' % logger.level)

    config = Config(target_os=Config.OS_ANDROID,
                    target_cpu=runner_args.target_cpu,
                    is_debug=runner_args.debug,
                    is_verbose=runner_args.verbose,
                    apk_name=runner_args.apk)
    shell = AndroidShell(config)
    shell.InitShell(runner_args.device)
    p = shell.ShowLogs()
    shell.StartActivity('MojoShellActivity', args, sys.stdout, p.terminate)
    return 0