Chromium Code Reviews| Index: components/cronet/tools/generate_javadoc.py |
| diff --git a/components/cronet/tools/generate_javadoc.py b/components/cronet/tools/generate_javadoc.py |
| index d46ed6791e1726715df8889f14c409ce4ade1554..d4b14cc6ceba93e51508d0721cee26f077f0dd30 100755 |
| --- a/components/cronet/tools/generate_javadoc.py |
| +++ b/components/cronet/tools/generate_javadoc.py |
| @@ -30,7 +30,7 @@ class CronetExtension(Extension): |
| CronetPostprocessor(md), '_end') |
| -def GenerateJavadoc(options): |
| +def GenerateJavadoc(options, src_dir): |
| output_dir = os.path.abspath(os.path.join(options.output_dir, 'javadoc')) |
| working_dir = os.path.join(options.input_dir, 'android/api') |
| overview_file = os.path.abspath(options.overview_file) |
| @@ -38,7 +38,7 @@ def GenerateJavadoc(options): |
| build_utils.DeleteDirectory(output_dir) |
| build_utils.MakeDirectory(output_dir) |
| - javadoc_cmd = ['ant', '-Dsource.dir=src', '-Ddoc.dir=' + output_dir, |
| + javadoc_cmd = ['ant', '-Dsource.dir=' + src_dir , '-Ddoc.dir=' + output_dir, |
| '-Dlib.java.dir=' + lib_java_dir, '-Doverview=' + overview_file, |
| 'doc'] |
| stdout = build_utils.CheckOutput(javadoc_cmd, cwd=working_dir) |
| @@ -52,16 +52,27 @@ def main(): |
| build_utils.AddDepfileOption(parser) |
| parser.add_option('--output-dir', help='Directory to put javadoc') |
| parser.add_option('--input-dir', help='Root of cronet source') |
| + parser.add_option('--input-jar', help='Cronet api source jar') |
|
kapishnikov
2016/08/12 15:33:39
Should we rename the option to "--input-src-jar"?
mef
2016/08/12 16:00:05
Are input-dir and input-jar mutuall exclusive?
xunjieli
2016/08/12 17:52:58
Done.
xunjieli
2016/08/12 17:52:58
Yes, they currently not the same. The input-dir is
|
| parser.add_option('--overview-file', help='Path of the overview page') |
| parser.add_option('--readme-file', help='Path of the README.md') |
| parser.add_option('--lib-java-dir', help='Directory containing java libs') |
| options, _ = parser.parse_args() |
| + # A temporary directory to put the output of cronet api source jar files. |
| + unzipped_jar_path = os.path.abspath(os.path.join(options.output_dir, 'tmp')) |
|
mef
2016/08/12 16:00:05
maybe use tempfile.mkdtemp for temp directory?
xunjieli
2016/08/12 17:52:58
Done. Great idea!
|
| + build_utils.MakeDirectory(unzipped_jar_path) |
|
kapishnikov
2016/08/12 15:33:39
Should we make sure that 'unzipped_jar_path' direc
xunjieli
2016/08/12 17:52:58
Acknowledged. I adopted Misha's suggestion to use
|
| + if os.path.exists(options.input_jar): |
| + # Need to execute the jar command inside the temporary directory, and that |
| + # is why the ../../ is needed. |
| + jar_cmd = ['jar', 'xf', '../../' + options.input_jar] |
| + build_utils.CheckOutput(jar_cmd, cwd=unzipped_jar_path) |
| + else: |
| + raise Exception('Jar file does not exist: %s' % options.input_jar) |
| net_docs.ProcessDocs([options.readme_file], options.input_dir, |
| options.output_dir, extensions=[CronetExtension()]) |
| - GenerateJavadoc(options) |
| + GenerateJavadoc(options, unzipped_jar_path) |
| if options.depfile: |
| input_paths = [] |
| @@ -69,6 +80,8 @@ def main(): |
| input_paths.extend(os.path.join(root, f) for f in filenames) |
| build_utils.WriteDepfile(options.depfile, |
| input_paths + build_utils.GetPythonDependencies()) |
| + # Clean up temporary output directory. |
| + build_utils.DeleteDirectory(unzipped_jar_path) |
| if __name__ == '__main__': |
| sys.exit(main()) |