OLD | NEW |
1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2017, 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:async'; | 5 import 'dart:async'; |
6 import 'dart:convert'; | 6 import 'dart:convert'; |
7 import 'dart:io'; | 7 import 'dart:io'; |
8 | 8 |
9 import 'compiler_configuration.dart'; | 9 import 'compiler_configuration.dart'; |
10 import 'http_server.dart'; | 10 import 'http_server.dart'; |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 this.resetBrowser, | 45 this.resetBrowser, |
46 this.skipCompilation, | 46 this.skipCompilation, |
47 this.useBlobs, | 47 this.useBlobs, |
48 this.useSdk, | 48 this.useSdk, |
49 this.useFastStartup, | 49 this.useFastStartup, |
50 this.useEnableAsserts, | 50 this.useEnableAsserts, |
51 this.useDart2JSWithKernel, | 51 this.useDart2JSWithKernel, |
52 this.writeDebugLog, | 52 this.writeDebugLog, |
53 this.writeTestOutcomeLog, | 53 this.writeTestOutcomeLog, |
54 this.drtPath, | 54 this.drtPath, |
55 this.dartiumPath, | |
56 this.chromePath, | 55 this.chromePath, |
57 this.safariPath, | 56 this.safariPath, |
58 this.firefoxPath, | 57 this.firefoxPath, |
59 this.dartPath, | 58 this.dartPath, |
60 this.dartPrecompiledPath, | 59 this.dartPrecompiledPath, |
61 this.flutterPath, | 60 this.flutterPath, |
62 this.taskCount, | 61 this.taskCount, |
63 int timeout, | 62 int timeout, |
64 this.shardCount, | 63 this.shardCount, |
65 this.shard, | 64 this.shard, |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 final bool useSdk; | 110 final bool useSdk; |
112 final bool useFastStartup; | 111 final bool useFastStartup; |
113 final bool useEnableAsserts; | 112 final bool useEnableAsserts; |
114 final bool useDart2JSWithKernel; | 113 final bool useDart2JSWithKernel; |
115 final bool writeDebugLog; | 114 final bool writeDebugLog; |
116 final bool writeTestOutcomeLog; | 115 final bool writeTestOutcomeLog; |
117 | 116 |
118 // Various file paths. | 117 // Various file paths. |
119 | 118 |
120 final String drtPath; | 119 final String drtPath; |
121 final String dartiumPath; | |
122 final String chromePath; | 120 final String chromePath; |
123 final String safariPath; | 121 final String safariPath; |
124 final String firefoxPath; | 122 final String firefoxPath; |
125 final String dartPath; | 123 final String dartPath; |
126 final String dartPrecompiledPath; | 124 final String dartPrecompiledPath; |
127 final String flutterPath; | 125 final String flutterPath; |
128 | 126 |
129 final int taskCount; | 127 final int taskCount; |
130 final int shardCount; | 128 final int shardCount; |
131 final int shard; | 129 final int shard; |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
246 } | 244 } |
247 | 245 |
248 /// Gets the local file path to the browser executable for this configuration. | 246 /// Gets the local file path to the browser executable for this configuration. |
249 String get browserLocation { | 247 String get browserLocation { |
250 // If the user has explicitly configured a browser path, use it. | 248 // If the user has explicitly configured a browser path, use it. |
251 String location; | 249 String location; |
252 switch (runtime) { | 250 switch (runtime) { |
253 case Runtime.chrome: | 251 case Runtime.chrome: |
254 location = chromePath; | 252 location = chromePath; |
255 break; | 253 break; |
256 case Runtime.dartium: | |
257 location = dartiumPath; | |
258 break; | |
259 case Runtime.drt: | 254 case Runtime.drt: |
260 location = drtPath; | 255 location = drtPath; |
261 break; | 256 break; |
262 case Runtime.firefox: | 257 case Runtime.firefox: |
263 location = firefoxPath; | 258 location = firefoxPath; |
264 break; | 259 break; |
265 case Runtime.flutter: | 260 case Runtime.flutter: |
266 location = flutterPath; | 261 location = flutterPath; |
267 break; | 262 break; |
268 case Runtime.safari: | 263 case Runtime.safari: |
269 location = safariPath; | 264 location = safariPath; |
270 break; | 265 break; |
271 } | 266 } |
272 | 267 |
273 if (location != null) return location; | 268 if (location != null) return location; |
274 | 269 |
275 const locations = const { | 270 const locations = const { |
276 Runtime.firefox: const { | 271 Runtime.firefox: const { |
277 System.windows: 'C:\\Program Files (x86)\\Mozilla Firefox\\firefox.exe', | 272 System.windows: 'C:\\Program Files (x86)\\Mozilla Firefox\\firefox.exe', |
278 System.linux: 'firefox', | 273 System.linux: 'firefox', |
279 System.macos: '/Applications/Firefox.app/Contents/MacOS/firefox' | 274 System.macos: '/Applications/Firefox.app/Contents/MacOS/firefox' |
280 }, | 275 }, |
281 Runtime.chrome: const { | 276 Runtime.chrome: const { |
282 System.windows: | 277 System.windows: |
283 'C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe', | 278 'C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe', |
284 System.macos: | 279 System.macos: |
285 '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome', | 280 '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome', |
286 System.linux: 'google-chrome' | 281 System.linux: 'google-chrome' |
287 }, | 282 }, |
288 Runtime.dartium: const { | |
289 System.windows: 'client\\tests\\dartium\\chrome.exe', | |
290 System.macos: | |
291 'client/tests/dartium/Chromium.app/Contents/MacOS/Chromium', | |
292 System.linux: 'client/tests/dartium/chrome' | |
293 }, | |
294 Runtime.safari: const { | 283 Runtime.safari: const { |
295 System.macos: '/Applications/Safari.app/Contents/MacOS/Safari' | 284 System.macos: '/Applications/Safari.app/Contents/MacOS/Safari' |
296 }, | 285 }, |
297 Runtime.safariMobileSim: const { | 286 Runtime.safariMobileSim: const { |
298 System.macos: '/Applications/Xcode.app/Contents/Developer/Platforms/' | 287 System.macos: '/Applications/Xcode.app/Contents/Developer/Platforms/' |
299 'iPhoneSimulator.platform/Developer/Applications/' | 288 'iPhoneSimulator.platform/Developer/Applications/' |
300 'iPhone Simulator.app/Contents/MacOS/iPhone Simulator' | 289 'iPhone Simulator.app/Contents/MacOS/iPhone Simulator' |
301 }, | 290 }, |
302 Runtime.ie9: const { | 291 Runtime.ie9: const { |
303 System.windows: 'C:\\Program Files\\Internet Explorer\\iexplore.exe' | 292 System.windows: 'C:\\Program Files\\Internet Explorer\\iexplore.exe' |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
397 return future; | 386 return future; |
398 } | 387 } |
399 | 388 |
400 void stopServers() { | 389 void stopServers() { |
401 if (_servers != null) _servers.stopServers(); | 390 if (_servers != null) _servers.stopServers(); |
402 } | 391 } |
403 | 392 |
404 /// Returns the correct configuration directory (the last component of the | 393 /// Returns the correct configuration directory (the last component of the |
405 /// output directory path) for regular dart checkouts. | 394 /// output directory path) for regular dart checkouts. |
406 /// | 395 /// |
407 /// Dartium checkouts use the `--build-directory` option to pass in the | 396 /// We allow our code to have been cross compiled, i.e., that there is an X |
408 /// correct build directory explicitly. We allow our code to have been cross | 397 /// in front of the arch. We don't allow both a cross compiled and a normal |
409 /// compiled, i.e., that there is an X in front of the arch. We don't allow | 398 /// version to be present (except if you specifically pass in the |
410 /// both a cross compiled and a normal version to be present (except if you | 399 /// build_directory). |
411 /// specifically pass in the build_directory). | |
412 String _calculateDirectory() { | 400 String _calculateDirectory() { |
413 // Capitalize the mode name. | 401 // Capitalize the mode name. |
414 var modeName = | 402 var modeName = |
415 mode.name.substring(0, 1).toUpperCase() + mode.name.substring(1); | 403 mode.name.substring(0, 1).toUpperCase() + mode.name.substring(1); |
416 | 404 |
417 var os = ''; | 405 var os = ''; |
418 if (system == System.android) os = "Android"; | 406 if (system == System.android) os = "Android"; |
419 | 407 |
420 var arch = architecture.name.toUpperCase(); | 408 var arch = architecture.name.toUpperCase(); |
421 var normal = '$modeName$os$arch'; | 409 var normal = '$modeName$os$arch'; |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
520 case Compiler.dart2js: | 508 case Compiler.dart2js: |
521 // Note: by adding 'none' as a configuration, if the user | 509 // Note: by adding 'none' as a configuration, if the user |
522 // runs test.py -c dart2js -r drt,none the dart2js_none and | 510 // runs test.py -c dart2js -r drt,none the dart2js_none and |
523 // dart2js_drt will be duplicating work. If later we don't need 'none' | 511 // dart2js_drt will be duplicating work. If later we don't need 'none' |
524 // with dart2js, we should remove it from here. | 512 // with dart2js, we should remove it from here. |
525 return const [ | 513 return const [ |
526 Runtime.d8, | 514 Runtime.d8, |
527 Runtime.jsshell, | 515 Runtime.jsshell, |
528 Runtime.drt, | 516 Runtime.drt, |
529 Runtime.none, | 517 Runtime.none, |
530 Runtime.dartium, | |
531 Runtime.firefox, | 518 Runtime.firefox, |
532 Runtime.chrome, | 519 Runtime.chrome, |
533 Runtime.safari, | 520 Runtime.safari, |
534 Runtime.ie9, | 521 Runtime.ie9, |
535 Runtime.ie10, | 522 Runtime.ie10, |
536 Runtime.ie11, | 523 Runtime.ie11, |
537 Runtime.opera, | 524 Runtime.opera, |
538 Runtime.chromeOnAndroid, | 525 Runtime.chromeOnAndroid, |
539 Runtime.safariMobileSim | 526 Runtime.safariMobileSim |
540 ]; | 527 ]; |
(...skipping 14 matching lines...) Expand all Loading... |
555 case Compiler.dartk: | 542 case Compiler.dartk: |
556 return const [Runtime.vm, Runtime.selfCheck]; | 543 return const [Runtime.vm, Runtime.selfCheck]; |
557 case Compiler.precompiler: | 544 case Compiler.precompiler: |
558 case Compiler.dartkp: | 545 case Compiler.dartkp: |
559 return const [Runtime.dartPrecompiled]; | 546 return const [Runtime.dartPrecompiled]; |
560 case Compiler.none: | 547 case Compiler.none: |
561 return const [ | 548 return const [ |
562 Runtime.vm, | 549 Runtime.vm, |
563 Runtime.flutter, | 550 Runtime.flutter, |
564 Runtime.drt, | 551 Runtime.drt, |
565 Runtime.dartium, | 552 Runtime.contentShellOnAndroid |
566 Runtime.contentShellOnAndroid, | |
567 Runtime.dartiumOnAndroid | |
568 ]; | 553 ]; |
569 } | 554 } |
570 | 555 |
571 throw "unreachable"; | 556 throw "unreachable"; |
572 } | 557 } |
573 | 558 |
574 String toString() => "Compiler($name)"; | 559 String toString() => "Compiler($name)"; |
575 } | 560 } |
576 | 561 |
577 class Mode { | 562 class Mode { |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
631 String toString() => "Progress($name)"; | 616 String toString() => "Progress($name)"; |
632 } | 617 } |
633 | 618 |
634 class Runtime { | 619 class Runtime { |
635 static const vm = const Runtime._('vm'); | 620 static const vm = const Runtime._('vm'); |
636 static const flutter = const Runtime._('flutter'); | 621 static const flutter = const Runtime._('flutter'); |
637 static const dartPrecompiled = const Runtime._('dart_precompiled'); | 622 static const dartPrecompiled = const Runtime._('dart_precompiled'); |
638 static const d8 = const Runtime._('d8'); | 623 static const d8 = const Runtime._('d8'); |
639 static const jsshell = const Runtime._('jsshell'); | 624 static const jsshell = const Runtime._('jsshell'); |
640 static const drt = const Runtime._('drt'); | 625 static const drt = const Runtime._('drt'); |
641 static const dartium = const Runtime._('dartium'); | |
642 static const firefox = const Runtime._('firefox'); | 626 static const firefox = const Runtime._('firefox'); |
643 static const chrome = const Runtime._('chrome'); | 627 static const chrome = const Runtime._('chrome'); |
644 static const safari = const Runtime._('safari'); | 628 static const safari = const Runtime._('safari'); |
645 static const ie9 = const Runtime._('ie9'); | 629 static const ie9 = const Runtime._('ie9'); |
646 static const ie10 = const Runtime._('ie10'); | 630 static const ie10 = const Runtime._('ie10'); |
647 static const ie11 = const Runtime._('ie11'); | 631 static const ie11 = const Runtime._('ie11'); |
648 static const opera = const Runtime._('opera'); | 632 static const opera = const Runtime._('opera'); |
649 static const chromeOnAndroid = const Runtime._('chromeOnAndroid'); | 633 static const chromeOnAndroid = const Runtime._('chromeOnAndroid'); |
650 static const safariMobileSim = const Runtime._('safarimobilesim'); | 634 static const safariMobileSim = const Runtime._('safarimobilesim'); |
651 static const contentShellOnAndroid = const Runtime._('ContentShellOnAndroid'); | 635 static const contentShellOnAndroid = const Runtime._('ContentShellOnAndroid'); |
652 static const dartiumOnAndroid = const Runtime._('DartiumOnAndroid'); | |
653 static const selfCheck = const Runtime._('self_check'); | 636 static const selfCheck = const Runtime._('self_check'); |
654 static const none = const Runtime._('none'); | 637 static const none = const Runtime._('none'); |
655 | 638 |
656 static final List<String> names = _all.keys.toList()..add("ff"); | 639 static final List<String> names = _all.keys.toList()..add("ff"); |
657 | 640 |
658 static final _all = new Map<String, Runtime>.fromIterable([ | 641 static final _all = new Map<String, Runtime>.fromIterable([ |
659 vm, | 642 vm, |
660 flutter, | 643 flutter, |
661 dartPrecompiled, | 644 dartPrecompiled, |
662 d8, | 645 d8, |
663 jsshell, | 646 jsshell, |
664 drt, | 647 drt, |
665 dartium, | |
666 firefox, | 648 firefox, |
667 chrome, | 649 chrome, |
668 safari, | 650 safari, |
669 ie9, | 651 ie9, |
670 ie10, | 652 ie10, |
671 ie11, | 653 ie11, |
672 opera, | 654 opera, |
673 chromeOnAndroid, | 655 chromeOnAndroid, |
674 safariMobileSim, | 656 safariMobileSim, |
675 contentShellOnAndroid, | 657 contentShellOnAndroid, |
676 dartiumOnAndroid, | |
677 selfCheck, | 658 selfCheck, |
678 none | 659 none |
679 ], key: (Runtime runtime) => runtime.name); | 660 ], key: (Runtime runtime) => runtime.name); |
680 | 661 |
681 static Runtime find(String name) { | 662 static Runtime find(String name) { |
682 // Allow "ff" as a synonym for Firefox. | 663 // Allow "ff" as a synonym for Firefox. |
683 if (name == "ff") return firefox; | 664 if (name == "ff") return firefox; |
684 | 665 |
685 var runtime = _all[name]; | 666 var runtime = _all[name]; |
686 if (runtime != null) return runtime; | 667 if (runtime != null) return runtime; |
687 | 668 |
688 throw new ArgumentError('Unknown runtime "$name".'); | 669 throw new ArgumentError('Unknown runtime "$name".'); |
689 } | 670 } |
690 | 671 |
691 final String name; | 672 final String name; |
692 | 673 |
693 const Runtime._(this.name); | 674 const Runtime._(this.name); |
694 | 675 |
695 bool get isBrowser => const [ | 676 bool get isBrowser => const [ |
696 drt, | 677 drt, |
697 dartium, | |
698 ie9, | 678 ie9, |
699 ie10, | 679 ie10, |
700 ie11, | 680 ie11, |
701 safari, | 681 safari, |
702 opera, | 682 opera, |
703 chrome, | 683 chrome, |
704 firefox, | 684 firefox, |
705 chromeOnAndroid, | 685 chromeOnAndroid, |
706 safariMobileSim, | 686 safariMobileSim, |
707 contentShellOnAndroid, | 687 contentShellOnAndroid |
708 dartiumOnAndroid, | |
709 ].contains(this); | 688 ].contains(this); |
710 | 689 |
711 bool get isIE => name.startsWith("ie"); | 690 bool get isIE => name.startsWith("ie"); |
712 bool get isSafari => name.startsWith("safari"); | 691 bool get isSafari => name.startsWith("safari"); |
713 | 692 |
714 /// Whether this runtime is a command-line JavaScript environment. | 693 /// Whether this runtime is a command-line JavaScript environment. |
715 bool get isJSCommandLine => const [d8, jsshell].contains(this); | 694 bool get isJSCommandLine => const [d8, jsshell].contains(this); |
716 | 695 |
717 /// If the runtime doesn't support `Window.open`, we use iframes instead. | 696 /// If the runtime doesn't support `Window.open`, we use iframes instead. |
718 bool get requiresIFrame => !const [ie11, ie10].contains(this); | 697 bool get requiresIFrame => !const [ie11, ie10].contains(this); |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
755 | 734 |
756 case macos: | 735 case macos: |
757 return 'xcodebuild/'; | 736 return 'xcodebuild/'; |
758 } | 737 } |
759 | 738 |
760 throw "unreachable"; | 739 throw "unreachable"; |
761 } | 740 } |
762 | 741 |
763 String toString() => "System($name)"; | 742 String toString() => "System($name)"; |
764 } | 743 } |
OLD | NEW |