Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(12)

Unified Diff: lib/src/util/io.dart

Issue 1062523003: Add support for --pub-serve. (Closed) Base URL: git@github.com:dart-lang/test@master
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « lib/src/runner/loader.dart ('k') | pubspec.yaml » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/src/util/io.dart
diff --git a/lib/src/util/io.dart b/lib/src/util/io.dart
index 39c336ac84ddff329fcecdc6fee2f9932b7110f5..047e7557c1369a7a58fd5344c3be66091ff49aca 100644
--- a/lib/src/util/io.dart
+++ b/lib/src/util/io.dart
@@ -9,6 +9,7 @@ import 'dart:io';
import 'dart:mirrors';
import 'package:path/path.dart' as p;
+import 'package:pub_semver/pub_semver.dart';
import '../backend/operating_system.dart';
import '../runner/load_exception.dart';
@@ -17,6 +18,11 @@ import '../runner/load_exception.dart';
final String sdkDir =
p.dirname(p.dirname(Platform.executable));
+/// The version of the Dart SDK currently in use.
kevmoo 2015/04/03 22:55:53 Annoying nit: if this check fails, an exception wi
+final Version _sdkVersion = new Version.parse(
+ new File(p.join(p.dirname(p.dirname(Platform.executable)), 'version'))
+ .readAsStringSync().trim());
+
/// Returns the current operating system.
final OperatingSystem currentOS = (() {
var name = Platform.operatingSystem;
@@ -38,8 +44,16 @@ bool get _supportsIsolateKill {
// This isn't 100% accurate, since early 1.9 dev releases didn't support
// Isolate.kill(), but it's very unlikely anyone will be using them.
// TODO(nweiz): remove this when we no longer support older Dart versions.
- var path = p.join(p.dirname(p.dirname(Platform.executable)), 'version');
- return !new File(path).readAsStringSync().startsWith('1.8');
+ return new VersionConstraint.parse('>=1.9.0-dev <2.0.0').allows(_sdkVersion);
+}
+
+/// Returns whether the current Dart version has a fix for issue 23084.
+final bool supportsPubServe = _supportsPubServe;
+bool get _supportsPubServe {
+ // This isn't 100% accurate, since issue 23084 wasn't fixed in early 1.10 dev
+ // releases, but it's unlikely anyone will be using them.
+ // TODO(nweiz): remove this when we no longer support older Dart versions.
+ return new VersionConstraint.parse('>=1.9.2 <2.0.0').allows(_sdkVersion);
}
// TODO(nweiz): Make this check [stdioType] once that works within "pub run".
« no previous file with comments | « lib/src/runner/loader.dart ('k') | pubspec.yaml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698