OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 library googleapis_generator.package_configuration; | 5 library googleapis_generator.package_configuration; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 import 'dart:io'; | 8 import 'dart:io'; |
9 | 9 |
10 import 'package:discoveryapis_generator/discoveryapis_generator.dart'; | 10 import 'package:discoveryapis_generator/discoveryapis_generator.dart'; |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 _initialize(allApis); | 97 _initialize(allApis); |
98 | 98 |
99 // Download the discovery documents for the packages to build | 99 // Download the discovery documents for the packages to build |
100 // (only the APIs we're interested in). | 100 // (only the APIs we're interested in). |
101 var futures = []; | 101 var futures = []; |
102 packages.forEach((name, package) { | 102 packages.forEach((name, package) { |
103 futures.add(downloadDiscoveryDocuments('$discoveryDocsDir/$name', | 103 futures.add(downloadDiscoveryDocuments('$discoveryDocsDir/$name', |
104 ids: package.apis)); | 104 ids: package.apis)); |
105 }); | 105 }); |
106 | 106 |
107 return Future.wait(futures).then((List<List<RestDescription>> results) { | 107 return Future.wait(futures); |
108 _initialize(results.expand((result) => result).toList()); | |
109 }); | |
110 } | 108 } |
111 | 109 |
112 /** | 110 /** |
113 * Generate packages from the configuration. | 111 * Generate packages from the configuration. |
114 * | 112 * |
115 * [discoveryDocsDir] is the directory where all the downloaded discovery | 113 * [discoveryDocsDir] is the directory where all the downloaded discovery |
116 * documents are stored. | 114 * documents are stored. |
117 * | 115 * |
118 * [generatedApisDir] is the directory where the packages are generated. | 116 * [generatedApisDir] is the directory where the packages are generated. |
119 * Each package is generated in a sub-directory. | 117 * Each package is generated in a sub-directory. |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
297 /// The excess APIs are the APIs mentioned in the configuration but not | 295 /// The excess APIs are the APIs mentioned in the configuration but not |
298 /// returned from the Discovery Service. | 296 /// returned from the Discovery Service. |
299 static Iterable<String> _calculateExcessApis( | 297 static Iterable<String> _calculateExcessApis( |
300 Iterable<String> knownApis, List<RestDescription> allApis) { | 298 Iterable<String> knownApis, List<RestDescription> allApis) { |
301 var excessApis = new Set.from(knownApis); | 299 var excessApis = new Set.from(knownApis); |
302 allApis.forEach((item) => excessApis.remove(item.id)); | 300 allApis.forEach((item) => excessApis.remove(item.id)); |
303 return excessApis; | 301 return excessApis; |
304 } | 302 } |
305 } | 303 } |
306 | 304 |
OLD | NEW |