| OLD | NEW |
| 1 // Copyright (c) 2015, the Fletch project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, the Fletch 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.md file. | 3 // BSD-style license that can be found in the LICENSE.md file. |
| 4 | 4 |
| 5 /// Tools for loading and parsing platform-configuration files. | 5 /// Tools for loading and parsing platform-configuration files. |
| 6 library plaform_configuration; | 6 library platform_configuration; |
| 7 | 7 |
| 8 import "dart:async"; | 8 import "dart:async"; |
| 9 | 9 |
| 10 import "package:charcode/ascii.dart"; | 10 import "package:charcode/ascii.dart"; |
| 11 | 11 |
| 12 import "../compiler_new.dart" as api; | 12 import "../compiler_new.dart" as api; |
| 13 | 13 |
| 14 /// Parses an Ini-like format. | 14 /// Parses an Ini-like format. |
| 15 /// | 15 /// |
| 16 /// Sections are initialized with a name enclosed in brackets. | 16 /// Sections are initialized with a name enclosed in brackets. |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 sections[librariesSection].forEach((String name, String value) { | 126 sections[librariesSection].forEach((String name, String value) { |
| 127 result[name] = baseLocation.resolve(value); | 127 result[name] = baseLocation.resolve(value); |
| 128 }); | 128 }); |
| 129 return result; | 129 return result; |
| 130 } | 130 } |
| 131 | 131 |
| 132 final Set<String> allowedSections = | 132 final Set<String> allowedSections = |
| 133 new Set.from([librariesSection, dartSpecSection, featuresSection]); | 133 new Set.from([librariesSection, dartSpecSection, featuresSection]); |
| 134 | 134 |
| 135 Future<Map<String, Uri>> load(Uri location, api.CompilerInput provider) { | 135 Future<Map<String, Uri>> load(Uri location, api.CompilerInput provider) { |
| 136 return provider.readFromUri(location).then((contents) { | 136 return provider |
| 137 if (contents is String) { | 137 .readFromUri(location, inputKind: api.InputKind.binary) |
| 138 contents = contents.codeUnits; | 138 .then((api.Input<List<int>> input) { |
| 139 } | |
| 140 return libraryMappings( | 139 return libraryMappings( |
| 141 parseIni(contents, | 140 parseIni(input.data, |
| 142 allowedSections: allowedSections, sourceUri: location), | 141 allowedSections: allowedSections, sourceUri: location), |
| 143 location); | 142 location); |
| 144 }); | 143 }); |
| 145 } | 144 } |
| OLD | NEW |