Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 * This generates the reference documentation for the core libraries that come | 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 | 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 | 8 * for generating docs from any Dart code. This library extends that to include |
| 9 * additional information and styling specific to our standard library. | 9 * additional information and styling specific to our standard library. |
| 10 * | 10 * |
| 11 * Usage: | 11 * Usage: |
| 12 * | 12 * |
| 13 * $ dart apidoc.dart [--out=<output directory>] | 13 * $ dart apidoc.dart [--out=<output directory>] |
| 14 */ | 14 */ |
| 15 #library('apidoc'); | 15 #library('apidoc'); |
| 16 | 16 |
| 17 #import('dart:io'); | |
| 17 #import('dart:json'); | 18 #import('dart:json'); |
| 18 #import('html_diff.dart'); | 19 #import('html_diff.dart'); |
| 19 #import('../../frog/lang.dart'); | 20 #import('../../frog/lang.dart'); |
| 20 #import('../../frog/file_system_vm.dart'); | 21 #import('../../frog/file_system_vm.dart'); |
| 21 #import('../../frog/file_system.dart'); | 22 #import('../../frog/file_system.dart'); |
| 22 #import('../../lib/dartdoc/dartdoc.dart', prefix: 'doc'); | 23 #import('../../lib/dartdoc/dartdoc.dart', prefix: 'doc'); |
| 23 | 24 |
| 24 HtmlDiff _diff; | 25 HtmlDiff _diff; |
| 25 | 26 |
| 26 final GET_PREFIX = 'get:'; | 27 final GET_PREFIX = 'get:'; |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 38 final arg = args[0]; | 39 final arg = args[0]; |
| 39 if (arg.startsWith('--out=')) { | 40 if (arg.startsWith('--out=')) { |
| 40 outputDir = arg.substring('--out='.length); | 41 outputDir = arg.substring('--out='.length); |
| 41 } else { | 42 } else { |
| 42 print('Unknown option: $arg'); | 43 print('Unknown option: $arg'); |
| 43 return; | 44 return; |
| 44 } | 45 } |
| 45 } | 46 } |
| 46 | 47 |
| 47 final frogPath = joinPaths(doc.scriptDir, '../../frog/'); | 48 final frogPath = joinPaths(doc.scriptDir, '../../frog/'); |
| 49 final libDir = joinPaths(frogPath, 'lib'); | |
| 50 final compilerPath = joinPaths(frogPath, 'minfrog'); | |
|
dgrove
2012/03/30 17:46:31
minfrog is going away. why not just run frog out o
Bob Nystrom
2012/03/30 18:01:40
There will be enormous changes to dartdoc and apid
dgrove
2012/03/30 18:16:25
yes. this can wait, given the reality that there w
| |
| 48 | 51 |
| 49 doc.cleanOutputDirectory(outputDir); | 52 doc.cleanOutputDirectory(outputDir); |
| 50 | 53 |
| 51 // Compile the client-side code to JS. | 54 // Compile the client-side code to JS. |
| 52 // TODO(bob): Right path. | 55 doc.compileScript(compilerPath, libDir, |
| 53 doc.compileScript(frogPath, | 56 joinPaths(doc.scriptDir, '/../../lib/dartdoc/client-live-nav.dart'), |
| 54 '${doc.scriptDir}/../../lib/dartdoc/client-live-nav.dart', | 57 joinPaths(outputDir, 'client-live-nav.js')); |
| 55 '${outputDir}/client-live-nav.js'); | |
| 56 | 58 |
| 57 // TODO(rnystrom): Use platform-specific path separator. | 59 // TODO(rnystrom): Use platform-specific path separator. |
| 58 // The basic dartdoc-provided static content. | 60 // The basic dartdoc-provided static content. |
| 59 doc.copyFiles('${doc.scriptDir}/../../lib/dartdoc/static', outputDir); | 61 doc.copyFiles('${doc.scriptDir}/../../lib/dartdoc/static', outputDir); |
| 60 | 62 |
| 61 // The apidoc-specific static content. | 63 // The apidoc-specific static content. |
| 62 doc.copyFiles('${doc.scriptDir}/static', outputDir); | 64 doc.copyFiles('${doc.scriptDir}/static', outputDir); |
| 63 | 65 |
| 64 var files = new VMFileSystem(); | 66 var files = new VMFileSystem(); |
| 65 parseOptions(frogPath, ['', '', '--libdir=$frogPath/lib'], files); | 67 parseOptions(frogPath, ['', '', '--libdir=$frogPath/lib'], files); |
| 66 initializeWorld(files); | 68 initializeWorld(files); |
| 67 | 69 |
| 68 print('Parsing MDN data...'); | 70 print('Parsing MDN data...'); |
| 69 final mdn = JSON.parse(files.readAll('mdn/database.json')); | 71 final mdnFile = new File('${doc.scriptDir}/mdn/database.json'); |
| 72 final mdn = JSON.parse(mdnFile.readAsTextSync()); | |
| 70 | 73 |
| 71 print('Cross-referencing dart:dom and dart:html...'); | 74 print('Cross-referencing dart:dom and dart:html...'); |
| 72 HtmlDiff.initialize(); | 75 HtmlDiff.initialize(); |
| 73 _diff = new HtmlDiff(); | 76 _diff = new HtmlDiff(); |
| 74 _diff.run(); | 77 _diff.run(); |
| 75 world.reset(); | 78 world.reset(); |
| 76 | 79 |
| 77 // Add all of the core libraries. | 80 // Add all of the core libraries. |
| 78 world.getOrAddLibrary('dart:core'); | 81 world.getOrAddLibrary('dart:core'); |
| 79 world.getOrAddLibrary('dart:coreimpl'); | 82 world.getOrAddLibrary('dart:coreimpl'); |
| (...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 434 return | 437 return |
| 435 ''' | 438 ''' |
| 436 <p class="correspond">This corresponds to $domTypesText in the | 439 <p class="correspond">This corresponds to $domTypesText in the |
| 437 ${a("dom.html", "dart:dom")} library.</p> | 440 ${a("dom.html", "dart:dom")} library.</p> |
| 438 '''; | 441 '''; |
| 439 } | 442 } |
| 440 | 443 |
| 441 return ''; | 444 return ''; |
| 442 } | 445 } |
| 443 } | 446 } |
| OLD | NEW |