| 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:boolean_selector/boolean_selector.dart'; | 7 import 'package:boolean_selector/boolean_selector.dart'; |
| 8 import 'package:glob/glob.dart'; | 8 import 'package:glob/glob.dart'; |
| 9 import 'package:path/path.dart' as p; | 9 import 'package:path/path.dart' as p; |
| 10 import 'package:source_span/source_span.dart'; | 10 import 'package:source_span/source_span.dart'; |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 var osConfig = onOS[currentOS]; | 121 var osConfig = onOS[currentOS]; |
| 122 return osConfig == null ? config : config.merge(osConfig); | 122 return osConfig == null ? config : config.merge(osConfig); |
| 123 } | 123 } |
| 124 | 124 |
| 125 /// Loads runner configuration (but not test configuration). | 125 /// Loads runner configuration (but not test configuration). |
| 126 /// | 126 /// |
| 127 /// If [_runnerConfig] is `false`, this will error if there are any | 127 /// If [_runnerConfig] is `false`, this will error if there are any |
| 128 /// runner-level configuration fields. | 128 /// runner-level configuration fields. |
| 129 Configuration _loadRunnerConfig() { | 129 Configuration _loadRunnerConfig() { |
| 130 if (!_runnerConfig) { | 130 if (!_runnerConfig) { |
| 131 _disallow("pause_after_load"); |
| 131 _disallow("reporter"); | 132 _disallow("reporter"); |
| 132 _disallow("pub_serve"); | 133 _disallow("pub_serve"); |
| 133 _disallow("concurrency"); | 134 _disallow("concurrency"); |
| 134 _disallow("platforms"); | 135 _disallow("platforms"); |
| 135 _disallow("paths"); | 136 _disallow("paths"); |
| 136 _disallow("filename"); | 137 _disallow("filename"); |
| 137 _disallow("add_presets"); | 138 _disallow("add_presets"); |
| 138 _disallow("include_tags"); | 139 _disallow("include_tags"); |
| 139 _disallow("exclude_tags"); | 140 _disallow("exclude_tags"); |
| 140 return Configuration.empty; | 141 return Configuration.empty; |
| 141 } | 142 } |
| 142 | 143 |
| 144 var pauseAfterLoad = _getBool("pause_after_load"); |
| 145 |
| 143 var reporter = _getString("reporter"); | 146 var reporter = _getString("reporter"); |
| 144 if (reporter != null && !allReporters.contains(reporter)) { | 147 if (reporter != null && !allReporters.contains(reporter)) { |
| 145 _error('Unknown reporter "$reporter".', "reporter"); | 148 _error('Unknown reporter "$reporter".', "reporter"); |
| 146 } | 149 } |
| 147 | 150 |
| 148 var pubServePort = _getInt("pub_serve"); | 151 var pubServePort = _getInt("pub_serve"); |
| 149 var concurrency = _getInt("concurrency"); | 152 var concurrency = _getInt("concurrency"); |
| 150 | 153 |
| 151 var patterns = _getList("names", (nameNode) { | 154 var patterns = _getList("names", (nameNode) { |
| 152 _validate(nameNode, "Names must be strings.", (value) => value is String); | 155 _validate(nameNode, "Names must be strings.", (value) => value is String); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 176 | 179 |
| 177 var filename = _parseValue("filename", (value) => new Glob(value)); | 180 var filename = _parseValue("filename", (value) => new Glob(value)); |
| 178 | 181 |
| 179 var chosenPresets = _getList("add_presets", | 182 var chosenPresets = _getList("add_presets", |
| 180 (presetNode) => _parseIdentifierLike(presetNode, "Preset name")); | 183 (presetNode) => _parseIdentifierLike(presetNode, "Preset name")); |
| 181 | 184 |
| 182 var includeTags = _parseBooleanSelector("include_tags"); | 185 var includeTags = _parseBooleanSelector("include_tags"); |
| 183 var excludeTags = _parseBooleanSelector("exclude_tags"); | 186 var excludeTags = _parseBooleanSelector("exclude_tags"); |
| 184 | 187 |
| 185 return new Configuration( | 188 return new Configuration( |
| 189 pauseAfterLoad: pauseAfterLoad, |
| 186 reporter: reporter, | 190 reporter: reporter, |
| 187 pubServePort: pubServePort, | 191 pubServePort: pubServePort, |
| 188 concurrency: concurrency, | 192 concurrency: concurrency, |
| 189 patterns: patterns, | 193 patterns: patterns, |
| 190 platforms: platforms, | 194 platforms: platforms, |
| 191 paths: paths, | 195 paths: paths, |
| 192 filename: filename, | 196 filename: filename, |
| 193 chosenPresets: chosenPresets, | 197 chosenPresets: chosenPresets, |
| 194 includeTags: includeTags, | 198 includeTags: includeTags, |
| 195 excludeTags: excludeTags); | 199 excludeTags: excludeTags); |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 335 if (!_document.containsKey(field)) return; | 339 if (!_document.containsKey(field)) return; |
| 336 _error("$field isn't supported here.", field); | 340 _error("$field isn't supported here.", field); |
| 337 } | 341 } |
| 338 | 342 |
| 339 /// Throws a [SourceSpanFormatException] with [message] about [field]. | 343 /// Throws a [SourceSpanFormatException] with [message] about [field]. |
| 340 void _error(String message, String field) { | 344 void _error(String message, String field) { |
| 341 throw new SourceSpanFormatException( | 345 throw new SourceSpanFormatException( |
| 342 message, _document.nodes[field].span, _source); | 346 message, _document.nodes[field].span, _source); |
| 343 } | 347 } |
| 344 } | 348 } |
| OLD | NEW |