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

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

Issue 116043013: Add a snapshot for docgen and use it in the build (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Previous version could pass the default text as markdown instead of converting to html Created 6 years, 11 months 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 = []; 13 List<String> excludedLibraries = [];
14 14
15 /** 15 /**
16 * Analyzes Dart files and generates a representation of included libraries, 16 * Analyzes Dart files and generates a representation of included libraries,
17 * classes, and members. 17 * classes, and members.
18 */ 18 */
19 void main(List<String> arguments) { 19 void main(List<String> arguments) {
20 logger.onRecord.listen((record) => print(record.message)); 20 logger.onRecord.listen((record) => print(record.message));
21 var results = _initArgParser().parse(arguments); 21 var results = _initArgParser().parse(arguments);
22 22
23 var includeSdk = results['parse-sdk'] || results['include-sdk']; 23 var includeSdk = results['parse-sdk'] || results['include-sdk'];
24 var scriptDir = path.dirname(Platform.script.toFilePath()); 24 var scriptDir = path.dirname(Platform.script.toFilePath());
25 var introFile = 25 var introduction = includeSdk ? '' : results['introduction'];
26 path.join(path.dirname(scriptDir), 'doc', 'sdk-introduction.md');
27 var introduction = includeSdk ? introFile : results['introduction'];
28 docgen(results.rest.map(path.normalize).toList(), 26 docgen(results.rest.map(path.normalize).toList(),
29 packageRoot: results['package-root'], 27 packageRoot: results['package-root'],
30 outputToYaml: !results['json'], 28 outputToYaml: !results['json'],
31 includePrivate: results['include-private'], 29 includePrivate: results['include-private'],
32 includeSdk: includeSdk, 30 includeSdk: includeSdk,
33 parseSdk: results['parse-sdk'], 31 parseSdk: results['parse-sdk'],
34 append: results['append'] && new Directory(results['out']).existsSync(), 32 append: results['append'] && new Directory(results['out']).existsSync(),
35 introduction: introduction, 33 introFileName: introduction,
36 out: results['out'], 34 out: results['out'],
37 excludeLibraries: excludedLibraries, 35 excludeLibraries: excludedLibraries,
38 includeDependentPackages: results['include-dependent-packages']); 36 includeDependentPackages: results['include-dependent-packages']);
39 } 37 }
40 38
41 /** 39 /**
42 * Creates parser for docgen command line arguments. 40 * Creates parser for docgen command line arguments.
43 */ 41 */
44 ArgParser _initArgParser() { 42 ArgParser _initArgParser() {
45 var parser = new ArgParser(); 43 var parser = new ArgParser();
(...skipping 24 matching lines...) Expand all
70 parser.addFlag('parse-sdk', 68 parser.addFlag('parse-sdk',
71 help: 'Parses the SDK libraries only.', 69 help: 'Parses the SDK libraries only.',
72 defaultsTo: false, negatable: false); 70 defaultsTo: false, negatable: false);
73 parser.addOption('package-root', 71 parser.addOption('package-root',
74 help: 'Sets the package root of the library being analyzed.'); 72 help: 'Sets the package root of the library being analyzed.');
75 parser.addFlag('append', 73 parser.addFlag('append',
76 help: 'Append to the docs folder, library_list.json and index.txt', 74 help: 'Append to the docs folder, library_list.json and index.txt',
77 defaultsTo: false, negatable: false); 75 defaultsTo: false, negatable: false);
78 parser.addOption('introduction', 76 parser.addOption('introduction',
79 help: 'Adds the provided markdown text file as the introduction' 77 help: 'Adds the provided markdown text file as the introduction'
80 ' for the outputted documentation.', defaultsTo: ''); 78 ' for the generated documentation.', defaultsTo: '');
81 parser.addOption('out', 79 parser.addOption('out',
82 help: 'The name of the output directory.', 80 help: 'The name of the output directory.',
83 defaultsTo: 'docs'); 81 defaultsTo: 'docs');
84 parser.addOption('exclude-lib', 82 parser.addOption('exclude-lib',
85 help: 'Exclude the library by this name from the documentation', 83 help: 'Exclude the library by this name from the documentation',
86 allowMultiple: true, 84 allowMultiple: true,
87 callback: (libs) => excludedLibraries.addAll(libs)); 85 callback: (libs) => excludedLibraries.addAll(libs));
88 parser.addFlag('include-dependent-packages', 86 parser.addFlag('include-dependent-packages',
89 help: 'Assumes we are documenting a single package and are running ' 87 help: 'Assumes we are documenting a single package and are running '
90 'in the directory with its pubspec. Includes documentation for all ' 88 'in the directory with its pubspec. Includes documentation for all '
91 'of its dependent packages.', 89 'of its dependent packages.',
92 defaultsTo: false, negatable: false); 90 defaultsTo: false, negatable: false);
93 return parser; 91 return parser;
94 } 92 }
OLDNEW
« no previous file with comments | « pkg/docgen/bin/dartdoc.py ('k') | pkg/docgen/doc/README.txt » ('j') | pkg/docgen/lib/docgen.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698