mirror of
https://github.com/mollyim/webrtc.git
synced 2025-05-13 13:50:40 +01:00
Update scripts to use DEPS-pinned depot_tools
Always use gn.py in depot_tools instead of just gn. The https://cs.chromium.org/chromium/src/build/find_depot_tools.py is looking up the DEPS-pinned copy in third_party/depot_tools and adds it to the path when add_depot_tools_to_path() is called. Similar use: https: //cs.chromium.org/search/?q=%22find_depot_tools.add_depot_tools_to_path()%22&sq=package:chromium&type=cs Bug: webrtc:8393 Change-Id: I3cfa3d96b4d0f60e8099e556876bc94340b1bbb5 Reviewed-on: https://webrtc-review.googlesource.com/12540 Reviewed-by: Kári Helgason <kthelgason@webrtc.org> Reviewed-by: Patrik Höglund <phoglund@google.com> Commit-Queue: Henrik Kjellander <kjellander@webrtc.org> Cr-Commit-Position: refs/heads/master@{#20333}
This commit is contained in:
parent
033ea5f771
commit
ec57e05410
9 changed files with 97 additions and 21 deletions
|
@ -60,10 +60,15 @@ def main():
|
|||
project_dir = os.path.abspath(project_dir)
|
||||
|
||||
try:
|
||||
env = os.environ.copy()
|
||||
env['PATH'] = os.pathsep.join([
|
||||
os.path.join(SRC_DIR, 'third_party', 'depot_tools'), env.get('PATH', '')
|
||||
])
|
||||
_RunCommand([GENERATE_GRADLE_SCRIPT, '--output-directory', output_dir,
|
||||
'--target', '//examples:AppRTCMobile',
|
||||
'--project-dir', project_dir,
|
||||
'--use-gradle-process-resources', '--split-projects', '--canary'])
|
||||
'--use-gradle-process-resources', '--split-projects', '--canary'],
|
||||
env=env)
|
||||
_RunCommand([GRADLEW_BIN, 'assembleDebug'], project_dir)
|
||||
finally:
|
||||
# Do not delete temporary directory if user specified it manually.
|
||||
|
|
|
@ -34,6 +34,8 @@ SRC_DIR = os.path.normpath(os.path.join(SCRIPT_DIR, os.pardir, os.pardir))
|
|||
BAD_DEVICES_JSON = os.path.join(SRC_DIR,
|
||||
os.environ.get('CHROMIUM_OUT_DIR', 'out'),
|
||||
'bad_devices.json')
|
||||
sys.path.append(os.path.join(SRC_DIR, 'build'))
|
||||
import find_depot_tools
|
||||
|
||||
|
||||
class Error(Exception):
|
||||
|
@ -95,8 +97,13 @@ def main():
|
|||
|
||||
if not build_dir_x86:
|
||||
build_dir_x86 = os.path.join(temp_dir, 'LocalBuild')
|
||||
_RunCommand(['gn', 'gen', build_dir_x86])
|
||||
_RunCommand(['ninja', '-C', build_dir_x86, 'frame_analyzer'])
|
||||
|
||||
def DepotToolPath(*args):
|
||||
return os.path.join(find_depot_tools.DEPOT_TOOLS_PATH, *args)
|
||||
|
||||
_RunCommand([sys.executable, DepotToolPath('gn.py'), 'gen', build_dir_x86])
|
||||
_RunCommand([DepotToolPath('ninja'), '-C', build_dir_x86,
|
||||
'frame_analyzer'])
|
||||
|
||||
tools_dir = os.path.join(SRC_DIR, 'tools_webrtc')
|
||||
toolchain_dir = os.path.join(tools_dir, 'video_quality_toolchain')
|
||||
|
|
|
@ -18,6 +18,14 @@ import time
|
|||
import zipfile
|
||||
|
||||
|
||||
SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
|
||||
SRC_DIR = os.path.abspath(os.path.join(SCRIPT_DIR, os.pardir, os.pardir))
|
||||
sys.path.append(os.path.join(SRC_DIR, 'build'))
|
||||
|
||||
|
||||
import find_depot_tools
|
||||
|
||||
|
||||
def RunSubprocessWithRetry(cmd):
|
||||
"""Invokes the subprocess and backs off exponentially on fail."""
|
||||
for i in range(5):
|
||||
|
@ -36,10 +44,14 @@ def RunSubprocessWithRetry(cmd):
|
|||
def DownloadFilesFromGoogleStorage(path, auto_platform=True):
|
||||
print 'Downloading files in %s...' % path
|
||||
|
||||
extension = 'bat' if 'win32' in sys.platform else 'py'
|
||||
cmd = ['download_from_google_storage.%s' % extension,
|
||||
cmd = [
|
||||
sys.executable,
|
||||
os.path.join(find_depot_tools.DEPOT_TOOLS_PATH,
|
||||
'download_from_google_storage.py'),
|
||||
'--bucket=chromium-webrtc-resources',
|
||||
'--directory', path]
|
||||
'--directory',
|
||||
path,
|
||||
]
|
||||
if auto_platform:
|
||||
cmd += ['--auto_platform', '--recursive']
|
||||
subprocess.check_call(cmd)
|
||||
|
|
|
@ -35,6 +35,7 @@ import zipfile
|
|||
|
||||
|
||||
SCRIPT_DIR = os.path.dirname(os.path.realpath(sys.argv[0]))
|
||||
SRC_DIR = os.path.normpath(os.path.join(SCRIPT_DIR, os.pardir, os.pardir))
|
||||
DEFAULT_ARCHS = ['armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64']
|
||||
NEEDED_SO_FILES = ['libjingle_peerconnection_so.so']
|
||||
JAR_FILE = 'lib.java/sdk/android/libwebrtc.jar'
|
||||
|
@ -47,6 +48,10 @@ TARGETS = [
|
|||
sys.path.append(os.path.join(SCRIPT_DIR, '..', 'libs'))
|
||||
from generate_licenses import LicenseBuilder
|
||||
|
||||
sys.path.append(os.path.join(SRC_DIR, 'build'))
|
||||
import find_depot_tools
|
||||
|
||||
|
||||
|
||||
def _ParseArgs():
|
||||
parser = argparse.ArgumentParser(description='libwebrtc.aar generator.')
|
||||
|
@ -66,14 +71,16 @@ def _ParseArgs():
|
|||
|
||||
|
||||
def _RunGN(args):
|
||||
cmd = ['gn']
|
||||
cmd = [sys.executable,
|
||||
os.path.join(find_depot_tools.DEPOT_TOOLS_PATH, 'gn.py')]
|
||||
cmd.extend(args)
|
||||
logging.debug('Running: %r', cmd)
|
||||
subprocess.check_call(cmd)
|
||||
|
||||
|
||||
def _RunNinja(output_directory, args):
|
||||
cmd = ['ninja', '-C', output_directory]
|
||||
cmd = [os.path.join(find_depot_tools.DEPOT_TOOLS_PATH, 'ninja'),
|
||||
'-C', output_directory]
|
||||
cmd.extend(args)
|
||||
logging.debug('Running: %r', cmd)
|
||||
subprocess.check_call(cmd)
|
||||
|
|
|
@ -20,10 +20,11 @@ import sys
|
|||
|
||||
SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
|
||||
SRC_DIR = os.path.abspath(os.path.join(SCRIPT_DIR, os.pardir))
|
||||
DEPOT_TOOLS_DIR = os.path.join(SRC_DIR, 'third_party', 'depot_tools')
|
||||
sys.path.insert(0, DEPOT_TOOLS_DIR)
|
||||
sys.path.append(os.path.join(SRC_DIR, 'build'))
|
||||
|
||||
|
||||
import find_depot_tools
|
||||
find_depot_tools.add_depot_tools_to_path()
|
||||
import gclient_utils
|
||||
import subprocess2
|
||||
|
||||
|
@ -35,7 +36,8 @@ def main(directories):
|
|||
for path in directories:
|
||||
cmd = [
|
||||
sys.executable,
|
||||
os.path.join(DEPOT_TOOLS_DIR, 'download_from_google_storage.py'),
|
||||
os.path.join(find_depot_tools.DEPOT_TOOLS_PATH,
|
||||
'download_from_google_storage.py'),
|
||||
'--directory',
|
||||
'--num_threads=10',
|
||||
'--bucket', 'chrome-webrtc-resources',
|
||||
|
|
|
@ -25,8 +25,11 @@ import sys
|
|||
os.environ['PATH'] = '/usr/libexec' + os.pathsep + os.environ['PATH']
|
||||
|
||||
SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
|
||||
WEBRTC_SRC_DIR = os.path.abspath(os.path.join(SCRIPT_DIR, '..', '..'))
|
||||
SDK_OUTPUT_DIR = os.path.join(WEBRTC_SRC_DIR, 'out_ios_libs')
|
||||
SRC_DIR = os.path.abspath(os.path.join(SCRIPT_DIR, '..', '..'))
|
||||
sys.path.append(os.path.join(SRC_DIR, 'build'))
|
||||
import find_depot_tools
|
||||
|
||||
SDK_OUTPUT_DIR = os.path.join(SRC_DIR, 'out_ios_libs')
|
||||
SDK_LIB_NAME = 'librtc_sdk_objc.a'
|
||||
SDK_FRAMEWORK_NAME = 'WebRTC.framework'
|
||||
|
||||
|
@ -75,7 +78,7 @@ def _ParseArgs():
|
|||
|
||||
def _RunCommand(cmd):
|
||||
logging.debug('Running: %r', cmd)
|
||||
subprocess.check_call(cmd, cwd=WEBRTC_SRC_DIR)
|
||||
subprocess.check_call(cmd, cwd=SRC_DIR)
|
||||
|
||||
|
||||
def _CleanArtifacts(output_dir):
|
||||
|
@ -122,11 +125,22 @@ def BuildWebRTC(output_dir, target_arch, flavor, gn_target_name,
|
|||
args_string = ' '.join(gn_args + extra_gn_args)
|
||||
logging.info('Building WebRTC with args: %s', args_string)
|
||||
|
||||
cmd = ['gn', 'gen', output_dir, '--args=' + args_string]
|
||||
cmd = [
|
||||
sys.executable,
|
||||
os.path.join(find_depot_tools.DEPOT_TOOLS_PATH, 'gn.py'),
|
||||
'gen',
|
||||
output_dir,
|
||||
'--args=' + args_string,
|
||||
]
|
||||
_RunCommand(cmd)
|
||||
logging.info('Building target: %s', gn_target_name)
|
||||
|
||||
cmd = ['ninja', '-C', output_dir, gn_target_name]
|
||||
cmd = [
|
||||
os.path.join(find_depot_tools.DEPOT_TOOLS_PATH, 'ninja'),
|
||||
'-C',
|
||||
output_dir,
|
||||
gn_target_name,
|
||||
]
|
||||
if use_goma:
|
||||
cmd.extend(['-j', '200'])
|
||||
_RunCommand(cmd)
|
||||
|
|
|
@ -47,6 +47,9 @@ LIB_TO_LICENSES_DICT = {
|
|||
|
||||
SCRIPT_DIR = os.path.dirname(os.path.realpath(sys.argv[0]))
|
||||
CHECKOUT_ROOT = os.path.abspath(os.path.join(SCRIPT_DIR, os.pardir, os.pardir))
|
||||
sys.path.append(os.path.join(CHECKOUT_ROOT, 'build'))
|
||||
import find_depot_tools
|
||||
|
||||
THIRD_PARTY_LIB_REGEX = r'^.*/third_party/([\w+]+).*$'
|
||||
|
||||
class LicenseBuilder(object):
|
||||
|
@ -72,8 +75,15 @@ class LicenseBuilder(object):
|
|||
|
||||
@staticmethod
|
||||
def _RunGN(buildfile_dir, target):
|
||||
cmd = ['gn', 'desc', '--all', '--format=json',
|
||||
os.path.abspath(buildfile_dir), target]
|
||||
cmd = [
|
||||
sys.executable,
|
||||
os.path.join(find_depot_tools.DEPOT_TOOLS_PATH, 'gn.py'),
|
||||
'desc',
|
||||
'--all',
|
||||
'--format=json',
|
||||
os.path.abspath(buildfile_dir),
|
||||
target,
|
||||
]
|
||||
logging.debug("Running: %r", cmd)
|
||||
output_json = subprocess.check_output(cmd, cwd=CHECKOUT_ROOT)
|
||||
logging.debug("Output: %s", output_json)
|
||||
|
|
|
@ -36,6 +36,7 @@ SCRIPT_DIR = os.path.dirname(os.path.realpath(__file__))
|
|||
SRC_DIR = os.path.dirname(os.path.dirname(SCRIPT_DIR))
|
||||
sys.path = [os.path.join(SRC_DIR, 'build')] + sys.path
|
||||
|
||||
import find_depot_tools
|
||||
import gn_helpers
|
||||
|
||||
|
||||
|
@ -1405,7 +1406,11 @@ class MetaBuildWrapper(object):
|
|||
|
||||
def Build(self, target):
|
||||
build_dir = self.ToSrcRelPath(self.args.path[0])
|
||||
ninja_cmd = ['ninja', '-C', build_dir]
|
||||
ninja_cmd = [
|
||||
os.path.join(find_depot_tools.DEPOT_TOOLS_PATH, 'ninja'),
|
||||
'-C',
|
||||
build_dir,
|
||||
]
|
||||
if self.args.jobs:
|
||||
ninja_cmd.extend(['-j', '%d' % self.args.jobs])
|
||||
ninja_cmd.append(target)
|
||||
|
|
|
@ -6,12 +6,20 @@
|
|||
# in the file PATENTS. All contributing project authors may
|
||||
# be found in the AUTHORS file in the root of the source tree.
|
||||
|
||||
import os
|
||||
import re
|
||||
import shutil
|
||||
import subprocess
|
||||
import sys
|
||||
import tempfile
|
||||
|
||||
|
||||
SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
|
||||
SRC_DIR = os.path.normpath(os.path.join(SCRIPT_DIR, os.pardir, os.pardir))
|
||||
sys.path.append(os.path.join(SRC_DIR, 'build'))
|
||||
import find_depot_tools
|
||||
|
||||
|
||||
# GN_ERROR_RE matches the summary of an error output by `gn check`.
|
||||
# Matches "ERROR" and following lines until it sees an empty line or a line
|
||||
# containing just underscores.
|
||||
|
@ -27,7 +35,13 @@ def RunGnCheck(root_dir=None):
|
|||
"""
|
||||
out_dir = tempfile.mkdtemp('gn')
|
||||
try:
|
||||
command = ['gn', 'gen', '--check', out_dir]
|
||||
command = [
|
||||
sys.executable,
|
||||
os.path.join(find_depot_tools.DEPOT_TOOLS_PATH, 'gn.py'),
|
||||
'gen',
|
||||
'--check',
|
||||
out_dir,
|
||||
]
|
||||
subprocess.check_output(command, cwd=root_dir)
|
||||
except subprocess.CalledProcessError as err:
|
||||
return GN_ERROR_RE.findall(err.output)
|
||||
|
|
Loading…
Reference in a new issue