| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 library test.integration.analysis; | 5 library test.integration.analysis; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 import 'dart:collection'; | 8 import 'dart:collection'; |
| 9 import 'dart:convert'; | 9 import 'dart:convert'; |
| 10 import 'dart:io'; | 10 import 'dart:io'; |
| (...skipping 579 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 590 return completer.future; | 590 return completer.future; |
| 591 } | 591 } |
| 592 | 592 |
| 593 /** | 593 /** |
| 594 * Start the server. If [debugServer] is `true`, the server will be started | 594 * Start the server. If [debugServer] is `true`, the server will be started |
| 595 * with "--debug", allowing a debugger to be attached. If [profileServer] is | 595 * with "--debug", allowing a debugger to be attached. If [profileServer] is |
| 596 * `true`, the server will be started with "--observe" and | 596 * `true`, the server will be started with "--observe" and |
| 597 * "--pause-isolates-on-exit", allowing the observatory to be used. | 597 * "--pause-isolates-on-exit", allowing the observatory to be used. |
| 598 */ | 598 */ |
| 599 Future start( | 599 Future start( |
| 600 {bool debugServer: false, | 600 {bool checked: true, |
| 601 bool debugServer: false, |
| 601 int diagnosticPort, | 602 int diagnosticPort, |
| 602 bool profileServer: false, | 603 bool profileServer: false, |
| 604 String sdkPath, |
| 603 int servicesPort, | 605 int servicesPort, |
| 604 bool checked: true, | |
| 605 bool useAnalysisHighlight2: false}) { | 606 bool useAnalysisHighlight2: false}) { |
| 606 if (_process != null) { | 607 if (_process != null) { |
| 607 throw new Exception('Process already started'); | 608 throw new Exception('Process already started'); |
| 608 } | 609 } |
| 609 _time.start(); | 610 _time.start(); |
| 610 String dartBinary = Platform.executable; | 611 String dartBinary = Platform.executable; |
| 611 String rootDir = | 612 String rootDir = |
| 612 findRoot(Platform.script.toFilePath(windows: Platform.isWindows)); | 613 findRoot(Platform.script.toFilePath(windows: Platform.isWindows)); |
| 613 String serverPath = normalize(join(rootDir, 'bin', 'server.dart')); | 614 String serverPath = normalize(join(rootDir, 'bin', 'server.dart')); |
| 614 List<String> arguments = []; | 615 List<String> arguments = []; |
| 616 // |
| 617 // Add VM arguments. |
| 618 // |
| 615 if (debugServer) { | 619 if (debugServer) { |
| 616 arguments.add('--debug'); | 620 arguments.add('--debug'); |
| 617 } | 621 } |
| 618 if (profileServer) { | 622 if (profileServer) { |
| 619 if (servicesPort == null) { | 623 if (servicesPort == null) { |
| 620 arguments.add('--observe'); | 624 arguments.add('--observe'); |
| 621 } else { | 625 } else { |
| 622 arguments.add('--observe=$servicesPort'); | 626 arguments.add('--observe=$servicesPort'); |
| 623 } | 627 } |
| 624 arguments.add('--pause-isolates-on-exit'); | 628 arguments.add('--pause-isolates-on-exit'); |
| 625 } else if (servicesPort != null) { | 629 } else if (servicesPort != null) { |
| 626 arguments.add('--enable-vm-service=$servicesPort'); | 630 arguments.add('--enable-vm-service=$servicesPort'); |
| 627 } | 631 } |
| 628 if (Platform.packageRoot != null) { | 632 if (Platform.packageRoot != null) { |
| 629 arguments.add('--package-root=${Platform.packageRoot}'); | 633 arguments.add('--package-root=${Platform.packageRoot}'); |
| 630 } | 634 } |
| 631 if (checked) { | 635 if (checked) { |
| 632 arguments.add('--checked'); | 636 arguments.add('--checked'); |
| 633 } | 637 } |
| 638 // |
| 639 // Add the server executable. |
| 640 // |
| 634 arguments.add(serverPath); | 641 arguments.add(serverPath); |
| 642 // |
| 643 // Add server arguments. |
| 644 // |
| 635 if (diagnosticPort != null) { | 645 if (diagnosticPort != null) { |
| 636 arguments.add('--port'); | 646 arguments.add('--port'); |
| 637 arguments.add(diagnosticPort.toString()); | 647 arguments.add(diagnosticPort.toString()); |
| 638 } | 648 } |
| 649 if (sdkPath != null) { |
| 650 arguments.add('--sdk=$sdkPath'); |
| 651 } |
| 639 if (useAnalysisHighlight2) { | 652 if (useAnalysisHighlight2) { |
| 640 arguments.add('--useAnalysisHighlight2'); | 653 arguments.add('--useAnalysisHighlight2'); |
| 641 } | 654 } |
| 642 // print('Launching $serverPath'); | 655 // print('Launching $serverPath'); |
| 643 // print('$dartBinary ${arguments.join(' ')}'); | 656 // print('$dartBinary ${arguments.join(' ')}'); |
| 644 return Process.start(dartBinary, arguments).then((Process process) { | 657 return Process.start(dartBinary, arguments).then((Process process) { |
| 645 _process = process; | 658 _process = process; |
| 646 process.exitCode.then((int code) { | 659 process.exitCode.then((int code) { |
| 647 if (code != 0) { | 660 if (code != 0) { |
| 648 _badDataFromServer('server terminated with exit code $code'); | 661 _badDataFromServer('server terminated with exit code $code'); |
| (...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 900 void populateMismatches(item, List<MismatchDescriber> mismatches); | 913 void populateMismatches(item, List<MismatchDescriber> mismatches); |
| 901 | 914 |
| 902 /** | 915 /** |
| 903 * Create a [MismatchDescriber] describing a mismatch with a simple string. | 916 * Create a [MismatchDescriber] describing a mismatch with a simple string. |
| 904 */ | 917 */ |
| 905 MismatchDescriber simpleDescription(String description) => | 918 MismatchDescriber simpleDescription(String description) => |
| 906 (Description mismatchDescription) { | 919 (Description mismatchDescription) { |
| 907 mismatchDescription.add(description); | 920 mismatchDescription.add(description); |
| 908 }; | 921 }; |
| 909 } | 922 } |
| OLD | NEW |