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

import '../base/context.dart';
6
import '../base/platform.dart';
7
import '../doctor_validator.dart';
8 9
import '../features.dart';
import 'fuchsia_sdk.dart';
10 11

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

/// 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 {
19
  FuchsiaWorkflow({
20 21 22
    required Platform platform,
    required FeatureFlags featureFlags,
    required FuchsiaArtifacts fuchsiaArtifacts,
23 24 25 26 27 28 29
  }) : _platform = platform,
       _featureFlags = featureFlags,
       _fuchsiaArtifacts = fuchsiaArtifacts;

  final Platform _platform;
  final FeatureFlags _featureFlags;
  final FuchsiaArtifacts _fuchsiaArtifacts;
30 31

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

  @override
  bool get canListDevices {
36
    return _fuchsiaArtifacts.ffx != null;
37 38 39 40
  }

  @override
  bool get canLaunchDevices {
41
    return _fuchsiaArtifacts.ffx != null && _fuchsiaArtifacts.sshConfig != null;
42 43 44 45 46
  }

  @override
  bool get canListEmulators => false;
}