Add estade as OWNER for vector icon files.
[chromium-blink-merge.git] / components / cronet / tools / jar_src.py
blob0cda4a894d8b8f25ebceb36cff9412cf589ad710
1 #!/usr/bin/env python
3 # Copyright 2014 The Chromium Authors. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file.
7 import fnmatch
8 import optparse
9 import os
10 import sys
12 REPOSITORY_ROOT = os.path.abspath(os.path.join(
13 os.path.dirname(__file__), '..', '..', '..'))
15 sys.path.append(os.path.join(REPOSITORY_ROOT, 'build/android/gyp/util'))
16 import build_utils
19 def JarSources(src_dir, jar_path):
20 # The paths of the files in the jar will be the same as they are passed in to
21 # the command. Because of this, the command should be run in
22 # options.src_dir so the .java file paths in the jar are correct.
23 jar_cwd = src_dir
24 jar_path = os.path.abspath(jar_path)
25 if os.path.exists(jar_path):
26 jar_cmd = ['jar', 'uf', jar_path, '.']
27 else:
28 jar_cmd = ['jar', 'cf', jar_path, '.']
30 build_utils.CheckOutput(jar_cmd, cwd=jar_cwd)
33 def main():
34 parser = optparse.OptionParser()
35 parser.add_option('--src-dir', action="append",
36 help='Directory containing .java files.')
37 parser.add_option('--jar-path', help='Jar output path.')
38 parser.add_option('--stamp', help='Path to touch on success.')
40 options, _ = parser.parse_args()
42 for src_dir in options.src_dir:
43 JarSources(src_dir, options.jar_path)
45 if options.stamp:
46 build_utils.Touch(options.stamp)
49 if __name__ == '__main__':
50 sys.exit(main())