@@ -43,8 +43,8 @@ main(List<String> arguments) async {
43
43
exit (0 );
44
44
}
45
45
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' ];
48
48
final bool showProgress = args['show-progress' ];
49
49
50
50
Directory inputDir;
@@ -56,6 +56,14 @@ main(List<String> arguments) async {
56
56
inputDir = args['input' ];
57
57
}
58
58
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
+
59
67
List <String > footerTextFilePaths = [];
60
68
// If we're generating docs for the Dart SDK, we insert a copyright footer.
61
69
if (sdkDocs) {
@@ -142,8 +150,6 @@ main(List<String> arguments) async {
142
150
});
143
151
}
144
152
145
- PackageMeta packageMeta = new PackageMeta .fromDir (inputDir);
146
-
147
153
if (packageMeta == null ) {
148
154
stderr.writeln (
149
155
' fatal error: Unable to generate documentation: no pubspec.yaml found' );
@@ -249,104 +255,108 @@ main(List<String> arguments) async {
249
255
250
256
ArgParser _createArgsParser () {
251
257
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 );
256
258
parser.addFlag ('add-crossdart' ,
257
259
help: 'Add Crossdart links to the source code pieces.' ,
258
260
negatable: false ,
259
261
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.' );
273
285
parser.addMultiOption ('footer' ,
274
286
splitCommas: true , help: 'paths to footer files containing HTML text.' );
275
287
parser.addMultiOption ('footer-text' ,
276
288
splitCommas: true ,
277
289
help: 'paths to footer-text files '
278
290
'(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).' );
283
304
parser.addMultiOption ('include' ,
284
305
splitCommas: true , help: 'Library names to generate docs for.' );
285
306
parser.addMultiOption ('include-external' ,
286
307
help: 'Additional (external) dart files to include; use "dir/fileName", '
287
308
'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.' );
297
309
parser.addFlag ('include-source' ,
298
310
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);
311
318
parser.addMultiOption ('package-order' ,
312
319
help:
313
320
'A list of package names to place first when grouping libraries in packages. '
314
321
'Unmentioned categories are sorted after these.' ,
315
322
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 );
321
323
parser.addFlag ('pretty-index-json' ,
322
324
help:
323
325
"Generates `index.json` with indentation and newlines. The file is larger, but it's also easier to diff." ,
324
326
negatable: false ,
325
327
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' ,
336
344
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 );
345
348
parser.addFlag ('validate-links' ,
346
349
help:
347
350
'Runs the built-in link checker to display Dart context aware warnings for broken links (slow)' ,
348
351
negatable: true ,
349
352
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
+
350
360
return parser;
351
361
}
352
362
0 commit comments