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

Side by Side Diff: sdk/lib/_internal/dartdoc/bin/dartdoc.dart

Issue 50633004: Remove uses of dart:io Options in dart2js and dartdoc. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 1 month 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
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 /** 5 /**
6 * To generate docs for a library, run this script with the path to an 6 * To generate docs for a library, run this script with the path to an
7 * entrypoint .dart file, like: 7 * entrypoint .dart file, like:
8 * 8 *
9 * $ dart dartdoc.dart foo.dart 9 * $ dart dartdoc.dart foo.dart
10 * 10 *
11 * This will create a "docs" directory with the docs for your libraries. To 11 * This will create a "docs" directory with the docs for your libraries. To
12 * create these beautiful docs, dartdoc parses your library and every library 12 * create these beautiful docs, dartdoc parses your library and every library
13 * it imports (recursively). From each library, it parses all classes and 13 * it imports (recursively). From each library, it parses all classes and
14 * members, finds the associated doc comments and builds crosslinked docs from 14 * members, finds the associated doc comments and builds crosslinked docs from
15 * them. 15 * them.
16 */ 16 */
17 library dartdoc; 17 library dartdoc;
18 18
19 import 'dart:async'; 19 import 'dart:async';
20 import 'dart:io'; 20 import 'dart:io';
21 21
22 import '../lib/dartdoc.dart'; 22 import '../lib/dartdoc.dart';
23 import '../lib/src/dartdoc/utils.dart'; 23 import '../lib/src/dartdoc/utils.dart';
24 import 'package:args/args.dart'; 24 import 'package:args/args.dart';
25 import 'package:path/path.dart' as path; 25 import 'package:path/path.dart' as path;
26 26
27 /** 27 /**
28 * Run this from the `lib/_internal/dartdoc` directory. 28 * Run this from the `lib/_internal/dartdoc` directory.
29 */ 29 */
30 main() { 30 main(List<String> args) {
31 mainWithOptions(new Options());
32 }
33
34 /**
35 * We use this to include dartdoc in a single snapshot with dart2js.
36 * (They share 90% of the code)
37 */
38 mainWithOptions(Options options) {
39 // Need this because ArgParser.getUsage doesn't show command invocation. 31 // Need this because ArgParser.getUsage doesn't show command invocation.
40 final USAGE = 'Usage dartdoc [options] <entrypoint(s)>\n[options] include:'; 32 final USAGE = 'Usage dartdoc [options] <entrypoint(s)>\n[options] include:';
41 33
42 final args = options.arguments;
43
44 final dartdoc = new Dartdoc(); 34 final dartdoc = new Dartdoc();
45 35
46 final argParser = new ArgParser(); 36 final argParser = new ArgParser();
47 37
48 String libPath = path.join(scriptDir, '..', '..', '..', '..'); 38 String libPath = path.join(scriptDir, '..', '..', '..', '..');
49 39
50 String packageRoot; 40 String packageRoot;
51 41
52 argParser.addFlag('no-code', 42 argParser.addFlag('no-code',
53 help: 'Do not include source code in the documentation.', 43 help: 'Do not include source code in the documentation.',
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 // If there is not, then check if the entrypoint is somewhere in a `lib` 277 // If there is not, then check if the entrypoint is somewhere in a `lib`
288 // directory. 278 // directory.
289 var parts = path.split(path.dirname(script)); 279 var parts = path.split(path.dirname(script));
290 var libDir = parts.lastIndexOf('lib'); 280 var libDir = parts.lastIndexOf('lib');
291 if (libDir > 0) { 281 if (libDir > 0) {
292 return path.join(path.joinAll(parts.take(libDir)), 'packages'); 282 return path.join(path.joinAll(parts.take(libDir)), 'packages');
293 } else { 283 } else {
294 return null; 284 return null;
295 } 285 }
296 } 286 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698