android_workflow.dart 1.22 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 {
Devon Carew's avatar
Devon Carew committed
10
  String get label => 'Android toolchain';
11 12 13 14 15 16 17

  bool get appliesToHostPlatform => true;

  bool get canListDevices => getAdbPath(androidSdk) != null;

  bool get canLaunchDevices => androidSdk != null && androidSdk.validateSdkWellFormed(complain: false);

18 19
  ValidationResult validate() {
    Validator androidValidator = new Validator(
Devon Carew's avatar
Devon Carew committed
20
      label,
21 22
      description: 'develop for Android devices'
    );
23

Devon Carew's avatar
Devon Carew committed
24
    ValidationType sdkExists() {
25 26 27 28
      return androidSdk == null ? ValidationType.missing : ValidationType.installed;
    };

    androidValidator.addValidator(new Validator(
29
      'Android Studio / Android SDK',
30
      description: 'enable development for Android devices',
31 32
      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
33
      validatorFunction: sdkExists
34 35
    ));

36
    return androidValidator.validate();
37
  }
38 39

  void diagnose() => validate().print();
40
}