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
5 # found in the LICENSE file.
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 sys
.path
.append(os
.path
.join(REPOSITORY_ROOT
, 'net/tools/net_docs'))
19 from markdown
.postprocessors
import Postprocessor
20 from markdown
.extensions
import Extension
23 class CronetPostprocessor(Postprocessor
):
25 return text
.replace('@Override', '@Override')
28 class CronetExtension(Extension
):
29 def extendMarkdown(self
, md
, md_globals
):
30 md
.postprocessors
.add('CronetPostprocessor',
31 CronetPostprocessor(md
), '_end')
34 def GenerateJavadoc(options
):
35 output_dir
= os
.path
.abspath(os
.path
.join(options
.output_dir
, 'javadoc'))
36 working_dir
= os
.path
.join(options
.input_dir
, 'android/java')
37 overview_file
= os
.path
.abspath(options
.overview_file
)
39 build_utils
.DeleteDirectory(output_dir
)
40 build_utils
.MakeDirectory(output_dir
)
41 javadoc_cmd
= ['ant', '-Dsource.dir=src', '-Ddoc.dir=' + output_dir
,
42 '-Doverview=' + overview_file
, 'doc']
43 build_utils
.CheckOutput(javadoc_cmd
, cwd
=working_dir
)
47 parser
= optparse
.OptionParser()
48 parser
.add_option('--output-dir', help='Directory to put javadoc')
49 parser
.add_option('--input-dir', help='Root of cronet source')
50 parser
.add_option('--overview-file', help='Path of the overview page')
51 parser
.add_option('--readme-file', help='Path of the README.md')
53 options
, _
= parser
.parse_args()
55 net_docs
.ProcessDocs([options
.readme_file
], options
.input_dir
,
56 options
.output_dir
, extensions
=[CronetExtension()])
58 GenerateJavadoc(options
)
60 if __name__
== '__main__':