Chromium Code Reviews| 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 25 matching lines...) Expand all Loading... | |
| 36 working_dir = os.path.join(options.input_dir, 'android/api') | 36 working_dir = os.path.join(options.input_dir, 'android/api') |
| 37 overview_file = os.path.abspath(options.overview_file) | 37 overview_file = os.path.abspath(options.overview_file) |
| 38 lib_java_dir = os.path.abspath(options.lib_java_dir) | 38 lib_java_dir = os.path.abspath(options.lib_java_dir) |
| 39 | 39 |
| 40 build_utils.DeleteDirectory(output_dir) | 40 build_utils.DeleteDirectory(output_dir) |
| 41 build_utils.MakeDirectory(output_dir) | 41 build_utils.MakeDirectory(output_dir) |
| 42 javadoc_cmd = ['ant', '-Dsource.dir=' + src_dir , '-Ddoc.dir=' + output_dir, | 42 javadoc_cmd = ['ant', '-Dsource.dir=' + src_dir , '-Ddoc.dir=' + output_dir, |
| 43 '-Dlib.java.dir=' + lib_java_dir, '-Doverview=' + overview_file, | 43 '-Dlib.java.dir=' + lib_java_dir, '-Doverview=' + overview_file, |
| 44 'doc'] | 44 'doc'] |
| 45 stdout = build_utils.CheckOutput(javadoc_cmd, cwd=working_dir) | 45 stdout = build_utils.CheckOutput(javadoc_cmd, cwd=working_dir) |
| 46 if " error: " in stdout or "warning" in stdout or "javadoc: error " in stdout: | 46 for line in stdout.splitlines(): |
|
ghost stip (do not use)
2016/10/20 20:52:04
xunjieli: wdyt? I tested it and it definitely rais
xunjieli
2016/10/20 20:58:54
Seems good to me :)
| |
| 47 build_utils.DeleteDirectory(output_dir) | 47 if " error: " in line or "javadoc: error " in line: |
| 48 raise build_utils.CalledProcessError(working_dir, javadoc_cmd, stdout) | 48 build_utils.DeleteDirectory(output_dir) |
| 49 raise build_utils.CalledProcessError(working_dir, javadoc_cmd, stdout) | |
| 50 # TODO(crbug.com/655666): remove compiler suppression warning once fixed. | |
| 51 if ("warning" in line and not line.endswith('warnings') and | |
|
ghost stip (do not use)
2016/10/20 20:52:04
the endswith is because at the end it displays "66
xunjieli
2016/10/20 20:58:55
Acknowledged.
| |
| 52 not "the highest major version" in line): | |
| 53 build_utils.DeleteDirectory(output_dir) | |
|
ghost stip (do not use)
2016/10/20 20:52:04
I felt the if statement was complicated enough tha
xunjieli
2016/10/20 20:58:54
Acknowledged.
| |
| 54 raise build_utils.CalledProcessError(working_dir, javadoc_cmd, stdout) | |
| 49 | 55 |
| 50 | 56 |
| 51 def main(): | 57 def main(): |
| 52 parser = optparse.OptionParser() | 58 parser = optparse.OptionParser() |
| 53 build_utils.AddDepfileOption(parser) | 59 build_utils.AddDepfileOption(parser) |
| 54 parser.add_option('--output-dir', help='Directory to put javadoc') | 60 parser.add_option('--output-dir', help='Directory to put javadoc') |
| 55 parser.add_option('--input-dir', help='Root of cronet source') | 61 parser.add_option('--input-dir', help='Root of cronet source') |
| 56 parser.add_option('--input-src-jar', help='Cronet api source jar') | 62 parser.add_option('--input-src-jar', help='Cronet api source jar') |
| 57 parser.add_option('--overview-file', help='Path of the overview page') | 63 parser.add_option('--overview-file', help='Path of the overview page') |
| 58 parser.add_option('--readme-file', help='Path of the README.md') | 64 parser.add_option('--readme-file', help='Path of the README.md') |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 79 assert options.stamp | 85 assert options.stamp |
| 80 deps = [] | 86 deps = [] |
| 81 for root, _, filenames in os.walk(options.input_dir): | 87 for root, _, filenames in os.walk(options.input_dir): |
| 82 deps.extend(os.path.join(root, f) for f in filenames) | 88 deps.extend(os.path.join(root, f) for f in filenames) |
| 83 build_utils.WriteDepfile(options.depfile, options.stamp, deps) | 89 build_utils.WriteDepfile(options.depfile, options.stamp, deps) |
| 84 # Clean up temporary output directory. | 90 # Clean up temporary output directory. |
| 85 build_utils.DeleteDirectory(unzipped_jar_path) | 91 build_utils.DeleteDirectory(unzipped_jar_path) |
| 86 | 92 |
| 87 if __name__ == '__main__': | 93 if __name__ == '__main__': |
| 88 sys.exit(main()) | 94 sys.exit(main()) |
| OLD | NEW |