inject_plugins.dart 920 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11
// Copyright 2017 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 'dart:async';

import '../globals.dart';
import '../plugins.dart';
import '../runner/flutter_command.dart';

class InjectPluginsCommand extends FlutterCommand {
12
  InjectPluginsCommand({ this.hidden = false }) {
13 14 15 16 17 18 19 20 21 22 23 24 25 26
    requiresPubspecYaml();
  }

  @override
  final String name = 'inject-plugins';

  @override
  final String description = 'Re-generates the GeneratedPluginRegistrants.';

  @override
  final bool hidden;

  @override
  Future<Null> runCommand() async {
27 28
    injectPlugins();
    final bool result = hasPlugins();
29 30 31 32 33 34 35
    if (result) {
      printStatus('GeneratedPluginRegistrants successfully written.');
    } else {
      printStatus('This project does not use plugins, no GeneratedPluginRegistrants have been created.');
    }
  }
}