# Copyright (c) 2017 The WebRTC project authors. All Rights Reserved. # # Use of this source code is governed by a BSD-style license # that can be found in the LICENSE file in the root of the source # tree. An additional intellectual property rights grant can be found # in the file PATENTS. All contributing project authors may # be found in the AUTHORS file in the root of the source tree. """Script for building and testing WebRTC AAR."""
import argparse import logging import os import re import shutil import subprocess import sys import tempfile
def _parse_args():
parser = argparse.ArgumentParser(description='Releases WebRTC on Bintray.')
parser.add_argument('--use-remoteexec',
action='store_true',
default=False,
help='Use RBE.')
parser.add_argument('--skip-tests',
action='store_true',
default=False,
help='Skips running the tests.')
parser.add_argument( '--build-dir',
default=None,
help='Temporary directory to store the build files. If not specified, ' 'a new directory will be created.')
parser.add_argument('--verbose',
action='store_true',
default=False,
help='Debug logging.') return parser.parse_args()
def _get_commit_pos():
commit_message = subprocess.check_output(
['git', 'rev-list', '--format=%B', '--max-count=1', 'HEAD'],
cwd=CHECKOUT_ROOT).decode('UTF-8')
commit_pos_match = re.search(COMMIT_POSITION_REGEX, commit_message,
re.MULTILINE) ifnot commit_pos_match: raise Exception('Commit position not found in the commit message: %s' %
commit_message) return commit_pos_match.group(1)
def _test_aar(build_dir): """Runs AppRTCMobile tests using AAR. Returns true if the tests pass."""
logging.info('Testing library.')
# Uninstall any existing version of AppRTCMobile.
logging.info('Uninstalling previous AppRTCMobile versions. It is okay for ' 'these commands to fail if AppRTCMobile is not installed.')
subprocess.call([ADB_BIN, 'uninstall', 'org.appspot.apprtc'])
subprocess.call([ADB_BIN, 'uninstall', 'org.appspot.apprtc.test'])
# Run tests. try: # First clean the project.
subprocess.check_call([GRADLEW_BIN, 'clean'], cwd=AAR_PROJECT_DIR) # Then run the tests.
subprocess.check_call([
GRADLEW_BIN, 'connectedDebugAndroidTest', '-PaarDir=' + os.path.abspath(build_dir)
],
cwd=AAR_PROJECT_DIR) except subprocess.CalledProcessError:
logging.exception('Test failure.') returnFalse# Clean or tests failed
returnTrue# Tests pass
def build_and_test_aar(use_remoteexec, skip_tests, build_dir):
version = '1.0.' + _get_commit_pos()
commit = _get_commit_hash()
logging.info('Building and Testing AAR version %s with hash %s', version,
commit)
# If build directory is not specified, create a temporary directory.
use_tmp_dir = not build_dir if use_tmp_dir:
build_dir = tempfile.mkdtemp()
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.