Skip to content

Commit d8c7cd7

Browse files
author
John Messerly
committed
Merge pull request #317 from dart-lang/fix-devrun
Update devrun to use latest node.js
2 parents eb2c584 + 39b6f11 commit d8c7cd7

File tree

2 files changed

+17
-19
lines changed

2 files changed

+17
-19
lines changed

pkg/dev_compiler/lib/src/options.dart

+14-8
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import 'package:logging/logging.dart' show Level;
1313
import 'package:path/path.dart' as path;
1414
import 'package:yaml/yaml.dart';
1515

16+
const String _V8_BINARY_DEFAULT = 'node';
1617
const bool _CLOSURE_DEFAULT = false;
1718

1819
/// Options used to set up Source URI resolution in the analysis context.
@@ -87,7 +88,7 @@ class RunnerOptions {
8788
/// executable.
8889
final String v8Binary;
8990

90-
const RunnerOptions({this.v8Binary: 'iojs'});
91+
const RunnerOptions({this.v8Binary: _V8_BINARY_DEFAULT});
9192
}
9293

9394
/// General options used by the dev compiler and server.
@@ -206,7 +207,7 @@ CompilerOptions parseOptions(List<String> argv, {bool forceOutDir: false}) {
206207
var htmlReport = args['html-report'];
207208

208209
var v8Binary = args['v8-binary'];
209-
if (v8Binary == null) v8Binary = 'iojs';
210+
if (v8Binary == null) v8Binary = _V8_BINARY_DEFAULT;
210211

211212
var customUrlMappings = <String, String>{};
212213
for (var mapping in args['url-mapping']) {
@@ -321,12 +322,20 @@ final ArgParser argParser = new ArgParser()
321322
help: 'Output compilation results to html', defaultsTo: false)
322323
..addOption('v8-binary',
323324
help: 'V8-based binary to run JavaScript output with (iojs, node, d8)',
324-
defaultsTo: 'iojs')
325+
defaultsTo: _V8_BINARY_DEFAULT)
325326
..addOption('dump-info-file',
326327
help: 'Dump info json file (requires dump-info)', defaultsTo: null);
327328

328329
// TODO: Switch over to the `pub_cache` package (or the Resource API)?
329330

331+
const _ENTRY_POINTS = const [
332+
'dartdevc.dart',
333+
'dev_compiler.dart',
334+
'devrun.dart'
335+
];
336+
337+
final _ENTRY_POINT_SNAPSHOTS = _ENTRY_POINTS.map((f) => "$f.snapshot");
338+
330339
/// Tries to find the `lib/runtime/` directory of the dev_compiler package. This
331340
/// works when running devc from it's sources or from a snapshot that is
332341
/// activated via `pub global activate`.
@@ -346,16 +355,13 @@ String _computeRuntimeDir() {
346355
if (!new File(lockfile).existsSync()) return null;
347356

348357
// If running from sources we found it!
349-
if (file == 'dartdevc.dart' ||
350-
file == 'dev_compiler.dart' ||
351-
file == 'devrun.dart') {
358+
if (_ENTRY_POINTS.contains(file)) {
352359
return path.join(dir, 'lib', 'runtime');
353360
}
354361

355362
// If running from a pub global snapshot, we need to read the lock file to
356363
// find where the actual sources are located in the pub cache.
357-
if (file == 'dartdevc.dart.snapshot' ||
358-
file == 'dev_compiler.dart.snapshot') {
364+
if (_ENTRY_POINT_SNAPSHOTS.contains(file)) {
359365
// Note: this depends on implementation details of pub.
360366
var yaml = loadYaml(new File(lockfile).readAsStringSync());
361367
var info = yaml['packages']['dev_compiler'];

pkg/dev_compiler/lib/src/runner/v8_runner.dart

+3-11
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@ import 'runtime_utils.dart' show getRuntimeFileAlias;
1717
_parseV8Version(String version) =>
1818
new Version.parse(version.split('.').getRange(0, 3).join('.'));
1919

20-
/// io.js still has issues, like lexical this in arrow functions.
21-
final _MIN_SUPPORTED_V8_VERSION = _parseV8Version("4.4.63");
20+
final _MIN_SUPPORTED_V8_VERSION = _parseV8Version("4.5.103.30");
2221

2322
/// TODO(ochafik): Move to dart_library.js
2423
const _GLOBALS = r'''
@@ -52,15 +51,8 @@ abstract class V8Runner {
5251

5352
Future<Process> start(List<File> files, String startStatement) =>
5453
Process.start(
55-
_v8Binary,
56-
[
57-
"--harmony_arrow_functions",
58-
"--harmony_classes",
59-
"--harmony_computed_property_names",
60-
"--harmony_generators",
61-
"--harmony_object_literals",
62-
"--harmony_rest_parameters",
63-
"--harmony_spreadcalls",
54+
_v8Binary, [
55+
"--harmony",
6456
"-e",
6557
_GLOBALS + _getLoadStatements(files).join() + startStatement
6658
],

0 commit comments

Comments
 (0)