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

Side by Side Diff: pkg/docgen/bin/docgen.dart

Issue 73113002: Generate docgen output along with api_docs as part of the build (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) 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 import 'dart:io'; 5 import 'dart:io';
6 6
7 import 'package:args/args.dart'; 7 import 'package:args/args.dart';
8 import 'package:logging/logging.dart'; 8 import 'package:logging/logging.dart';
9 9
10 import '../lib/docgen.dart'; 10 import '../lib/docgen.dart';
11 import 'package:path/path.dart' as path; 11 import 'package:path/path.dart' as path;
12 12
13 List<String> excludedLibraries = [];
14
13 /** 15 /**
14 * Analyzes Dart files and generates a representation of included libraries, 16 * Analyzes Dart files and generates a representation of included libraries,
15 * classes, and members. 17 * classes, and members.
16 */ 18 */
17 void main(List<String> arguments) { 19 void main(List<String> arguments) {
18 logger.onRecord.listen((record) => print(record.message)); 20 logger.onRecord.listen((record) => print(record.message));
19 var results = _initArgParser().parse(arguments); 21 var results = _initArgParser().parse(arguments);
20 22
23 var intro = path.join(path.dirname(Platform.script.toFilePath()),
24 'sdk-introduction.md');
21 docgen(results.rest.map(path.normalize).toList(), 25 docgen(results.rest.map(path.normalize).toList(),
22 packageRoot: results['package-root'], 26 packageRoot: results['package-root'],
23 outputToYaml: !results['json'], 27 outputToYaml: !results['json'],
24 includePrivate: results['include-private'], 28 includePrivate: results['include-private'],
25 includeSdk: results['parse-sdk'] || results['include-sdk'], 29 includeSdk: results['parse-sdk'] || results['include-sdk'],
26 parseSdk: results['parse-sdk'], 30 parseSdk: results['parse-sdk'],
27 append: results['append'] && new Directory('docs').existsSync(), 31 append: results['append'] && new Directory(results['out']).existsSync(),
28 introduction: (results['parse-sdk'] || results['include-sdk']) ? 32 introduction: (results['parse-sdk'] || results['include-sdk']) ?
29 'sdk-introduction.md' : results['introduction']); 33 intro : results['introduction'],
Bob Nystrom 2013/11/14 22:43:04 Multi-line ternary operator in the middle of an ex
Alan Knight 2013/11/15 18:49:56 Done.
34 out: results['out'],
35 excludeLibraries: excludedLibraries);
30 } 36 }
31 37
32 /** 38 /**
33 * Creates parser for docgen command line arguments. 39 * Creates parser for docgen command line arguments.
34 */ 40 */
35 ArgParser _initArgParser() { 41 ArgParser _initArgParser() {
36 var parser = new ArgParser(); 42 var parser = new ArgParser();
37 parser.addFlag('help', abbr: 'h', 43 parser.addFlag('help', abbr: 'h',
38 help: 'Prints help and usage information.', 44 help: 'Prints help and usage information.',
39 negatable: false, 45 negatable: false,
(...skipping 22 matching lines...) Expand all
62 help: 'Parses the SDK libraries only.', 68 help: 'Parses the SDK libraries only.',
63 defaultsTo: false, negatable: false); 69 defaultsTo: false, negatable: false);
64 parser.addOption('package-root', 70 parser.addOption('package-root',
65 help: 'Sets the package root of the library being analyzed.'); 71 help: 'Sets the package root of the library being analyzed.');
66 parser.addFlag('append', 72 parser.addFlag('append',
67 help: 'Append to the docs folder, library_list.json and index.txt', 73 help: 'Append to the docs folder, library_list.json and index.txt',
68 defaultsTo: false, negatable: false); 74 defaultsTo: false, negatable: false);
69 parser.addOption('introduction', 75 parser.addOption('introduction',
70 help: 'Adds the provided markdown text file as the introduction' 76 help: 'Adds the provided markdown text file as the introduction'
71 ' for the outputted documentation.', defaultsTo: ''); 77 ' for the outputted documentation.', defaultsTo: '');
72 78 parser.addOption('out',
79 help: 'The name of the output directory.',
80 defaultsTo: 'docs');
81 parser.addOption('exclude-lib',
82 help: 'Exclude the library by this name from the documentation',
83 allowMultiple: true,
84 callback: (libs) => excludedLibraries.addAll(libs));
73 return parser; 85 return parser;
74 } 86 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698