xref: /aosp_15_r20/external/cronet/build/fuchsia/test/deploy_to_fuchsia.py (revision 6777b5387eb2ff775bb5750e3f5d96f37fb7352b)
1#!/usr/bin/env vpython3
2# Copyright 2022 The Chromium Authors
3# Use of this source code is governed by a BSD-style license that can be
4# found in the LICENSE file.
5"""A script for deploying Chrome binaries to a Fuchsia checkout."""
6
7import argparse
8import os
9import sys
10
11from common import read_package_paths, register_common_args
12from compatible_utils import install_symbols
13from publish_package import publish_packages
14
15
16def register_fuchsia_args(parser: argparse.ArgumentParser) -> None:
17    """Register common arguments for deploying to Fuchsia."""
18
19    fuchsia_args = parser.add_argument_group(
20        'fuchsia', 'Arguments for working with Fuchsia checkout.')
21    fuchsia_args.add_argument('--fuchsia-out-dir',
22                              help='Path to output directory of a local '
23                              'Fuchsia checkout.')
24
25
26def main():
27    """Stand-alone program for deploying to the output directory of a local
28    Fuchsia checkout."""
29
30    parser = argparse.ArgumentParser()
31    parser.add_argument('package', help='The package to deploy to Fuchsia.')
32    register_common_args(parser)
33    register_fuchsia_args(parser)
34    args = parser.parse_args()
35
36    fuchsia_out_dir = os.path.expanduser(args.fuchsia_out_dir)
37    package_paths = read_package_paths(args.out_dir, args.package)
38    publish_packages(package_paths, os.path.join(fuchsia_out_dir,
39                                                 'amber-files'))
40    install_symbols(package_paths, fuchsia_out_dir)
41
42
43if __name__ == '__main__':
44    sys.exit(main())
45