@@ -43,8 +43,8 @@ main(List<String> arguments) async {
4343 exit (0 );
4444 }
4545
46- Directory sdkDir = getSdkDir ( );
47- final bool sdkDocs = args['sdk-docs' ];
46+ Directory sdkDir = new Directory (args[ 'sdk-dir' ] );
47+ bool sdkDocs = args['sdk-docs' ];
4848 final bool showProgress = args['show-progress' ];
4949
5050 Directory inputDir;
@@ -56,6 +56,14 @@ main(List<String> arguments) async {
5656 inputDir = args['input' ];
5757 }
5858
59+ // If our input directory looks like the Dart SDK, then assume it is one,
60+ // and is the one we want to document against.
61+ PackageMeta packageMeta = new PackageMeta .fromDir (inputDir);
62+ if (packageMeta.isSdk) {
63+ sdkDir = inputDir;
64+ sdkDocs = true ;
65+ }
66+
5967 List <String > footerTextFilePaths = [];
6068 // If we're generating docs for the Dart SDK, we insert a copyright footer.
6169 if (sdkDocs) {
@@ -142,8 +150,6 @@ main(List<String> arguments) async {
142150 });
143151 }
144152
145- PackageMeta packageMeta = new PackageMeta .fromDir (inputDir);
146-
147153 if (packageMeta == null ) {
148154 stderr.writeln (
149155 ' fatal error: Unable to generate documentation: no pubspec.yaml found' );
@@ -249,104 +255,108 @@ main(List<String> arguments) async {
249255
250256ArgParser _createArgsParser () {
251257 var parser = new ArgParser ();
252- parser.addFlag ('help' ,
253- abbr: 'h' , negatable: false , help: 'Show command help.' );
254- parser.addFlag ('version' ,
255- help: 'Display the version for $name .' , negatable: false );
256258 parser.addFlag ('add-crossdart' ,
257259 help: 'Add Crossdart links to the source code pieces.' ,
258260 negatable: false ,
259261 defaultsTo: false );
260- parser.addFlag ('sdk-docs' ,
261- help: 'Generate ONLY the docs for the Dart SDK.' , negatable: false );
262- parser.addFlag ('show-warnings' ,
263- help: 'Display warnings.' , negatable: false , defaultsTo: false );
264- parser.addFlag ('show-progress' ,
265- help: 'Display progress indications to console stdout' , negatable: false );
266- parser.addOption ('sdk-readme' ,
267- help: 'Path to the SDK description file. Deprecated (ignored)' );
268- parser.addOption ('input' , help: 'Path to source directory.' );
269- parser.addOption ('output' ,
270- help: 'Path to output directory.' , defaultsTo: defaultOutDir);
271- parser.addMultiOption ('header' ,
272- splitCommas: true , help: 'paths to header files containing HTML text.' );
262+ parser.addOption ('ambiguous-reexport-scorer-min-confidence' ,
263+ help:
264+ 'Minimum scorer confidence to suppress warning on ambiguous reexport.' ,
265+ defaultsTo: '0.1' ,
266+ hide: true );
267+ parser.addFlag ('auto-include-dependencies' ,
268+ help:
269+ 'Include all the used libraries into the docs, even the ones not in the current package or "include-external"' ,
270+ negatable: false ,
271+ defaultsTo: false );
272+ parser.addMultiOption ('category-order' ,
273+ help:
274+ 'A list of package names to place first when grouping libraries in packages. '
275+ 'Unmentioned categories are sorted after these. (deprecated, replaced by package-order)' ,
276+ splitCommas: true );
277+ parser.addOption ('example-path-prefix' ,
278+ help: 'Prefix for @example paths.\n (defaults to the project root)' );
279+ parser.addMultiOption ('exclude' ,
280+ splitCommas: true , help: 'Library names to ignore.' );
281+ parser.addMultiOption ('exclude-packages' ,
282+ splitCommas: true , help: 'Package names to ignore.' );
283+ parser.addOption ('favicon' ,
284+ help: 'A path to a favicon for the generated docs.' );
273285 parser.addMultiOption ('footer' ,
274286 splitCommas: true , help: 'paths to footer files containing HTML text.' );
275287 parser.addMultiOption ('footer-text' ,
276288 splitCommas: true ,
277289 help: 'paths to footer-text files '
278290 '(optional text next to the package name and version).' );
279- parser.addMultiOption ('exclude' ,
280- splitCommas: true , help: 'Library names to ignore.' );
281- parser.addMultiOption ('exclude-packages' ,
282- splitCommas: true , help: 'Package names to ignore.' );
291+ parser.addMultiOption ('header' ,
292+ splitCommas: true , help: 'paths to header files containing HTML text.' );
293+ parser.addFlag ('help' ,
294+ abbr: 'h' , negatable: false , help: 'Show command help.' );
295+ parser.addFlag ('hide-sdk-text' ,
296+ help:
297+ 'Drop all text for SDK components. Helpful for integration tests for dartdoc, probably not useful for anything else.' ,
298+ negatable: true ,
299+ defaultsTo: false ,
300+ hide: true );
301+ parser.addOption ('hosted-url' ,
302+ help:
303+ 'URL where the docs will be hosted (used to generate the sitemap).' );
283304 parser.addMultiOption ('include' ,
284305 splitCommas: true , help: 'Library names to generate docs for.' );
285306 parser.addMultiOption ('include-external' ,
286307 help: 'Additional (external) dart files to include; use "dir/fileName", '
287308 'as in lib/material.dart.' );
288- parser.addOption ('hosted-url' ,
289- help:
290- 'URL where the docs will be hosted (used to generate the sitemap).' );
291- parser.addOption ('example-path-prefix' ,
292- help: 'Prefix for @example paths.\n (defaults to the project root)' );
293- parser.addOption ('rel-canonical-prefix' ,
294- help: 'If provided, add a rel="canonical" prefixed with provided value. '
295- 'Consider using if\n building many versions of the docs for public '
296- 'SEO; learn more at https://goo.gl/gktN6F.' );
297309 parser.addFlag ('include-source' ,
298310 help: 'Show source code blocks.' , negatable: true , defaultsTo: true );
299- parser.addOption ('favicon' ,
300- help: 'A path to a favicon for the generated docs.' );
301- parser.addFlag ('use-categories' ,
302- help:
303- 'Group libraries from the same package in the libraries sidebar. (deprecated, ignored)' ,
304- negatable: false ,
305- defaultsTo: false );
306- parser.addMultiOption ('category-order' ,
307- help:
308- 'A list of package names to place first when grouping libraries in packages. '
309- 'Unmentioned categories are sorted after these. (deprecated, replaced by package-order)' ,
310- splitCommas: true );
311+ parser.addOption ('input' , help: 'Path to source directory.' );
312+ parser.addFlag ('json' ,
313+ help: 'Prints out progress JSON maps. One entry per line.' ,
314+ defaultsTo: false ,
315+ negatable: true );
316+ parser.addOption ('output' ,
317+ help: 'Path to output directory.' , defaultsTo: defaultOutDir);
311318 parser.addMultiOption ('package-order' ,
312319 help:
313320 'A list of package names to place first when grouping libraries in packages. '
314321 'Unmentioned categories are sorted after these.' ,
315322 splitCommas: true );
316- parser.addFlag ('auto-include-dependencies' ,
317- help:
318- 'Include all the used libraries into the docs, even the ones not in the current package or "include-external"' ,
319- negatable: false ,
320- defaultsTo: false );
321323 parser.addFlag ('pretty-index-json' ,
322324 help:
323325 "Generates `index.json` with indentation and newlines. The file is larger, but it's also easier to diff." ,
324326 negatable: false ,
325327 defaultsTo: false );
326- parser.addOption ('ambiguous-reexport-scorer-min-confidence' ,
327- help:
328- 'Minimum scorer confidence to suppress warning on ambiguous reexport.' ,
329- defaultsTo: "0.1" ,
330- hide: true );
331- parser.addFlag ('verbose-warnings' ,
332- help: 'Display extra debugging information and help with warnings.' ,
333- negatable: true ,
334- defaultsTo: true );
335- parser.addFlag ('hide-sdk-text' ,
328+ parser.addOption ('rel-canonical-prefix' ,
329+ help: 'If provided, add a rel="canonical" prefixed with provided value. '
330+ 'Consider using if\n building many versions of the docs for public '
331+ 'SEO; learn more at https://goo.gl/gktN6F.' );
332+ parser.addFlag ('sdk-docs' ,
333+ help: 'Generate ONLY the docs for the Dart SDK.' , negatable: false );
334+ parser.addOption ('sdk-readme' ,
335+ help: 'Path to the SDK description file. Deprecated (ignored)' );
336+ parser.addOption ('sdk-dir' ,
337+ help: 'Path to the SDK directory' ,
338+ defaultsTo: defaultSdkDir.absolute.path);
339+ parser.addFlag ('show-warnings' ,
340+ help: 'Display warnings.' , negatable: false , defaultsTo: false );
341+ parser.addFlag ('show-progress' ,
342+ help: 'Display progress indications to console stdout' , negatable: false );
343+ parser.addFlag ('use-categories' ,
336344 help:
337- "Drop all text for SDK components. Helpful for integration tests for dartdoc, probably not useful for anything else." ,
338- negatable: true ,
339- defaultsTo: false ,
340- hide: true );
341- parser.addFlag ('json' ,
342- help: 'Prints out progress JSON maps. One entry per line.' ,
343- defaultsTo: false ,
344- negatable: true );
345+ 'Group libraries from the same package in the libraries sidebar. (deprecated, ignored)' ,
346+ negatable: false ,
347+ defaultsTo: false );
345348 parser.addFlag ('validate-links' ,
346349 help:
347350 'Runs the built-in link checker to display Dart context aware warnings for broken links (slow)' ,
348351 negatable: true ,
349352 defaultsTo: true );
353+ parser.addFlag ('verbose-warnings' ,
354+ help: 'Display extra debugging information and help with warnings.' ,
355+ negatable: true ,
356+ defaultsTo: true );
357+ parser.addFlag ('version' ,
358+ help: 'Display the version for $name .' , negatable: false );
359+
350360 return parser;
351361}
352362
0 commit comments