OLD | NEW |
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 import 'dart:io'; | 5 import 'dart:io'; |
6 | 6 |
7 import 'package:glob/glob.dart'; | 7 import 'package:glob/glob.dart'; |
8 import 'package:path/path.dart' as p; | 8 import 'package:path/path.dart' as p; |
9 import 'package:source_span/source_span.dart'; | 9 import 'package:source_span/source_span.dart'; |
10 import 'package:yaml/yaml.dart'; | 10 import 'package:yaml/yaml.dart'; |
11 | 11 |
| 12 import '../../backend/test_platform.dart'; |
| 13 import '../../frontend/timeout.dart'; |
12 import '../../utils.dart'; | 14 import '../../utils.dart'; |
13 import '../../frontend/timeout.dart'; | |
14 import '../../backend/test_platform.dart'; | |
15 import '../configuration.dart'; | 15 import '../configuration.dart'; |
16 import 'values.dart'; | 16 import 'values.dart'; |
17 | 17 |
18 /// Loads configuration information from a YAML file at [path]. | 18 /// Loads configuration information from a YAML file at [path]. |
19 /// | 19 /// |
20 /// Throws a [FormatException] if the configuration is invalid, and a | 20 /// Throws a [FormatException] if the configuration is invalid, and a |
21 /// [FileSystemException] if it can't be read. | 21 /// [FileSystemException] if it can't be read. |
22 Configuration load(String path) { | 22 Configuration load(String path) { |
23 var source = new File(path).readAsStringSync(); | 23 var source = new File(path).readAsStringSync(); |
24 var document = loadYamlNode(source, sourceUrl: p.toUri(path)); | 24 var document = loadYamlNode(source, sourceUrl: p.toUri(path)); |
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 if (!_document.containsKey(field)) return; | 257 if (!_document.containsKey(field)) return; |
258 _error("$field isn't supported here.", field); | 258 _error("$field isn't supported here.", field); |
259 } | 259 } |
260 | 260 |
261 /// Throws a [SourceSpanFormatException] with [message] about [field]. | 261 /// Throws a [SourceSpanFormatException] with [message] about [field]. |
262 void _error(String message, String field) { | 262 void _error(String message, String field) { |
263 throw new SourceSpanFormatException( | 263 throw new SourceSpanFormatException( |
264 message, _document.nodes[field].span, _source); | 264 message, _document.nodes[field].span, _source); |
265 } | 265 } |
266 } | 266 } |
OLD | NEW |