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

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

Issue 161893002: Automatically pass SDK into docgen.dart, and use the SDK for running (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 10 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
« no previous file with comments | « no previous file | pkg/docgen/lib/docgen.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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';
(...skipping 17 matching lines...) Expand all
28 var startPage = options['start-page']; 28 var startPage = options['start-page'];
29 if (_singlePackage(_files) && startPage == null) { 29 if (_singlePackage(_files) && startPage == null) {
30 startPage = _defaultStartPage; 30 startPage = _defaultStartPage;
31 print("Using default options for documenting a single package: " 31 print("Using default options for documenting a single package: "
32 "--start-page=$startPage"); 32 "--start-page=$startPage");
33 } 33 }
34 var includeSdk = options['parse-sdk'] || options['include-sdk']; 34 var includeSdk = options['parse-sdk'] || options['include-sdk'];
35 var scriptDir = path.dirname(Platform.script.toFilePath()); 35 var scriptDir = path.dirname(Platform.script.toFilePath());
36 var introduction = includeSdk ? '' : options['introduction']; 36 var introduction = includeSdk ? '' : options['introduction'];
37 37
38 var pubScript = options['sdk'] != null ?
39 path.join(options['sdk'], 'bin', 'pub') : 'pub';
40
41 var dartBinary = options['sdk'] != null ?
42 path.join(options['sdk'], 'bin', 'dart') : 'dart';
43
38 docgen(_files, 44 docgen(_files,
39 packageRoot: options['package-root'], 45 packageRoot: options['package-root'],
40 outputToYaml: !options['json'], 46 outputToYaml: !options['json'],
41 includePrivate: options['include-private'], 47 includePrivate: options['include-private'],
42 includeSdk: includeSdk, 48 includeSdk: includeSdk,
43 parseSdk: options['parse-sdk'], 49 parseSdk: options['parse-sdk'],
44 append: options['append'] && new Directory(options['out']).existsSync(), 50 append: options['append'] && new Directory(options['out']).existsSync(),
45 introFileName: introduction, 51 introFileName: introduction,
46 out: options['out'], 52 out: options['out'],
47 excludeLibraries: excludedLibraries, 53 excludeLibraries: excludedLibraries,
48 includeDependentPackages: options['include-dependent-packages'], 54 includeDependentPackages: options['include-dependent-packages'],
49 serve: options['serve'], 55 serve: options['serve'],
56 dartBinary: dartBinary,
57 pubScript: pubScript,
50 noDocs: options['no-docs'], 58 noDocs: options['no-docs'],
51 startPage: startPage); 59 startPage: startPage);
52 } 60 }
53 61
54 /** 62 /**
55 * Print help if we are passed the help option or invalid arguments. 63 * Print help if we are passed the help option or invalid arguments.
56 */ 64 */
57 void _printHelpAndExit() { 65 void _printHelpAndExit() {
58 print(_initArgParser().getUsage()); 66 print(_initArgParser().getUsage());
59 print('Usage: dart docgen.dart [OPTIONS] fooDir/barFile'); 67 print('Usage: dart docgen.dart [OPTIONS] fooDir/barFile');
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 defaultsTo: 'docs'); 137 defaultsTo: 'docs');
130 parser.addOption('exclude-lib', 138 parser.addOption('exclude-lib',
131 help: 'Exclude the library by this name from the documentation', 139 help: 'Exclude the library by this name from the documentation',
132 allowMultiple: true, 140 allowMultiple: true,
133 callback: (libs) => excludedLibraries.addAll(libs)); 141 callback: (libs) => excludedLibraries.addAll(libs));
134 parser.addFlag('include-dependent-packages', 142 parser.addFlag('include-dependent-packages',
135 help: 'Assumes we are documenting a single package and are running ' 143 help: 'Assumes we are documenting a single package and are running '
136 'in the directory with its pubspec. Includes documentation for all ' 144 'in the directory with its pubspec. Includes documentation for all '
137 'of its dependent packages.', 145 'of its dependent packages.',
138 defaultsTo: true, negatable: true); 146 defaultsTo: true, negatable: true);
147 parser.addOption('sdk',
148 help: 'SDK directory',
149 defaultsTo: null);
139 parser.addOption('start-page', 150 parser.addOption('start-page',
140 help: 'By default the viewer will start at the SDK introduction page.' 151 help: 'By default the viewer will start at the SDK introduction page.'
141 'To start at some other page, e.g. for a package, provide the name ' 152 'To start at some other page, e.g. for a package, provide the name '
142 'of the package in this argument, e.g. --start-page=intl will make ' 153 'of the package in this argument, e.g. --start-page=intl will make '
143 'the start page of the viewer be the intl package.', 154 'the start page of the viewer be the intl package.',
144 defaultsTo: null); 155 defaultsTo: null);
145 156
146 return parser; 157 return parser;
147 } 158 }
OLDNEW
« no previous file with comments | « no previous file | pkg/docgen/lib/docgen.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698