fuchsia_workflow.dart 1.42 KB
Newer Older
Ian Hickson's avatar
Ian Hickson committed
1
// Copyright 2014 The Flutter Authors. All rights reserved.
2 3 4
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

5 6
import 'package:meta/meta.dart';

7
import '../base/context.dart';
8
import '../base/platform.dart';
9
import '../doctor.dart';
10 11
import '../features.dart';
import 'fuchsia_sdk.dart';
12 13

/// The [FuchsiaWorkflow] instance.
14
FuchsiaWorkflow get fuchsiaWorkflow => context.get<FuchsiaWorkflow>();
15 16 17 18 19 20

/// The Fuchsia-specific implementation of a [Workflow].
///
/// This workflow assumes development within the fuchsia source tree,
/// including a working fx command-line tool in the user's PATH.
class FuchsiaWorkflow implements Workflow {
21 22 23 24 25 26 27 28 29 30 31
  FuchsiaWorkflow({
    @required Platform platform,
    @required FeatureFlags featureFlags,
    @required FuchsiaArtifacts fuchsiaArtifacts,
  }) : _platform = platform,
       _featureFlags = featureFlags,
       _fuchsiaArtifacts = fuchsiaArtifacts;

  final Platform _platform;
  final FeatureFlags _featureFlags;
  final FuchsiaArtifacts _fuchsiaArtifacts;
32 33

  @override
34
  bool get appliesToHostPlatform => _featureFlags.isFuchsiaEnabled && (_platform.isLinux || _platform.isMacOS);
35 36 37

  @override
  bool get canListDevices {
38
    return _fuchsiaArtifacts.devFinder != null;
39 40 41 42
  }

  @override
  bool get canLaunchDevices {
43
    return _fuchsiaArtifacts.devFinder != null && _fuchsiaArtifacts.sshConfig != null;
44 45 46 47 48
  }

  @override
  bool get canListEmulators => false;
}