Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(219)

Side by Side Diff: pkg/docgen/bin/dartdoc.py

Issue 158083002: introduce web_components pkg for consolidated polyfills (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « pkg/custom_element/pubspec.yaml ('k') | pkg/html_import/LICENSE » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
11 import os 11 import os
12 from os.path import join, dirname, abspath, exists 12 from os.path import join, dirname, abspath, exists
13 import platform 13 import platform
14 import subprocess 14 import subprocess
15 import sys 15 import sys
16 sys.path.append(abspath(join(dirname(__file__), '../../../tools'))) 16 sys.path.append(abspath(join(dirname(__file__), '../../../tools')))
17 import utils 17 import utils
18 18
19 DIRECTORY = abspath(dirname(__file__)) 19 DIRECTORY = abspath(dirname(__file__))
20 DART_DIR = dirname(dirname(dirname(DIRECTORY))) 20 DART_DIR = dirname(dirname(dirname(DIRECTORY)))
21 DART_EXECUTABLE = join(DART_DIR, 21 DART_EXECUTABLE = join(DART_DIR,
22 '%s/%s/dart-sdk/bin/dart' % (utils.BUILD_ROOT[utils.GuessOS()], 22 '%s/%s/dart-sdk/bin/dart' % (utils.BUILD_ROOT[utils.GuessOS()],
23 utils.GetBuildConf('release', utils.GuessArchitecture()))) 23 utils.GetBuildConf('release', utils.GuessArchitecture())))
24 PUB = join(DART_DIR, 'sdk/bin/pub') 24 PUB = join(DART_DIR, 'sdk/bin/pub')
25 DART2JS = join(DART_DIR, 'sdk/bin/dart2js') 25 DART2JS = join(DART_DIR, 'sdk/bin/dart2js')
26 PACKAGE_ROOT = join(dirname(dirname(dirname(DART_EXECUTABLE[:-(len('dart'))]))), 26 PACKAGE_ROOT = join(dirname(dirname(dirname(DART_EXECUTABLE[:-(len('dart'))]))),
27 'packages/') 27 'packages/')
28 EXCLUDED_PACKAGES = ['browser', 'html_import', 'mutation_observer', 28 EXCLUDED_PACKAGES = ['browser', 'mutation_observer', 'pkg.xcodeproj']
29 'pkg.xcodeproj', 'shadow_dom']
30 APPSERVER_EXECUTABLE = 'dev_appserver.py' 29 APPSERVER_EXECUTABLE = 'dev_appserver.py'
31 30
32 31
33 def SetPackageRoot(path): 32 def SetPackageRoot(path):
34 global PACKAGE_ROOT 33 global PACKAGE_ROOT
35 if exists(path): 34 if exists(path):
36 PACKAGE_ROOT = abspath(path) 35 PACKAGE_ROOT = abspath(path)
37 36
38 37
39 def ParseArgs(): 38 def ParseArgs():
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 79
81 def GenerateAllDocs(docgen_options): 80 def GenerateAllDocs(docgen_options):
82 '''Generate all documentation for the SDK and all packages in the repository. 81 '''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 82 We first attempt to run the quickest path to generate all docs, but if that
84 fails, we fall back on a slower option.''' 83 fails, we fall back on a slower option.'''
85 # TODO(alanknight): The --append option doesn't work properly. It overwrites 84 # TODO(alanknight): The --append option doesn't work properly. It overwrites
86 # existing files with new information. Known symptom is that it loses subclasses 85 # 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 86 # from the SDK and includes only the ones from pkg. So right now our only option
88 # is to do everything in one pass. 87 # is to do everything in one pass.
89 doc_dir = join(DART_DIR, 'pkg') 88 doc_dir = join(DART_DIR, 'pkg')
90 cmd_lst = [DART_EXECUTABLE, 89 cmd_lst = [DART_EXECUTABLE,
91 '--package-root=%s' % PACKAGE_ROOT, 'docgen.dart', '--include-sdk' ] 90 '--package-root=%s' % PACKAGE_ROOT, 'docgen.dart', '--include-sdk' ]
92 cmd_str = ' '.join(AddUserDocgenOptions(cmd_lst, docgen_options, True)) 91 cmd_str = ' '.join(AddUserDocgenOptions(cmd_lst, docgen_options, True))
93 # Try to run all pkg docs together at once as it's fastest. 92 # Try to run all pkg docs together at once as it's fastest.
94 (return_code, _) = ExecuteCommandString('%s %s' % (cmd_str, doc_dir)) 93 (return_code, _) = ExecuteCommandString('%s %s' % (cmd_str, doc_dir))
95 if return_code != 0: 94 if return_code != 0:
96 # We failed to run all the pkg docs, so try to generate docs for each pkg 95 # We failed to run all the pkg docs, so try to generate docs for each pkg
97 # individually. 96 # individually.
98 failed_pkgs = [] 97 failed_pkgs = []
99 for directory in os.listdir(join(DART_DIR, 'pkg')): 98 for directory in os.listdir(join(DART_DIR, 'pkg')):
100 doc_dir = join(DART_DIR, 'pkg', directory) 99 doc_dir = join(DART_DIR, 'pkg', directory)
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 print ( 155 print (
157 "\nPoint your browser to the address of the 'default' server below.") 156 "\nPoint your browser to the address of the 'default' server below.")
158 raw_input("Press <RETURN> to terminate the server.\n\n") 157 raw_input("Press <RETURN> to terminate the server.\n\n")
159 server.terminate() 158 server.terminate()
160 finally: 159 finally:
161 os.chdir(cwd) 160 os.chdir(cwd)
162 subprocess.call(['rm', '-rf', 'dartdoc-viewer']) 161 subprocess.call(['rm', '-rf', 'dartdoc-viewer'])
163 162
164 if __name__ == '__main__': 163 if __name__ == '__main__':
165 main() 164 main()
OLDNEW
« no previous file with comments | « pkg/custom_element/pubspec.yaml ('k') | pkg/html_import/LICENSE » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698