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

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

Issue 16387004: Roll back 16364004 and 16206027. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 6 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 | « sdk/bin/dartdoc ('k') | sdk/lib/_internal/dartdoc/lib/dartdoc.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) 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 *
(...skipping 11 matching lines...) Expand all
22 // TODO(rnystrom): Use "package:" URL (#4968). 22 // TODO(rnystrom): Use "package:" URL (#4968).
23 import '../lib/dartdoc.dart'; 23 import '../lib/dartdoc.dart';
24 import '../lib/src/dartdoc/utils.dart'; 24 import '../lib/src/dartdoc/utils.dart';
25 import 'package:args/args.dart'; 25 import 'package:args/args.dart';
26 import 'package:pathos/path.dart' as path; 26 import 'package:pathos/path.dart' as path;
27 27
28 /** 28 /**
29 * Run this from the `lib/_internal/dartdoc` directory. 29 * Run this from the `lib/_internal/dartdoc` directory.
30 */ 30 */
31 main() { 31 main() {
32 mainWithOptions(new Options());
33 }
34
35 /**
36 * We use this to include dartdoc in a single snapshot with dart2js.
37 * (They share 90% of the code)
38 */
39 mainWithOptions(Options options) {
40 // Need this because ArgParser.getUsage doesn't show command invocation. 32 // Need this because ArgParser.getUsage doesn't show command invocation.
41 final USAGE = 'Usage dartdoc [options] <entrypoint(s)>\n[options] include:'; 33 final USAGE = 'Usage dartdoc [options] <entrypoint(s)>\n[options] include:';
42 34
43 final args = options.arguments; 35 final args = new Options().arguments;
44 36
45 final dartdoc = new Dartdoc(); 37 final dartdoc = new Dartdoc();
46 38
47 final argParser = new ArgParser(); 39 final argParser = new ArgParser();
48 40
49 Path libPath = scriptDir.append('../../../../'); 41 Path libPath = scriptDir.append('../../../../');
50 42
51 String packageRoot; 43 String packageRoot;
52 44
53 argParser.addFlag('no-code', 45 argParser.addFlag('no-code',
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 if (packageRoot == null) packageRoot = _getPackageRoot(entrypoints); 233 if (packageRoot == null) packageRoot = _getPackageRoot(entrypoints);
242 234
243 cleanOutputDirectory(dartdoc.outputDir); 235 cleanOutputDirectory(dartdoc.outputDir);
244 236
245 // Start the analysis and documentation. 237 // Start the analysis and documentation.
246 dartdoc.documentLibraries(entrypoints, libPath, packageRoot) 238 dartdoc.documentLibraries(entrypoints, libPath, packageRoot)
247 // Prepare the dart2js script code and copy static resources. 239 // Prepare the dart2js script code and copy static resources.
248 // TODO(amouravski): move compileScript out and pre-generate the client 240 // TODO(amouravski): move compileScript out and pre-generate the client
249 // scripts. This takes a long time and the js hardly ever changes. 241 // scripts. This takes a long time and the js hardly ever changes.
250 .then((_) => compileScript(dartdoc.mode, dartdoc.outputDir, libPath)) 242 .then((_) => compileScript(dartdoc.mode, dartdoc.outputDir, libPath))
251 .then((_) => copyDirectory(libPath.append('lib/_internal/dartdoc/static'), 243 .then((_) => copyDirectory(scriptDir.append('../static'),
252 dartdoc.outputDir)) 244 dartdoc.outputDir))
253 .then((_) { 245 .then((_) {
254 print(dartdoc.status); 246 print(dartdoc.status);
255 if (dartdoc.totals == 0) { 247 if (dartdoc.totals == 0) {
256 exit(1); 248 exit(1);
257 } 249 }
258 }) 250 })
259 .catchError((e) { 251 .catchError((e) {
260 print('Error: generation failed: ${e}'); 252 print('Error: generation failed: ${e}');
261 var trace = getAttachedStackTrace(e); 253 var trace = getAttachedStackTrace(e);
262 if (trace != null) print("StackTrace: $trace"); 254 if (trace != null) print("StackTrace: $trace");
(...skipping 17 matching lines...) Expand all
280 // If there is not, then check if the entrypoint is somewhere in a `lib` 272 // If there is not, then check if the entrypoint is somewhere in a `lib`
281 // directory. 273 // directory.
282 var parts = path.split(path.dirname(script)); 274 var parts = path.split(path.dirname(script));
283 var libDir = parts.lastIndexOf('lib'); 275 var libDir = parts.lastIndexOf('lib');
284 if (libDir > 0) { 276 if (libDir > 0) {
285 return path.join(path.joinAll(parts.take(libDir)), 'packages'); 277 return path.join(path.joinAll(parts.take(libDir)), 'packages');
286 } else { 278 } else {
287 return null; 279 return null;
288 } 280 }
289 } 281 }
OLDNEW
« no previous file with comments | « sdk/bin/dartdoc ('k') | sdk/lib/_internal/dartdoc/lib/dartdoc.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698