Ian Zerny | dcb172e | 2022-02-22 15:36:45 +0100 | [diff] [blame] | 1 | #!/usr/bin/env python3 |
Søren Gjesse | 3330db2 | 2017-09-13 13:53:11 +0200 | [diff] [blame] | 2 | # Copyright (c) 2017, the R8 project authors. Please see the AUTHORS file |
| 3 | # for details. All rights reserved. Use of this source code is governed by a |
| 4 | # BSD-style license that can be found in the LICENSE file. |
| 5 | |
Søren Gjesse | 3330db2 | 2017-09-13 13:53:11 +0200 | [diff] [blame] | 6 | from os.path import join |
| 7 | from subprocess import check_call |
| 8 | |
| 9 | import os |
| 10 | |
| 11 | import utils |
| 12 | |
| 13 | AOSP_HELPER_SH = join(utils.REPO_ROOT, 'scripts', 'aosp_helper.sh') |
| 14 | |
| 15 | DEFAULT_LUNCH = 'aosp_x86-eng' |
| 16 | |
| 17 | DEFAULT_ROOT = join(utils.REPO_ROOT, 'build', 'aosp') |
| 18 | |
Christoffer Quist Adamsen | 2434a4d | 2023-10-16 11:29:03 +0200 | [diff] [blame] | 19 | |
Søren Gjesse | 9bfed01 | 2017-09-15 08:15:44 +0200 | [diff] [blame] | 20 | def add_root_argument(parser): |
Christoffer Quist Adamsen | 2434a4d | 2023-10-16 11:29:03 +0200 | [diff] [blame] | 21 | parser.add_argument('--aosp-root', |
| 22 | help='Root of the AOSP checkout. ' + 'Defaults to ' + |
| 23 | DEFAULT_ROOT + '.', |
| 24 | default=DEFAULT_ROOT) |
| 25 | |
Søren Gjesse | 9bfed01 | 2017-09-15 08:15:44 +0200 | [diff] [blame] | 26 | |
| 27 | def add_common_arguments(parser): |
Christoffer Quist Adamsen | 2434a4d | 2023-10-16 11:29:03 +0200 | [diff] [blame] | 28 | add_root_argument(parser) |
| 29 | parser.add_argument('--lunch', |
| 30 | help='Build menu. ' + 'Defaults to ' + DEFAULT_LUNCH + |
| 31 | '.', |
| 32 | default=DEFAULT_LUNCH) |
| 33 | |
Søren Gjesse | 3330db2 | 2017-09-13 13:53:11 +0200 | [diff] [blame] | 34 | |
| 35 | def run_through_aosp_helper(lunch, args, cwd): |
Christoffer Quist Adamsen | 2434a4d | 2023-10-16 11:29:03 +0200 | [diff] [blame] | 36 | args[0:0] = [AOSP_HELPER_SH, lunch] |
| 37 | check_call(args, cwd=cwd) |