blob: 668513841d49d4aef76d9e4eae59a36ddca130c6 [file] [log] [blame]
Yang Guo4fd355c2019-09-19 10:59:03 +02001# 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"""
5Update manually maintained dependencies from Chromium.
6"""
7
8import argparse
9import os
10import shutil
Yang Guofa871b62019-10-24 16:04:46 +020011import subprocess
Yang Guo4fd355c2019-09-19 10:59:03 +020012import sys
13
14FILES = [
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'],
Yang Guodb38f982019-11-26 09:37:00 +000018 ['third_party', 'blink', 'renderer', 'core', 'inspector', 'browser_protocol.pdl'],
Yang Guo4fd355c2019-09-19 10:59:03 +020019 ['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
26def 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 Guofa871b62019-10-24 16:04:46 +020032def 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 Guo4fd355c2019-09-19 10:59:03 +020036
37def 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
42if __name__ == '__main__':
43 OPTIONS = parse_options(sys.argv[1:])
Yang Guofa871b62019-10-24 16:04:46 +020044 update(OPTIONS)
Yang Guo4fd355c2019-09-19 10:59:03 +020045 copy_files(OPTIONS)