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

Unified Diff: lib/src/flutter.dart

Issue 2165423002: Add support for Flutter SDK constraints. (Closed) Base URL: git@github.com:dart-lang/pub.git@master
Patch Set: Code review changes Created 4 years, 5 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/entrypoint.dart ('k') | lib/src/global_packages.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/src/flutter.dart
diff --git a/lib/src/flutter.dart b/lib/src/flutter.dart
new file mode 100644
index 0000000000000000000000000000000000000000..cb383e460db5191b1aa0ef8d2ae58938d27b9de1
--- /dev/null
+++ b/lib/src/flutter.dart
@@ -0,0 +1,25 @@
+// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'dart:io';
+
+import 'package:path/path.dart' as p;
+import 'package:pub_semver/pub_semver.dart';
+
+import 'io.dart';
+
+/// Whether the Flutter SDK is available.
+final bool isAvailable = Platform.environment.containsKey("FLUTTER_ROOT");
+
+/// The path to the root directory of the Flutter SDK.
+final String rootDirectory = Platform.environment["FLUTTER_ROOT"];
+
+/// The Flutter SDK's version number, or `null` if the Flutter SDK is
+/// unavailable.
+final version = () {
+ if (!isAvailable) return null;
+
+ return new Version.parse(
+ readTextFile(p.join(rootDirectory, "version")).trim());
+}();
« no previous file with comments | « lib/src/entrypoint.dart ('k') | lib/src/global_packages.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698