xref: /aosp_15_r20/external/webrtc/rtc_tools/testing/setup_apprtc.py (revision d9f758449e529ab9291ac668be2861e7a55c2422)
1#!/usr/bin/env python
2# Copyright (c) 2017 The WebRTC project authors. All Rights Reserved.
3#
4# Use of this source code is governed by a BSD-style license
5# that can be found in the LICENSE file in the root of the source
6# tree. An additional intellectual property rights grant can be found
7# in the file PATENTS.  All contributing project authors may
8# be found in the AUTHORS file in the root of the source tree.
9"""This script sets up AppRTC and its dependencies.
10
11Requires that depot_tools is installed and in the PATH.
12
13It will put the result under <output_dir>/collider.
14"""
15
16import os
17import sys
18
19import utils
20
21SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
22
23
24def main(argv):
25    if len(argv) == 1:
26        return 'Usage %s <output_dir>' % argv[0]
27
28    output_dir = os.path.abspath(argv[1])
29
30    download_apprtc_path = os.path.join(SCRIPT_DIR, 'download_apprtc.py')
31    utils.RunSubprocessWithRetry(
32        [sys.executable, download_apprtc_path, output_dir])
33
34    build_apprtc_path = os.path.join(SCRIPT_DIR, 'build_apprtc.py')
35    apprtc_dir = os.path.join(output_dir, 'apprtc')
36    go_dir = os.path.join(output_dir, 'go')
37    collider_dir = os.path.join(output_dir, 'collider')
38    utils.RunSubprocessWithRetry(
39        [sys.executable, build_apprtc_path, apprtc_dir, go_dir, collider_dir])
40
41
42if __name__ == '__main__':
43    sys.exit(main(sys.argv))
44