OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # | 2 # |
3 # Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 4 # Use of this source code is governed by a BSD-style license that can be |
5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
6 | 6 |
7 import fnmatch | 7 import fnmatch |
8 import optparse | 8 import optparse |
9 import os | 9 import os |
10 import sys | 10 import sys |
(...skipping 14 matching lines...) Expand all Loading... |
25 if os.path.exists(jar_path): | 25 if os.path.exists(jar_path): |
26 jar_cmd = ['jar', 'uf', jar_path, '.'] | 26 jar_cmd = ['jar', 'uf', jar_path, '.'] |
27 else: | 27 else: |
28 jar_cmd = ['jar', 'cf', jar_path, '.'] | 28 jar_cmd = ['jar', 'cf', jar_path, '.'] |
29 | 29 |
30 build_utils.CheckOutput(jar_cmd, cwd=jar_cwd) | 30 build_utils.CheckOutput(jar_cmd, cwd=jar_cwd) |
31 | 31 |
32 | 32 |
33 def main(): | 33 def main(): |
34 parser = optparse.OptionParser() | 34 parser = optparse.OptionParser() |
| 35 build_utils.AddDepfileOption(parser) |
35 parser.add_option('--src-dir', action="append", | 36 parser.add_option('--src-dir', action="append", |
36 help='Directory containing .java files.') | 37 help='Directory containing .java files.') |
37 parser.add_option('--jar-path', help='Jar output path.') | 38 parser.add_option('--jar-path', help='Jar output path.') |
38 parser.add_option('--stamp', help='Path to touch on success.') | 39 parser.add_option('--stamp', help='Path to touch on success.') |
39 | 40 |
40 options, _ = parser.parse_args() | 41 options, _ = parser.parse_args() |
41 | 42 |
| 43 src_dirs = [] |
42 for src_dir in options.src_dir: | 44 for src_dir in options.src_dir: |
| 45 src_dirs.extend(build_utils.ParseGypList(src_dir)) |
| 46 |
| 47 for src_dir in src_dirs: |
43 JarSources(src_dir, options.jar_path) | 48 JarSources(src_dir, options.jar_path) |
44 | 49 |
| 50 if options.depfile: |
| 51 input_paths = [] |
| 52 for src_dir in src_dirs: |
| 53 for root, _, filenames in os.walk(src_dir): |
| 54 input_paths.extend(os.path.join(root, f) for f in filenames) |
| 55 build_utils.WriteDepfile(options.depfile, |
| 56 input_paths + build_utils.GetPythonDependencies()) |
| 57 |
45 if options.stamp: | 58 if options.stamp: |
46 build_utils.Touch(options.stamp) | 59 build_utils.Touch(options.stamp) |
47 | 60 |
48 | |
49 if __name__ == '__main__': | 61 if __name__ == '__main__': |
50 sys.exit(main()) | 62 sys.exit(main()) |
51 | 63 |
OLD | NEW |