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

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

Issue 184693004: pkg/docgen: sort items in index.txt (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 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 | « no previous file | pkg/docgen/test/generate_json_test.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 /// **docgen** is a tool for creating machine readable representations of Dart 5 /// **docgen** is a tool for creating machine readable representations of Dart
6 /// code metadata, including: classes, members, comments and annotations. 6 /// code metadata, including: classes, members, comments and annotations.
7 /// 7 ///
8 /// docgen is run on a `.dart` file or a directory containing `.dart` files. 8 /// docgen is run on a `.dart` file or a directory containing `.dart` files.
9 /// 9 ///
10 /// $ dart docgen.dart [OPTIONS] [FILE/DIR] 10 /// $ dart docgen.dart [OPTIONS] [FILE/DIR]
(...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after
437 437
438 _writeToFile(JSON.encode(libraryMap), 'library_list.json'); 438 _writeToFile(JSON.encode(libraryMap), 'library_list.json');
439 439
440 // Output libraries and classes to file after all information is generated. 440 // Output libraries and classes to file after all information is generated.
441 filteredEntities.where((e) => e is Class || e is Library).forEach((output) { 441 filteredEntities.where((e) => e is Class || e is Library).forEach((output) {
442 _writeIndexableToFile(output, outputToYaml); 442 _writeIndexableToFile(output, outputToYaml);
443 }); 443 });
444 444
445 // Outputs all the qualified names documented with their type. 445 // Outputs all the qualified names documented with their type.
446 // This will help generate search results. 446 // This will help generate search results.
447 _writeToFile(filteredEntities.map((e) => 447 var sortedEntities = filteredEntities.map((e) =>
448 '${e.qualifiedName} ${e.typeName}').join('\n') + '\n', 448 '${e.qualifiedName} ${e.typeName}').toList()..sort();
449
450 _writeToFile(sortedEntities.join('\n') + '\n',
449 'index.txt', append: append); 451 'index.txt', append: append);
450 var index = new Map.fromIterables( 452 var index = new Map.fromIterables(
451 filteredEntities.map((e) => e.qualifiedName), 453 filteredEntities.map((e) => e.qualifiedName),
452 filteredEntities.map((e) => e.typeName)); 454 filteredEntities.map((e) => e.typeName));
453 if (append) { 455 if (append) {
454 var previousIndex = 456 var previousIndex =
455 JSON.decode(new File( 457 JSON.decode(new File(
456 '$_outputDirectory/index.json').readAsStringSync()); 458 '$_outputDirectory/index.json').readAsStringSync());
457 index.addAll(previousIndex); 459 index.addAll(previousIndex);
458 } 460 }
(...skipping 1802 matching lines...) Expand 10 before | Expand all | Expand 10 after
2261 .map((e) => originalMirror.getField(e.simpleName).reflectee) 2263 .map((e) => originalMirror.getField(e.simpleName).reflectee)
2262 .where((e) => e != null) 2264 .where((e) => e != null)
2263 .toList(); 2265 .toList();
2264 } 2266 }
2265 2267
2266 Map toMap() => { 2268 Map toMap() => {
2267 'name': Indexable.getDocgenObject(mirror, owningLibrary).docName, 2269 'name': Indexable.getDocgenObject(mirror, owningLibrary).docName,
2268 'parameters': parameters 2270 'parameters': parameters
2269 }; 2271 };
2270 } 2272 }
OLDNEW
« no previous file with comments | « no previous file | pkg/docgen/test/generate_json_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698