| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # | 2 # |
| 3 # Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 3 # Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 4 # for details. All rights reserved. Use of this source code is governed by a | 4 # for details. All rights reserved. Use of this source code is governed by a |
| 5 # BSD-style license that can be found in the LICENSE file. | 5 # BSD-style license that can be found in the LICENSE file. |
| 6 | 6 |
| 7 # Run this script to generate documentation for a directory and serve | 7 # Run this script to generate documentation for a directory and serve |
| 8 # the results to localhost for viewing in the browser. | 8 # the results to localhost for viewing in the browser. |
| 9 | 9 |
| 10 import optparse | 10 import optparse |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 | 80 |
| 81 def GenerateAllDocs(docgen_options): | 81 def GenerateAllDocs(docgen_options): |
| 82 '''Generate all documentation for the SDK and all packages in the repository. | 82 '''Generate all documentation for the SDK and all packages in the repository. |
| 83 We first attempt to run the quickest path to generate all docs, but if that | 83 We first attempt to run the quickest path to generate all docs, but if that |
| 84 fails, we fall back on a slower option.''' | 84 fails, we fall back on a slower option.''' |
| 85 # TODO(alanknight): The --append option doesn't work properly. It overwrites | 85 # TODO(alanknight): The --append option doesn't work properly. It overwrites |
| 86 # existing files with new information. Known symptom is that it loses subclasses | 86 # existing files with new information. Known symptom is that it loses subclasses |
| 87 # from the SDK and includes only the ones from pkg. So right now our only option | 87 # from the SDK and includes only the ones from pkg. So right now our only option |
| 88 # is to do everything in one pass. | 88 # is to do everything in one pass. |
| 89 doc_dir = join(DART_DIR, 'pkg') | 89 doc_dir = join(DART_DIR, 'pkg') |
| 90 cmd_lst = [DART_EXECUTABLE, '--old_gen_heap_size=1024', | 90 cmd_lst = [DART_EXECUTABLE, |
| 91 '--package-root=%s' % PACKAGE_ROOT, 'docgen.dart', '--include-sdk' ] | 91 '--package-root=%s' % PACKAGE_ROOT, 'docgen.dart', '--include-sdk' ] |
| 92 cmd_str = ' '.join(AddUserDocgenOptions(cmd_lst, docgen_options, True)) | 92 cmd_str = ' '.join(AddUserDocgenOptions(cmd_lst, docgen_options, True)) |
| 93 # Try to run all pkg docs together at once as it's fastest. | 93 # Try to run all pkg docs together at once as it's fastest. |
| 94 (return_code, _) = ExecuteCommandString('%s %s' % (cmd_str, doc_dir)) | 94 (return_code, _) = ExecuteCommandString('%s %s' % (cmd_str, doc_dir)) |
| 95 if return_code != 0: | 95 if return_code != 0: |
| 96 # We failed to run all the pkg docs, so try to generate docs for each pkg | 96 # We failed to run all the pkg docs, so try to generate docs for each pkg |
| 97 # individually. | 97 # individually. |
| 98 failed_pkgs = [] | 98 failed_pkgs = [] |
| 99 for directory in os.listdir(join(DART_DIR, 'pkg')): | 99 for directory in os.listdir(join(DART_DIR, 'pkg')): |
| 100 doc_dir = join(DART_DIR, 'pkg', directory) | 100 doc_dir = join(DART_DIR, 'pkg', directory) |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 print ( | 156 print ( |
| 157 "\nPoint your browser to the address of the 'default' server below.") | 157 "\nPoint your browser to the address of the 'default' server below.") |
| 158 raw_input("Press <RETURN> to terminate the server.\n\n") | 158 raw_input("Press <RETURN> to terminate the server.\n\n") |
| 159 server.terminate() | 159 server.terminate() |
| 160 finally: | 160 finally: |
| 161 os.chdir(cwd) | 161 os.chdir(cwd) |
| 162 subprocess.call(['rm', '-rf', 'dartdoc-viewer']) | 162 subprocess.call(['rm', '-rf', 'dartdoc-viewer']) |
| 163 | 163 |
| 164 if __name__ == '__main__': | 164 if __name__ == '__main__': |
| 165 main() | 165 main() |
| OLD | NEW |