android_workflow.dart 1.29 KB
Newer Older
1 2 3 4 5
// Copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

import '../doctor.dart';
6
import '../globals.dart';
7 8 9
import 'android_sdk.dart';

class AndroidWorkflow extends Workflow {
10
  @override
Devon Carew's avatar
Devon Carew committed
11
  String get label => 'Android toolchain';
12

13
  @override
14 15
  bool get appliesToHostPlatform => true;

16
  @override
17 18
  bool get canListDevices => getAdbPath(androidSdk) != null;

19
  @override
20 21
  bool get canLaunchDevices => androidSdk != null && androidSdk.validateSdkWellFormed(complain: false);

22
  @override
23 24
  ValidationResult validate() {
    Validator androidValidator = new Validator(
Devon Carew's avatar
Devon Carew committed
25
      label,
26 27
      description: 'develop for Android devices'
    );
28

Devon Carew's avatar
Devon Carew committed
29
    ValidationType sdkExists() {
30 31 32 33
      return androidSdk == null ? ValidationType.missing : ValidationType.installed;
    };

    androidValidator.addValidator(new Validator(
34
      'Android Studio / Android SDK',
35
      description: 'enable development for Android devices',
36 37
      resolution: 'Download from https://developer.android.com/sdk/ (or visit '
        'https://flutter.io/setup/#android-setup for detailed instructions)',
Devon Carew's avatar
Devon Carew committed
38
      validatorFunction: sdkExists
39 40
    ));

41
    return androidValidator.validate();
42
  }
43

44
  @override
45
  void diagnose() => validate().print();
46
}