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

Side by Side Diff: utils/apidoc/apidoc.dart

Issue 9722012: Get rid of bash for dartdoc and do the whole thing in dart. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Remove cute comment. Created 8 years, 9 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 | « utils/apidoc/apidoc ('k') | no next file » | 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 * Generates the complete set of corelib reference documentation. 6 * This generates the reference documentation for the core libraries that come
7 * with dart. It is built on top of dartdoc, which is a general-purpose library
8 * for generating docs from any Dart code. This library extends that to include
9 * additional information and styling specific to our standard library.
10 *
11 * Usage:
12 *
13 * $ dart apidoc.dart [--out=<output directory>]
7 */ 14 */
8 #library('apidoc'); 15 #library('apidoc');
9 16
10 #import('dart:json'); 17 #import('dart:json');
11 #import('html_diff.dart'); 18 #import('html_diff.dart');
12 #import('../../frog/lang.dart'); 19 #import('../../frog/lang.dart');
13 #import('../../frog/file_system_vm.dart'); 20 #import('../../frog/file_system_vm.dart');
14 #import('../../frog/file_system.dart'); 21 #import('../../frog/file_system.dart');
15 #import('../../lib/dartdoc/dartdoc.dart', prefix: 'doc'); 22 #import('../../lib/dartdoc/dartdoc.dart', prefix: 'doc');
16 23
(...skipping 13 matching lines...) Expand all
30 } else if (args.length == 1) { 37 } else if (args.length == 1) {
31 final arg = args[0]; 38 final arg = args[0];
32 if (arg.startsWith('--out=')) { 39 if (arg.startsWith('--out=')) {
33 outputDir = arg.substring('--out='.length); 40 outputDir = arg.substring('--out='.length);
34 } else { 41 } else {
35 print('Unknown option: $arg'); 42 print('Unknown option: $arg');
36 return; 43 return;
37 } 44 }
38 } 45 }
39 46
47 final frogPath = joinPaths(doc.scriptDir, '../../frog/');
48
40 doc.cleanOutputDirectory(outputDir); 49 doc.cleanOutputDirectory(outputDir);
41 50
51 // Compile the client-side code to JS.
52 // TODO(bob): Right path.
53 doc.compileScript(frogPath,
54 '${doc.scriptDir}/../../lib/dartdoc/client-live-nav.dart',
55 '${outputDir}/client-live-nav.js');
56
42 // TODO(rnystrom): Use platform-specific path separator. 57 // TODO(rnystrom): Use platform-specific path separator.
43 // The basic dartdoc-provided static content. 58 // The basic dartdoc-provided static content.
44 doc.copyFiles('${doc.scriptDir}/../../lib/dartdoc/static', outputDir); 59 doc.copyFiles('${doc.scriptDir}/../../lib/dartdoc/static', outputDir);
45 60
46 // The apidoc-specific static content. 61 // The apidoc-specific static content.
47 doc.copyFiles('${doc.scriptDir}/static', outputDir); 62 doc.copyFiles('${doc.scriptDir}/static', outputDir);
48 63
49 var files = new VMFileSystem(); 64 var files = new VMFileSystem();
50 parseOptions('../../frog', ['', '', '--libdir=../../frog/lib'], files); 65 parseOptions(frogPath, ['', '', '--libdir=$frogPath/lib'], files);
51 initializeWorld(files); 66 initializeWorld(files);
52 67
53 print('Parsing MDN data...'); 68 print('Parsing MDN data...');
54 final mdn = JSON.parse(files.readAll('mdn/database.json')); 69 final mdn = JSON.parse(files.readAll('mdn/database.json'));
55 70
56 print('Cross-referencing dart:dom and dart:html...'); 71 print('Cross-referencing dart:dom and dart:html...');
57 HtmlDiff.initialize(); 72 HtmlDiff.initialize();
58 _diff = new HtmlDiff(); 73 _diff = new HtmlDiff();
59 _diff.run(); 74 _diff.run();
60 world.reset(); 75 world.reset();
61 76
62 // TODO(rnystrom): Cram in the the IO libraries. This is hackish right now. 77 // Add all of the core libraries.
63 // We should probably move corelib stuff completely out of dartdoc and have it 78 world.getOrAddLibrary('dart:core');
64 // all here. 79 world.getOrAddLibrary('dart:coreimpl');
80 world.getOrAddLibrary('dart:json');
81 world.getOrAddLibrary('dart:dom');
82 world.getOrAddLibrary('dart:html');
65 world.getOrAddLibrary('dart:io'); 83 world.getOrAddLibrary('dart:io');
84 world.getOrAddLibrary('dart:isolate');
85 world.getOrAddLibrary('dart:uri');
86 world.getOrAddLibrary('dart:utf');
87 world.process();
66 88
67 print('Generating docs...'); 89 print('Generating docs...');
68 final apidoc = new Apidoc(mdn, outputDir); 90 final apidoc = new Apidoc(mdn, outputDir);
69 apidoc.document('html'); 91 apidoc.document();
70 } 92 }
71 93
72 class Apidoc extends doc.Dartdoc { 94 class Apidoc extends doc.Dartdoc {
73 /** Big ball of JSON containing the scraped MDN documentation. */ 95 /** Big ball of JSON containing the scraped MDN documentation. */
74 final Map mdn; 96 final Map mdn;
75 97
76 /** 98 /**
77 * The URL to the page on MDN that content was pulled from for the current 99 * The URL to the page on MDN that content was pulled from for the current
78 * type being documented. Will be `null` if the type doesn't use any MDN 100 * type being documented. Will be `null` if the type doesn't use any MDN
79 * content. 101 * content.
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after
412 return 434 return
413 ''' 435 '''
414 <p class="correspond">This corresponds to $domTypesText in the 436 <p class="correspond">This corresponds to $domTypesText in the
415 ${a("dom.html", "dart:dom")} library.</p> 437 ${a("dom.html", "dart:dom")} library.</p>
416 '''; 438 ''';
417 } 439 }
418 440
419 return ''; 441 return '';
420 } 442 }
421 } 443 }
OLDNEW
« no previous file with comments | « utils/apidoc/apidoc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698