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:args/args.dart'; | 7 import 'package:args/args.dart'; |
8 import 'package:boolean_selector/boolean_selector.dart'; | 8 import 'package:boolean_selector/boolean_selector.dart'; |
9 | 9 |
10 import '../../backend/test_platform.dart'; | 10 import '../../backend/test_platform.dart'; |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 parser.addOption("dart2js-args", | 111 parser.addOption("dart2js-args", |
112 help: 'Extra arguments to pass to dart2js.', | 112 help: 'Extra arguments to pass to dart2js.', |
113 allowMultiple: true, hide: true); | 113 allowMultiple: true, hide: true); |
114 parser.addOption("total-shards", | 114 parser.addOption("total-shards", |
115 help: 'The total number of invocations of the test runner being run.', | 115 help: 'The total number of invocations of the test runner being run.', |
116 hide: true); | 116 hide: true); |
117 parser.addOption("shard-index", | 117 parser.addOption("shard-index", |
118 help: 'The index of this test runner invocation (of --total-shards).', | 118 help: 'The index of this test runner invocation (of --total-shards).', |
119 hide: true); | 119 hide: true); |
120 | 120 |
| 121 // If we're running test/dir/my_test.dart, we'll look for |
| 122 // test/dir/my_test.dart.browser_test.dart.js in the precompiled directory. |
| 123 parser.addOption("precompiled", |
| 124 help: 'The path to a mirror of the package directory containing ' |
| 125 'precompiled JS.', |
| 126 hide: true); |
| 127 |
121 return parser; | 128 return parser; |
122 })(); | 129 })(); |
123 | 130 |
124 /// The usage string for the command-line arguments. | 131 /// The usage string for the command-line arguments. |
125 String get usage => _parser.usage; | 132 String get usage => _parser.usage; |
126 | 133 |
127 /// Parses the configuration from [args]. | 134 /// Parses the configuration from [args]. |
128 /// | 135 /// |
129 /// Throws a [FormatException] if [args] are invalid. | 136 /// Throws a [FormatException] if [args] are invalid. |
130 Configuration parse(List<String> args) => new _Parser(args).parse(); | 137 Configuration parse(List<String> args) => new _Parser(args).parse(); |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 return new Configuration( | 186 return new Configuration( |
180 help: _ifParsed('help'), | 187 help: _ifParsed('help'), |
181 version: _ifParsed('version'), | 188 version: _ifParsed('version'), |
182 verboseTrace: _ifParsed('verbose-trace'), | 189 verboseTrace: _ifParsed('verbose-trace'), |
183 jsTrace: _ifParsed('js-trace'), | 190 jsTrace: _ifParsed('js-trace'), |
184 pauseAfterLoad: _ifParsed('pause-after-load'), | 191 pauseAfterLoad: _ifParsed('pause-after-load'), |
185 color: _ifParsed('color'), | 192 color: _ifParsed('color'), |
186 packageRoot: _ifParsed('package-root'), | 193 packageRoot: _ifParsed('package-root'), |
187 dart2jsPath: _ifParsed('dart2js-path'), | 194 dart2jsPath: _ifParsed('dart2js-path'), |
188 dart2jsArgs: _ifParsed('dart2js-args') as List<String>, | 195 dart2jsArgs: _ifParsed('dart2js-args') as List<String>, |
| 196 precompiledPath: _ifParsed('precompiled'), |
189 reporter: _ifParsed('reporter'), | 197 reporter: _ifParsed('reporter'), |
190 pubServePort: _parseOption('pub-serve', int.parse), | 198 pubServePort: _parseOption('pub-serve', int.parse), |
191 concurrency: _parseOption('concurrency', int.parse), | 199 concurrency: _parseOption('concurrency', int.parse), |
192 shardIndex: shardIndex, | 200 shardIndex: shardIndex, |
193 totalShards: totalShards, | 201 totalShards: totalShards, |
194 timeout: _parseOption('timeout', (value) => new Timeout.parse(value)), | 202 timeout: _parseOption('timeout', (value) => new Timeout.parse(value)), |
195 patterns: patterns, | 203 patterns: patterns, |
196 platforms: (_ifParsed('platform') as List<String>) | 204 platforms: (_ifParsed('platform') as List<String>) |
197 ?.map(TestPlatform.find), | 205 ?.map(TestPlatform.find), |
198 chosenPresets: _ifParsed('preset') as List<String>, | 206 chosenPresets: _ifParsed('preset') as List<String>, |
(...skipping 24 matching lines...) Expand all Loading... |
223 /// information. | 231 /// information. |
224 /*=T*/ _wrapFormatException/*<T>*/(String name, /*=T*/ parse()) { | 232 /*=T*/ _wrapFormatException/*<T>*/(String name, /*=T*/ parse()) { |
225 try { | 233 try { |
226 return parse(); | 234 return parse(); |
227 } on FormatException catch (error) { | 235 } on FormatException catch (error) { |
228 throw new FormatException('Couldn\'t parse --$name "${_options[name]}": ' | 236 throw new FormatException('Couldn\'t parse --$name "${_options[name]}": ' |
229 '${error.message}'); | 237 '${error.message}'); |
230 } | 238 } |
231 } | 239 } |
232 } | 240 } |
OLD | NEW |