Yang Guo | 4fd355c | 2019-09-19 10:59:03 +0200 | [diff] [blame] | 1 | # Copyright 2019 The Chromium Authors. All rights reserved. |
| 2 | # Use of this source code is governed by a BSD-style license that can be |
| 3 | # found in the LICENSE file. |
| 4 | """ |
| 5 | Update manually maintained dependencies from Chromium. |
| 6 | """ |
| 7 | |
| 8 | import argparse |
| 9 | import os |
| 10 | import shutil |
Yang Guo | fa871b6 | 2019-10-24 16:04:46 +0200 | [diff] [blame] | 11 | import subprocess |
Yang Guo | 4fd355c | 2019-09-19 10:59:03 +0200 | [diff] [blame] | 12 | import sys |
| 13 | |
| 14 | FILES = [ |
| 15 | ['v8', 'include', 'js_protocol.pdl'], |
| 16 | ['third_party', 'blink', 'renderer', 'core', 'css', 'css_properties.json5'], |
| 17 | ['third_party', 'blink', 'renderer', 'core', 'html', 'aria_properties.json5'], |
Andrey Kosyakov | fff69a7 | 2019-11-27 01:31:57 +0000 | [diff] [blame^] | 18 | ['third_party', 'blink', 'public', 'devtools_protocol', 'browser_protocol.pdl'], |
Yang Guo | 4fd355c | 2019-09-19 10:59:03 +0200 | [diff] [blame] | 19 | ['third_party', 'axe-core', 'axe.d.ts'], |
| 20 | ['third_party', 'axe-core', 'axe.js'], |
| 21 | ['third_party', 'axe-core', 'axe.min.js'], |
| 22 | ['third_party', 'axe-core', 'LICENSE'], |
| 23 | ] |
| 24 | |
| 25 | |
| 26 | def parse_options(cli_args): |
| 27 | parser = argparse.ArgumentParser(description='Roll dependencies from Chromium.') |
| 28 | parser.add_argument('chromium_dir', help='Chromium directory') |
| 29 | parser.add_argument('devtools_dir', help='DevTools directory') |
| 30 | return parser.parse_args(cli_args) |
| 31 | |
Yang Guo | fa871b6 | 2019-10-24 16:04:46 +0200 | [diff] [blame] | 32 | def update(options): |
| 33 | subprocess.check_call(['git', 'fetch', 'origin'], cwd=options.chromium_dir) |
| 34 | subprocess.check_call(['git', 'checkout', 'origin/master'], cwd=options.chromium_dir) |
| 35 | subprocess.check_call(['gclient', 'sync'], cwd=options.chromium_dir) |
Yang Guo | 4fd355c | 2019-09-19 10:59:03 +0200 | [diff] [blame] | 36 | |
| 37 | def copy_files(options): |
| 38 | for file in FILES: |
| 39 | shutil.copy(os.path.join(options.chromium_dir, *file), os.path.join(options.devtools_dir, *file)) |
| 40 | |
| 41 | |
| 42 | if __name__ == '__main__': |
| 43 | OPTIONS = parse_options(sys.argv[1:]) |
Yang Guo | fa871b6 | 2019-10-24 16:04:46 +0200 | [diff] [blame] | 44 | update(OPTIONS) |
Yang Guo | 4fd355c | 2019-09-19 10:59:03 +0200 | [diff] [blame] | 45 | copy_files(OPTIONS) |