| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 /// V8 runner support used by dartdevrun. | 5 /// V8 runner support used by dartdevrun. |
| 6 library dev_compiler.src.runner.v8_utils; | 6 library dev_compiler.src.runner.v8_utils; |
| 7 | 7 |
| 8 import 'dart:async'; | 8 import 'dart:async'; |
| 9 import 'dart:io'; | 9 import 'dart:io'; |
| 10 | 10 |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 } | 44 } |
| 45 } | 45 } |
| 46 | 46 |
| 47 List<String> get _v8VersionArgs; | 47 List<String> get _v8VersionArgs; |
| 48 List<String> _getLoadStatements(List<File> files); | 48 List<String> _getLoadStatements(List<File> files); |
| 49 | 49 |
| 50 String get _v8Binary => _options.runnerOptions.v8Binary; | 50 String get _v8Binary => _options.runnerOptions.v8Binary; |
| 51 | 51 |
| 52 Future<Process> start(List<File> files, String startStatement) => | 52 Future<Process> start(List<File> files, String startStatement) => |
| 53 Process.start( | 53 Process.start( |
| 54 _v8Binary, [ | 54 _v8Binary, |
| 55 [ |
| 55 "--harmony", | 56 "--harmony", |
| 56 "-e", | 57 "-e", |
| 57 _GLOBALS + _getLoadStatements(files).join() + startStatement | 58 _GLOBALS + _getLoadStatements(files).join() + startStatement |
| 58 ], | 59 ], |
| 59 workingDirectory: _options.codegenOptions.outputDir); | 60 workingDirectory: _options.codegenOptions.outputDir); |
| 60 | 61 |
| 61 /// Throws if the v8 version of this runner is not supported, or if the runner | 62 /// Throws if the v8 version of this runner is not supported, or if the runner |
| 62 /// is not in the path. | 63 /// is not in the path. |
| 63 void _checkVersion() { | 64 void _checkVersion() { |
| 64 ProcessResult result = Process.runSync(_v8Binary, _v8VersionArgs); | 65 ProcessResult result = Process.runSync(_v8Binary, _v8VersionArgs); |
| (...skipping 28 matching lines...) Expand all Loading... |
| 93 @override | 94 @override |
| 94 get _v8VersionArgs => ['-p', 'process.versions.v8']; | 95 get _v8VersionArgs => ['-p', 'process.versions.v8']; |
| 95 | 96 |
| 96 @override | 97 @override |
| 97 _getLoadStatements(List<File> files) => files.map((file) { | 98 _getLoadStatements(List<File> files) => files.map((file) { |
| 98 String alias = getRuntimeFileAlias(_options, file); | 99 String alias = getRuntimeFileAlias(_options, file); |
| 99 return (alias != null ? 'var $alias = ' : '') + | 100 return (alias != null ? 'var $alias = ' : '') + |
| 100 'require("${file.path}");'; | 101 'require("${file.path}");'; |
| 101 }); | 102 }); |
| 102 } | 103 } |
| OLD | NEW |