| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # | 2 # |
| 3 # Copyright 2015 The Chromium Authors. All rights reserved. | 3 # Copyright 2015 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 optparse | 7 import optparse |
| 8 import os | 8 import os |
| 9 import sys | 9 import sys |
| 10 import tempfile | 10 import tempfile |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 | 50 |
| 51 def main(): | 51 def main(): |
| 52 parser = optparse.OptionParser() | 52 parser = optparse.OptionParser() |
| 53 build_utils.AddDepfileOption(parser) | 53 build_utils.AddDepfileOption(parser) |
| 54 parser.add_option('--output-dir', help='Directory to put javadoc') | 54 parser.add_option('--output-dir', help='Directory to put javadoc') |
| 55 parser.add_option('--input-dir', help='Root of cronet source') | 55 parser.add_option('--input-dir', help='Root of cronet source') |
| 56 parser.add_option('--input-src-jar', help='Cronet api source jar') | 56 parser.add_option('--input-src-jar', help='Cronet api source jar') |
| 57 parser.add_option('--overview-file', help='Path of the overview page') | 57 parser.add_option('--overview-file', help='Path of the overview page') |
| 58 parser.add_option('--readme-file', help='Path of the README.md') | 58 parser.add_option('--readme-file', help='Path of the README.md') |
| 59 parser.add_option('--lib-java-dir', help='Directory containing java libs') | 59 parser.add_option('--lib-java-dir', help='Directory containing java libs') |
| 60 parser.add_option('--stamp', help='Path to touch on success.') |
| 60 | 61 |
| 61 options, _ = parser.parse_args() | 62 options, _ = parser.parse_args() |
| 62 # A temporary directory to put the output of cronet api source jar files. | 63 # A temporary directory to put the output of cronet api source jar files. |
| 63 unzipped_jar_path = tempfile.mkdtemp(dir=options.output_dir) | 64 unzipped_jar_path = tempfile.mkdtemp(dir=options.output_dir) |
| 64 if os.path.exists(options.input_src_jar): | 65 if os.path.exists(options.input_src_jar): |
| 65 jar_cmd = ['jar', 'xf', os.path.abspath(options.input_src_jar)] | 66 jar_cmd = ['jar', 'xf', os.path.abspath(options.input_src_jar)] |
| 66 build_utils.CheckOutput(jar_cmd, cwd=unzipped_jar_path) | 67 build_utils.CheckOutput(jar_cmd, cwd=unzipped_jar_path) |
| 67 else: | 68 else: |
| 68 raise Exception('Jar file does not exist: %s' % options.input_src_jar) | 69 raise Exception('Jar file does not exist: %s' % options.input_src_jar) |
| 69 | 70 |
| 70 net_docs.ProcessDocs([options.readme_file], options.input_dir, | 71 net_docs.ProcessDocs([options.readme_file], options.input_dir, |
| 71 options.output_dir, extensions=[CronetExtension()]) | 72 options.output_dir, extensions=[CronetExtension()]) |
| 72 | 73 |
| 73 GenerateJavadoc(options, os.path.abspath(unzipped_jar_path)) | 74 GenerateJavadoc(options, os.path.abspath(unzipped_jar_path)) |
| 74 | 75 |
| 76 if options.stamp: |
| 77 build_utils.Touch(options.stamp) |
| 75 if options.depfile: | 78 if options.depfile: |
| 76 input_paths = [] | 79 assert options.stamp |
| 80 deps = [] |
| 77 for root, _, filenames in os.walk(options.input_dir): | 81 for root, _, filenames in os.walk(options.input_dir): |
| 78 input_paths.extend(os.path.join(root, f) for f in filenames) | 82 deps.extend(os.path.join(root, f) for f in filenames) |
| 79 build_utils.WriteDepfile(options.depfile, | 83 build_utils.WriteDepfile(options.depfile, options.stamp, deps) |
| 80 input_paths + build_utils.GetPythonDependencies()) | |
| 81 # Clean up temporary output directory. | 84 # Clean up temporary output directory. |
| 82 build_utils.DeleteDirectory(unzipped_jar_path) | 85 build_utils.DeleteDirectory(unzipped_jar_path) |
| 83 | 86 |
| 84 if __name__ == '__main__': | 87 if __name__ == '__main__': |
| 85 sys.exit(main()) | 88 sys.exit(main()) |
| OLD | NEW |