blob: 5041489fe05600f0e95b5f5d82337f54b1a250a1 [file] [log] [blame]
// Copyright (c) 2018, 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';
import '../sdk.dart';
class FuchsiaSdk extends Sdk {
String get name => 'Fuchsia';
bool get isAvailable => _isAvailable;
Version get firstPubVersion => Version.parse('2.0.0-dev.51.0');
static final bool _isAvailable =
static final String _rootDirectory =
String get installMessage =>
'Please set the FUCHSIA_DART_SDK_ROOT environment variable to point to '
'the root of the Fuchsia SDK for Dart.';
Version get version {
if (!_isAvailable) return null;
_version ??=
Version.parse(readTextFile(p.join(_rootDirectory, 'version')).trim());
return _version;
Version _version;
String packagePath(String name) {
if (!isAvailable) return null;
var packagePath = p.join(_rootDirectory, 'packages', name);
if (dirExists(packagePath)) return packagePath;
return null;