| 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 498 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 509 // executable, and the package root into a shell script. | 509 // executable, and the package root into a shell script. |
| 510 String dartBinary = Platform.executable; | 510 String dartBinary = Platform.executable; |
| 511 String scriptDir = dirname(Platform.script.toFilePath(windows: | 511 String scriptDir = dirname(Platform.script.toFilePath(windows: |
| 512 Platform.isWindows)); | 512 Platform.isWindows)); |
| 513 String serverPath = normalize(join(scriptDir, '..', '..', 'bin', | 513 String serverPath = normalize(join(scriptDir, '..', '..', 'bin', |
| 514 'server.dart')); | 514 'server.dart')); |
| 515 List<String> arguments = []; | 515 List<String> arguments = []; |
| 516 if (debugServer) { | 516 if (debugServer) { |
| 517 arguments.add('--debug'); | 517 arguments.add('--debug'); |
| 518 } | 518 } |
| 519 arguments.add('--package-root=${Platform.packageRoot}'); | 519 if (Platform.packageRoot.isNotEmpty) { |
| 520 arguments.add('--package-root=${Platform.packageRoot}'); |
| 521 } |
| 520 arguments.add(serverPath); | 522 arguments.add(serverPath); |
| 521 return Process.start(dartBinary, arguments).then((Process process) { | 523 return Process.start(dartBinary, arguments).then((Process process) { |
| 522 Server server = new Server._(process); | 524 Server server = new Server._(process); |
| 523 process.stdout.transform((new Utf8Codec()).decoder).transform( | 525 process.stdout.transform((new Utf8Codec()).decoder).transform( |
| 524 new LineSplitter()).listen((String line) { | 526 new LineSplitter()).listen((String line) { |
| 525 String trimmedLine = line.trim(); | 527 String trimmedLine = line.trim(); |
| 526 server._recordStdio('RECV: $trimmedLine'); | 528 server._recordStdio('RECV: $trimmedLine'); |
| 527 var message; | 529 var message; |
| 528 try { | 530 try { |
| 529 message = JSON.decoder.convert(trimmedLine); | 531 message = JSON.decoder.convert(trimmedLine); |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 651 * Record a message that was exchanged with the server, and print it out if | 653 * Record a message that was exchanged with the server, and print it out if |
| 652 * [debugStdio] has been called. | 654 * [debugStdio] has been called. |
| 653 */ | 655 */ |
| 654 void _recordStdio(String line) { | 656 void _recordStdio(String line) { |
| 655 if (_debuggingStdio) { | 657 if (_debuggingStdio) { |
| 656 print(line); | 658 print(line); |
| 657 } | 659 } |
| 658 _recordedStdio.add(line); | 660 _recordedStdio.add(line); |
| 659 } | 661 } |
| 660 } | 662 } |
| OLD | NEW |