OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 /** | 5 /** |
6 * Classes and methods for enumerating and preparing tests. | 6 * Classes and methods for enumerating and preparing tests. |
7 * | 7 * |
8 * This library includes: | 8 * This library includes: |
9 * | 9 * |
10 * - Creating tests by listing all the Dart files in certain directories, | 10 * - Creating tests by listing all the Dart files in certain directories, |
(...skipping 2215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2226 static Path absolutePath(Path path) { | 2226 static Path absolutePath(Path path) { |
2227 if (!path.isAbsolute) { | 2227 if (!path.isAbsolute) { |
2228 return currentWorkingDirectory.join(path); | 2228 return currentWorkingDirectory.join(path); |
2229 } | 2229 } |
2230 return path; | 2230 return path; |
2231 } | 2231 } |
2232 | 2232 |
2233 static String outputDir(Map configuration) { | 2233 static String outputDir(Map configuration) { |
2234 var result = ''; | 2234 var result = ''; |
2235 var system = configuration['system']; | 2235 var system = configuration['system']; |
2236 if (system == 'linux') { | 2236 if (system == 'linux' || system == 'android') { |
2237 result = 'out/'; | 2237 result = 'out/'; |
2238 } else if (system == 'macos') { | 2238 } else if (system == 'macos') { |
2239 result = 'xcodebuild/'; | 2239 result = 'xcodebuild/'; |
2240 } else if (system == 'windows') { | 2240 } else if (system == 'windows') { |
2241 result = 'build/'; | 2241 result = 'build/'; |
| 2242 } else { |
| 2243 throw new Exception('Unknown operating system: "$system"'); |
2242 } | 2244 } |
2243 return result; | 2245 return result; |
2244 } | 2246 } |
2245 | 2247 |
2246 static List<String> standardOptions(Map configuration) { | 2248 static List<String> standardOptions(Map configuration) { |
2247 List args = ["--ignore-unrecognized-flags"]; | 2249 List args = ["--ignore-unrecognized-flags"]; |
2248 String compiler = configuration["compiler"]; | 2250 String compiler = configuration["compiler"]; |
2249 if (compiler == "dart2js") { | 2251 if (compiler == "dart2js") { |
2250 args = ['--generate-code-with-compile-time-errors', '--test-mode']; | 2252 args = ['--generate-code-with-compile-time-errors', '--test-mode']; |
2251 if (configuration["checked"]) { | 2253 if (configuration["checked"]) { |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2328 break; | 2330 break; |
2329 case 'release': | 2331 case 'release': |
2330 mode = 'Release'; | 2332 mode = 'Release'; |
2331 break; | 2333 break; |
2332 case 'product': | 2334 case 'product': |
2333 mode = 'Product'; | 2335 mode = 'Product'; |
2334 break; | 2336 break; |
2335 default: | 2337 default: |
2336 throw 'Unrecognized mode configuration: ${configuration['mode']}'; | 2338 throw 'Unrecognized mode configuration: ${configuration['mode']}'; |
2337 } | 2339 } |
| 2340 var os; |
| 2341 switch (configuration['system']) { |
| 2342 case 'android': |
| 2343 os = 'Android'; |
| 2344 break; |
| 2345 case 'linux': |
| 2346 case 'macos': |
| 2347 case 'windows': |
| 2348 os = ''; |
| 2349 break; |
| 2350 default: |
| 2351 throw 'Unrecognized operating system: ${configuration['system']}'; |
| 2352 } |
2338 var arch = configuration['arch'].toUpperCase(); | 2353 var arch = configuration['arch'].toUpperCase(); |
2339 var normal = '$mode$arch'; | 2354 var normal = '$mode$os$arch'; |
2340 var cross = '${mode}X$arch'; | 2355 var cross = '$mode${os}X$arch'; |
2341 var outDir = outputDir(configuration); | 2356 var outDir = outputDir(configuration); |
2342 var normalDir = new Directory(new Path('$outDir$normal').toNativePath()); | 2357 var normalDir = new Directory(new Path('$outDir$normal').toNativePath()); |
2343 var crossDir = new Directory(new Path('$outDir$cross').toNativePath()); | 2358 var crossDir = new Directory(new Path('$outDir$cross').toNativePath()); |
2344 if (normalDir.existsSync() && crossDir.existsSync()) { | 2359 if (normalDir.existsSync() && crossDir.existsSync()) { |
2345 throw "You can't have both $normalDir and $crossDir, we don't know which" | 2360 throw "You can't have both $normalDir and $crossDir, we don't know which" |
2346 " binary to use"; | 2361 " binary to use"; |
2347 } | 2362 } |
2348 if (crossDir.existsSync()) { | 2363 if (crossDir.existsSync()) { |
2349 return cross; | 2364 return cross; |
2350 } | 2365 } |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2437 for (var key in PATH_REPLACEMENTS.keys) { | 2452 for (var key in PATH_REPLACEMENTS.keys) { |
2438 if (path.startsWith(key)) { | 2453 if (path.startsWith(key)) { |
2439 path = path.replaceFirst(key, PATH_REPLACEMENTS[key]); | 2454 path = path.replaceFirst(key, PATH_REPLACEMENTS[key]); |
2440 break; | 2455 break; |
2441 } | 2456 } |
2442 } | 2457 } |
2443 } | 2458 } |
2444 return path; | 2459 return path; |
2445 } | 2460 } |
2446 } | 2461 } |
OLD | NEW |