-
Notifications
You must be signed in to change notification settings - Fork 131
Document arbitrary SDK-like things as Dart SDKs. #1665
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 39 commits
f36fbd0
3c0e8bc
717412a
299c154
b6a1627
951cf4b
f07e99b
910a83b
a10abbb
2dbd675
9bf9ca1
571261d
2fe1c1d
34c68ed
7580801
ec57d80
21b8120
19ae895
f5bcf10
151333d
18cb43b
71ee547
e35178e
bbab6eb
56830d6
f99a8fd
0047555
3541c68
7795367
c1210c8
a3febf7
55f7fe4
761dead
1b811d2
fa3a0b8
047762c
3556db2
80ce1c3
72bf63d
268826f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -43,8 +43,8 @@ main(List<String> arguments) async { | |
| exit(0); | ||
| } | ||
|
|
||
| Directory sdkDir = getSdkDir(); | ||
| final bool sdkDocs = args['sdk-docs']; | ||
| Directory sdkDir = new Directory(args['sdk-dir']); | ||
| bool sdkDocs = args['sdk-docs']; | ||
| final bool showProgress = args['show-progress']; | ||
|
|
||
| Directory inputDir; | ||
|
|
@@ -56,6 +56,14 @@ main(List<String> arguments) async { | |
| inputDir = args['input']; | ||
| } | ||
|
|
||
| // If our input directory looks like the Dart SDK, then assume it is one, | ||
| // and is the one we want to document against. | ||
| PackageMeta packageMeta = new PackageMeta.fromDir(inputDir); | ||
| if (packageMeta.isSdk) { | ||
| sdkDir = inputDir; | ||
| sdkDocs = true; | ||
| } | ||
|
|
||
| List<String> footerTextFilePaths = []; | ||
| // If we're generating docs for the Dart SDK, we insert a copyright footer. | ||
| if (sdkDocs) { | ||
|
|
@@ -142,8 +150,6 @@ main(List<String> arguments) async { | |
| }); | ||
| } | ||
|
|
||
| PackageMeta packageMeta = new PackageMeta.fromDir(inputDir); | ||
|
|
||
| if (packageMeta == null) { | ||
| stderr.writeln( | ||
| ' fatal error: Unable to generate documentation: no pubspec.yaml found'); | ||
|
|
@@ -249,104 +255,108 @@ main(List<String> arguments) async { | |
|
|
||
| ArgParser _createArgsParser() { | ||
| var parser = new ArgParser(); | ||
| parser.addFlag('help', | ||
| abbr: 'h', negatable: false, help: 'Show command help.'); | ||
| parser.addFlag('version', | ||
| help: 'Display the version for $name.', negatable: false); | ||
| parser.addFlag('add-crossdart', | ||
| help: 'Add Crossdart links to the source code pieces.', | ||
| negatable: false, | ||
| defaultsTo: false); | ||
| parser.addFlag('sdk-docs', | ||
| help: 'Generate ONLY the docs for the Dart SDK.', negatable: false); | ||
| parser.addFlag('show-warnings', | ||
| help: 'Display warnings.', negatable: false, defaultsTo: false); | ||
| parser.addFlag('show-progress', | ||
| help: 'Display progress indications to console stdout', negatable: false); | ||
| parser.addOption('sdk-readme', | ||
| help: 'Path to the SDK description file. Deprecated (ignored)'); | ||
| parser.addOption('input', help: 'Path to source directory.'); | ||
| parser.addOption('output', | ||
| help: 'Path to output directory.', defaultsTo: defaultOutDir); | ||
| parser.addMultiOption('header', | ||
| splitCommas: true, help: 'paths to header files containing HTML text.'); | ||
| parser.addOption('ambiguous-reexport-scorer-min-confidence', | ||
| help: | ||
| 'Minimum scorer confidence to suppress warning on ambiguous reexport.', | ||
| defaultsTo: "0.1", | ||
| hide: true); | ||
| parser.addFlag('auto-include-dependencies', | ||
| help: | ||
| 'Include all the used libraries into the docs, even the ones not in the current package or "include-external"', | ||
| negatable: false, | ||
| defaultsTo: false); | ||
| parser.addMultiOption('category-order', | ||
| help: | ||
| 'A list of package names to place first when grouping libraries in packages. ' | ||
| 'Unmentioned categories are sorted after these. (deprecated, replaced by package-order)', | ||
| splitCommas: true); | ||
| parser.addOption('example-path-prefix', | ||
| help: 'Prefix for @example paths.\n(defaults to the project root)'); | ||
| parser.addMultiOption('exclude', | ||
| splitCommas: true, help: 'Library names to ignore.'); | ||
| parser.addMultiOption('exclude-packages', | ||
| splitCommas: true, help: 'Package names to ignore.'); | ||
| parser.addOption('favicon', | ||
| help: 'A path to a favicon for the generated docs.'); | ||
| parser.addMultiOption('footer', | ||
| splitCommas: true, help: 'paths to footer files containing HTML text.'); | ||
| parser.addMultiOption('footer-text', | ||
| splitCommas: true, | ||
| help: 'paths to footer-text files ' | ||
| '(optional text next to the package name and version).'); | ||
| parser.addMultiOption('exclude', | ||
| splitCommas: true, help: 'Library names to ignore.'); | ||
| parser.addMultiOption('exclude-packages', | ||
| splitCommas: true, help: 'Package names to ignore.'); | ||
| parser.addMultiOption('header', | ||
| splitCommas: true, help: 'paths to header files containing HTML text.'); | ||
| parser.addFlag('help', | ||
| abbr: 'h', negatable: false, help: 'Show command help.'); | ||
| parser.addFlag('hide-sdk-text', | ||
| help: | ||
| "Drop all text for SDK components. Helpful for integration tests for dartdoc, probably not useful for anything else.", | ||
|
||
| negatable: true, | ||
| defaultsTo: false, | ||
| hide: true); | ||
| parser.addOption('hosted-url', | ||
| help: | ||
| 'URL where the docs will be hosted (used to generate the sitemap).'); | ||
| parser.addMultiOption('include', | ||
| splitCommas: true, help: 'Library names to generate docs for.'); | ||
| parser.addMultiOption('include-external', | ||
| help: 'Additional (external) dart files to include; use "dir/fileName", ' | ||
| 'as in lib/material.dart.'); | ||
| parser.addOption('hosted-url', | ||
| help: | ||
| 'URL where the docs will be hosted (used to generate the sitemap).'); | ||
| parser.addOption('example-path-prefix', | ||
| help: 'Prefix for @example paths.\n(defaults to the project root)'); | ||
| parser.addOption('rel-canonical-prefix', | ||
| help: 'If provided, add a rel="canonical" prefixed with provided value. ' | ||
| 'Consider using if\nbuilding many versions of the docs for public ' | ||
| 'SEO; learn more at https://goo.gl/gktN6F.'); | ||
| parser.addFlag('include-source', | ||
| help: 'Show source code blocks.', negatable: true, defaultsTo: true); | ||
| parser.addOption('favicon', | ||
| help: 'A path to a favicon for the generated docs.'); | ||
| parser.addFlag('use-categories', | ||
| help: | ||
| 'Group libraries from the same package in the libraries sidebar. (deprecated, ignored)', | ||
| negatable: false, | ||
| defaultsTo: false); | ||
| parser.addMultiOption('category-order', | ||
| help: | ||
| 'A list of package names to place first when grouping libraries in packages. ' | ||
| 'Unmentioned categories are sorted after these. (deprecated, replaced by package-order)', | ||
| splitCommas: true); | ||
| parser.addOption('input', help: 'Path to source directory.'); | ||
| parser.addFlag('json', | ||
| help: 'Prints out progress JSON maps. One entry per line.', | ||
| defaultsTo: false, | ||
| negatable: true); | ||
| parser.addOption('output', | ||
| help: 'Path to output directory.', defaultsTo: defaultOutDir); | ||
| parser.addMultiOption('package-order', | ||
| help: | ||
| 'A list of package names to place first when grouping libraries in packages. ' | ||
| 'Unmentioned categories are sorted after these.', | ||
| splitCommas: true); | ||
| parser.addFlag('auto-include-dependencies', | ||
| help: | ||
| 'Include all the used libraries into the docs, even the ones not in the current package or "include-external"', | ||
| negatable: false, | ||
| defaultsTo: false); | ||
| parser.addFlag('pretty-index-json', | ||
| help: | ||
| "Generates `index.json` with indentation and newlines. The file is larger, but it's also easier to diff.", | ||
| negatable: false, | ||
| defaultsTo: false); | ||
| parser.addOption('ambiguous-reexport-scorer-min-confidence', | ||
| help: | ||
| 'Minimum scorer confidence to suppress warning on ambiguous reexport.', | ||
| defaultsTo: "0.1", | ||
| hide: true); | ||
| parser.addFlag('verbose-warnings', | ||
| help: 'Display extra debugging information and help with warnings.', | ||
| negatable: true, | ||
| defaultsTo: true); | ||
| parser.addFlag('hide-sdk-text', | ||
| parser.addOption('rel-canonical-prefix', | ||
| help: 'If provided, add a rel="canonical" prefixed with provided value. ' | ||
| 'Consider using if\nbuilding many versions of the docs for public ' | ||
| 'SEO; learn more at https://goo.gl/gktN6F.'); | ||
| parser.addFlag('sdk-docs', | ||
| help: 'Generate ONLY the docs for the Dart SDK.', negatable: false); | ||
| parser.addOption('sdk-readme', | ||
| help: 'Path to the SDK description file. Deprecated (ignored)'); | ||
| parser.addOption('sdk-dir', | ||
| help: 'Path to the SDK directory', | ||
| defaultsTo: defaultSdkDir.absolute.path); | ||
| parser.addFlag('show-warnings', | ||
| help: 'Display warnings.', negatable: false, defaultsTo: false); | ||
| parser.addFlag('show-progress', | ||
| help: 'Display progress indications to console stdout', negatable: false); | ||
| parser.addFlag('use-categories', | ||
| help: | ||
| "Drop all text for SDK components. Helpful for integration tests for dartdoc, probably not useful for anything else.", | ||
| negatable: true, | ||
| defaultsTo: false, | ||
| hide: true); | ||
| parser.addFlag('json', | ||
| help: 'Prints out progress JSON maps. One entry per line.', | ||
| defaultsTo: false, | ||
| negatable: true); | ||
| 'Group libraries from the same package in the libraries sidebar. (deprecated, ignored)', | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. => (Deprecated, ignored) ?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. use-categories was marked deprecated, ignored back in #1641 because the meaning of "category" changed and we no longer require this flag to turn on what was category mode. Dartdoc now knows whether to do that by context and we just ignore this flag if it gets passed in. The diff looks weird because I sorted the options here to better keep track of them visually, as I'm going to be doing major surgery on them soon. |
||
| negatable: false, | ||
| defaultsTo: false); | ||
| parser.addFlag('validate-links', | ||
| help: | ||
| 'Runs the built-in link checker to display Dart context aware warnings for broken links (slow)', | ||
| negatable: true, | ||
| defaultsTo: true); | ||
| parser.addFlag('verbose-warnings', | ||
| help: 'Display extra debugging information and help with warnings.', | ||
| negatable: true, | ||
| defaultsTo: true); | ||
| parser.addFlag('version', | ||
| help: 'Display the version for $name.', negatable: false); | ||
|
|
||
| return parser; | ||
| } | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps stick with single-quotes for consistency?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done