| 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:async'; | 17 import 'dart:async'; |
| 18 import 'dart:convert'; |
| 18 import 'dart:io'; | 19 import 'dart:io'; |
| 19 import 'dart:json' as json; | |
| 20 | 20 |
| 21 import 'html_diff.dart'; | 21 import 'html_diff.dart'; |
| 22 | 22 |
| 23 // TODO(rnystrom): Use "package:" URL (#4968). | 23 // TODO(rnystrom): Use "package:" URL (#4968). |
| 24 import '../../sdk/lib/_internal/compiler/implementation/mirrors/mirrors.dart'; | 24 import '../../sdk/lib/_internal/compiler/implementation/mirrors/mirrors.dart'; |
| 25 import '../../sdk/lib/_internal/compiler/implementation/mirrors/mirrors_util.dar
t'; | 25 import '../../sdk/lib/_internal/compiler/implementation/mirrors/mirrors_util.dar
t'; |
| 26 import '../../sdk/lib/_internal/compiler/implementation/filenames.dart'; | 26 import '../../sdk/lib/_internal/compiler/implementation/filenames.dart'; |
| 27 import '../../sdk/lib/_internal/dartdoc/lib/dartdoc.dart'; | 27 import '../../sdk/lib/_internal/dartdoc/lib/dartdoc.dart'; |
| 28 import '../../sdk/lib/_internal/libraries.dart'; | 28 import '../../sdk/lib/_internal/libraries.dart'; |
| 29 import 'package:path/path.dart' as path; | 29 import 'package:path/path.dart' as path; |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 '..', '..', 'sdk', 'lib', '_internal', 'dartdoc', 'static'), | 105 '..', '..', 'sdk', 'lib', '_internal', 'dartdoc', 'static'), |
| 106 outputDir); | 106 outputDir); |
| 107 | 107 |
| 108 // The apidoc-specific static content. | 108 // The apidoc-specific static content. |
| 109 final copiedApiDocStatic = copyDirectory( | 109 final copiedApiDocStatic = copyDirectory( |
| 110 path.join(scriptDir, 'static'), | 110 path.join(scriptDir, 'static'), |
| 111 outputDir); | 111 outputDir); |
| 112 | 112 |
| 113 print('Parsing MDN data...'); | 113 print('Parsing MDN data...'); |
| 114 final mdnFile = new File(path.join(scriptDir, 'mdn', 'database.json')); | 114 final mdnFile = new File(path.join(scriptDir, 'mdn', 'database.json')); |
| 115 final mdn = json.parse(mdnFile.readAsStringSync()); | 115 final mdn = JSON.decode(mdnFile.readAsStringSync()); |
| 116 | 116 |
| 117 print('Cross-referencing dart:html...'); | 117 print('Cross-referencing dart:html...'); |
| 118 // TODO(amouravski): move HtmlDiff inside of the future chain below to re-use | 118 // TODO(amouravski): move HtmlDiff inside of the future chain below to re-use |
| 119 // the MirrorSystem already analyzed. | 119 // the MirrorSystem already analyzed. |
| 120 _diff = new HtmlDiff(printWarnings:false); | 120 _diff = new HtmlDiff(printWarnings:false); |
| 121 Future htmlDiff = _diff.run(currentDirectory.resolve(libPath)); | 121 Future htmlDiff = _diff.run(currentDirectory.resolve(libPath)); |
| 122 | 122 |
| 123 // TODO(johnniwinther): Libraries for the compilation seem to be more like | 123 // TODO(johnniwinther): Libraries for the compilation seem to be more like |
| 124 // URIs. Perhaps Path should have a toURI() method. | 124 // URIs. Perhaps Path should have a toURI() method. |
| 125 // Add all of the core libraries. | 125 // Add all of the core libraries. |
| (...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 472 var memberName = '$typeName.${member.simpleName}'; | 472 var memberName = '$typeName.${member.simpleName}'; |
| 473 if (member is MethodMirror && member.isConstructor) { | 473 if (member is MethodMirror && member.isConstructor) { |
| 474 final separator = member.constructorName == '' ? '' : '.'; | 474 final separator = member.constructorName == '' ? '' : '.'; |
| 475 memberName = 'new $typeName$separator${member.constructorName}'; | 475 memberName = 'new $typeName$separator${member.constructorName}'; |
| 476 } | 476 } |
| 477 | 477 |
| 478 return a(memberUrl(member), memberName); | 478 return a(memberUrl(member), memberName); |
| 479 } | 479 } |
| 480 } | 480 } |
| 481 | 481 |
| OLD | NEW |