OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 /// **docgen** is a tool for creating machine readable representations of Dart | 5 /// **docgen** is a tool for creating machine readable representations of Dart |
6 /// code metadata, including: classes, members, comments and annotations. | 6 /// code metadata, including: classes, members, comments and annotations. |
7 /// | 7 /// |
8 /// docgen is run on a `.dart` file or a directory containing `.dart` files. | 8 /// docgen is run on a `.dart` file or a directory containing `.dart` files. |
9 /// | 9 /// |
10 /// $ dart docgen.dart [OPTIONS] [FILE/DIR] | 10 /// $ dart docgen.dart [OPTIONS] [FILE/DIR] |
(...skipping 20 matching lines...) Expand all Loading... |
31 /// also be documented. | 31 /// also be documented. |
32 /// If [parseSdk] is `true`, then all Dart SDK libraries will be documented. | 32 /// If [parseSdk] is `true`, then all Dart SDK libraries will be documented. |
33 /// This option is useful when only the SDK libraries are needed. | 33 /// This option is useful when only the SDK libraries are needed. |
34 /// If [compile] is `true`, then after generating the documents, compile the | 34 /// If [compile] is `true`, then after generating the documents, compile the |
35 /// viewer with dart2js. | 35 /// viewer with dart2js. |
36 /// If [serve] is `true`, then after generating the documents we fire up a | 36 /// If [serve] is `true`, then after generating the documents we fire up a |
37 /// simple server to view the documentation. | 37 /// simple server to view the documentation. |
38 /// | 38 /// |
39 /// Returned Future completes with true if document generation is successful. | 39 /// Returned Future completes with true if document generation is successful. |
40 Future<bool> docgen(List<String> files, {String packageRoot, | 40 Future<bool> docgen(List<String> files, {String packageRoot, |
41 bool outputToYaml: false, bool includePrivate: false, | 41 bool includePrivate: false, bool includeSdk: false, bool parseSdk: false, |
42 bool includeSdk: false, bool parseSdk: false, bool append: false, | |
43 String introFileName: '', String out: gen.DEFAULT_OUTPUT_DIRECTORY, | 42 String introFileName: '', String out: gen.DEFAULT_OUTPUT_DIRECTORY, |
44 List<String> excludeLibraries: const [], | 43 List<String> excludeLibraries: const [], |
45 bool includeDependentPackages: false, bool compile: false, | 44 bool includeDependentPackages: false, bool compile: false, |
46 bool serve: false, bool noDocs: false, String startPage, String pubScript, | 45 bool serve: false, bool noDocs: false, String startPage, String pubScript, |
47 String dartBinary}) { | 46 String dartBinary}) { |
48 var result; | 47 var result; |
49 if (!noDocs) { | 48 if (!noDocs) { |
50 viewer.ensureMovedViewerCode(); | 49 viewer.ensureMovedViewerCode(); |
51 result = gen.generateDocumentation(files, packageRoot: packageRoot, | 50 result = gen.generateDocumentation(files, packageRoot: packageRoot, |
52 outputToYaml: outputToYaml, includePrivate: includePrivate, | 51 includePrivate: includePrivate, |
53 includeSdk: includeSdk, parseSdk: parseSdk, append: append, | 52 includeSdk: includeSdk, parseSdk: parseSdk, |
54 introFileName: introFileName, out: out, | 53 introFileName: introFileName, out: out, |
55 excludeLibraries: excludeLibraries, | 54 excludeLibraries: excludeLibraries, |
56 includeDependentPackages: includeDependentPackages, | 55 includeDependentPackages: includeDependentPackages, |
57 startPage: startPage, pubScript: pubScript, dartBinary: dartBinary); | 56 startPage: startPage, pubScript: pubScript, dartBinary: dartBinary); |
58 viewer.addBackViewerCode(); | 57 viewer.addBackViewerCode(); |
59 if (compile || serve) { | 58 if (compile || serve) { |
60 result.then((success) { | 59 result.then((success) { |
61 if (success) { | 60 if (success) { |
62 viewer.createViewer(serve); | 61 viewer.createViewer(serve); |
63 } | 62 } |
64 }); | 63 }); |
65 } | 64 } |
66 } else if (compile || serve) { | 65 } else if (compile || serve) { |
67 viewer.createViewer(serve); | 66 viewer.createViewer(serve); |
68 } | 67 } |
69 return result; | 68 return result; |
70 } | 69 } |
OLD | NEW |