Exemple #1
0
def SetUpTools(android_device, temp_dir, processes):
    # Extract AppRTC.
    apprtc_archive = os.path.join(RTC_TOOLS_DIR, 'prebuilt_apprtc.zip')
    golang_archive = os.path.join(RTC_TOOLS_DIR, 'golang', 'linux',
                                  'go.tar.gz')

    utils.UnpackArchiveTo(apprtc_archive, temp_dir)
    utils.UnpackArchiveTo(golang_archive, temp_dir)

    # Build AppRTC.
    build_apprtc_script = os.path.join(RTC_TOOLS_DIR, 'build_apprtc.py')
    apprtc_src_dir = os.path.join(temp_dir, 'apprtc', 'src')
    go_dir = os.path.join(temp_dir, 'go')
    collider_dir = os.path.join(temp_dir, 'collider')

    _RunCommand([
        sys.executable, build_apprtc_script, apprtc_src_dir, go_dir,
        collider_dir
    ])

    # Start AppRTC Server.
    dev_appserver = os.path.join(temp_dir, 'apprtc', 'temp',
                                 'google-cloud-sdk', 'bin', 'dev_appserver.py')
    appengine_dir = os.path.join(temp_dir, 'apprtc', 'out', 'app_engine')
    processes.append(
        _RunBackgroundCommand([
            sys.executable, dev_appserver, appengine_dir, '--port=9999',
            '--admin_port=9998', '--skip_sdk_update_check',
            '--clear_datastore=yes'
        ]))

    # Start Collider.
    collider_path = os.path.join(temp_dir, 'collider', 'collidermain')
    processes.append(
        _RunBackgroundCommand([
            collider_path, '-tls=false', '-port=8089',
            '-room-server=http://localhost:9999'
        ]))

    # Start adb reverse forwarder.
    reverseforwarder_path = os.path.join(SRC_DIR, 'build', 'android',
                                         'adb_reverse_forwarder.py')
    processes.append(
        _RunBackgroundCommand([
            reverseforwarder_path, '--device', android_device, '9999', '9999',
            '8089', '8089'
        ]))
Exemple #2
0
def main(argv):
    if len(argv) > 2:
        return 'Usage: %s [output_dir]' % argv[0]

    output_dir = os.path.abspath(argv[1]) if len(argv) > 1 else None

    apprtc_zip_path = os.path.join(SCRIPT_DIR, 'prebuilt_apprtc.zip')
    if os.path.isfile(apprtc_zip_path + '.sha1'):
        utils.DownloadFilesFromGoogleStorage(SCRIPT_DIR, auto_platform=False)

    if output_dir is not None:
        utils.RemoveDirectory(os.path.join(output_dir, 'apprtc'))
        utils.UnpackArchiveTo(apprtc_zip_path, output_dir)

    golang_path = os.path.join(SCRIPT_DIR, 'golang')
    golang_zip_path = os.path.join(golang_path, _GetGoArchivePathForPlatform())
    if os.path.isfile(golang_zip_path + '.sha1'):
        utils.DownloadFilesFromGoogleStorage(golang_path)

    if output_dir is not None:
        utils.RemoveDirectory(os.path.join(output_dir, 'go'))
        utils.UnpackArchiveTo(golang_zip_path, output_dir)
def main(argv):
  if len(argv) == 1:
    return 'Usage: %s <output_dir>' % argv[0]

  output_dir = os.path.join(argv[1])
  golang_path = os.path.join(SCRIPT_DIR, 'golang')
  archive_path = os.path.join(golang_path, _GetGoArchivePathForPlatform())
  old_archive_sha1 = utils.ComputeSHA1(archive_path)

  utils.DownloadFilesFromGoogleStorage(golang_path)

  if (old_archive_sha1 != utils.ComputeSHA1(archive_path)
      or not os.path.exists('go')):
    utils.RemoveDirectory(os.path.join(output_dir, 'go'))
    utils.UnpackArchiveTo(archive_path, output_dir)