OLD | NEW |
1 /** | 1 /** |
2 * Read database.json, | 2 * Read database.json, |
3 * write database.filtered.json (with "best" entries) | 3 * write database.filtered.json (with "best" entries) |
4 * and obsolete.json (with entries marked obsolete). | 4 * and obsolete.json (with entries marked obsolete). |
5 */ | 5 */ |
6 | 6 |
7 #library("postProcess"); | 7 library postProcess; |
8 | 8 |
9 #import("dart:io"); | 9 import 'dart:io'; |
10 #import("dart:json"); | 10 import 'dart:json'; |
11 #import("util.dart"); | 11 import 'util.dart'; |
12 | 12 |
13 void main() { | 13 void main() { |
14 // Database of code documentation. | 14 // Database of code documentation. |
15 Map<String, List> database = JSON.parse( | 15 Map<String, List> database = JSON.parse( |
16 new File('output/database.json').readAsTextSync()); | 16 new File('output/database.json').readAsTextSync()); |
17 final filteredDb = {}; | 17 final filteredDb = {}; |
18 final obsolete = []; | 18 final obsolete = []; |
19 for (String type in database.keys) { | 19 for (String type in database.keys) { |
20 final entry = pickBestEntry(database[type], type); | 20 final entry = pickBestEntry(database[type], type); |
21 if (entry == null) { | 21 if (entry == null) { |
22 print("Can't find ${type} in database. Skipping."); | 22 print("Can't find ${type} in database. Skipping."); |
23 continue; | 23 continue; |
24 } | 24 } |
25 filteredDb[type] = entry; | 25 filteredDb[type] = entry; |
26 if (entry.containsKey("members")) { | 26 if (entry.containsKey("members")) { |
27 Map members = getMembersMap(entry); | 27 Map members = getMembersMap(entry); |
28 for (String name in members.keys) { | 28 for (String name in members.keys) { |
29 Map memberData = members[name]; | 29 Map memberData = members[name]; |
30 if (memberData['obsolete'] == true) { | 30 if (memberData['obsolete'] == true) { |
31 obsolete.add({'type': type, 'member' : name}); | 31 obsolete.add({'type': type, 'member' : name}); |
32 } | 32 } |
33 } | 33 } |
34 } | 34 } |
35 } | 35 } |
36 writeFileSync("output/database.filtered.json", JSON.stringify(filteredDb)); | 36 writeFileSync("output/database.filtered.json", JSON.stringify(filteredDb)); |
37 writeFileSync("output/obsolete.json", JSON.stringify(obsolete)); | 37 writeFileSync("output/obsolete.json", JSON.stringify(obsolete)); |
38 } | 38 } |
OLD | NEW |