conductor.dart 2.51 KB
Newer Older
1 2 3 4 5 6 7 8 9
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

// See: https://github.com/flutter/flutter/wiki/Release-process

import 'dart:io' as io;

import 'package:args/command_runner.dart';
10 11 12 13
import 'package:conductor/candidates.dart';
import 'package:conductor/clean.dart';
import 'package:conductor/codesign.dart';
import 'package:conductor/globals.dart';
14
import 'package:conductor/next.dart';
15 16 17 18 19
import 'package:conductor/repository.dart';
import 'package:conductor/roll_dev.dart';
import 'package:conductor/start.dart';
import 'package:conductor/status.dart';
import 'package:conductor/stdio.dart';
20 21 22 23 24
import 'package:file/file.dart';
import 'package:file/local.dart';
import 'package:platform/platform.dart';
import 'package:process/process.dart';

25 26
const String readmeUrl = 'https://github.com/flutter/flutter/tree/master/dev/conductor/README.md';

27
Future<void> main(List<String> args) async {
28 29 30 31 32 33 34 35 36 37
  const FileSystem fileSystem = LocalFileSystem();
  const ProcessManager processManager = LocalProcessManager();
  const Platform platform = LocalPlatform();
  final Stdio stdio = VerboseStdio(
    stdout: io.stdout,
    stderr: io.stderr,
    stdin: io.stdin,
  );
  final Checkouts checkouts = Checkouts(
    fileSystem: fileSystem,
38
    parentDirectory: localFlutterRoot.parent,
39 40
    platform: platform,
    processManager: processManager,
41
    stdio: stdio,
42
  );
43

44 45
  final CommandRunner<void> runner = CommandRunner<void>(
    'conductor',
46 47
    'A tool for coordinating Flutter releases. For more documentation on '
    'usage, please see $readmeUrl.',
48 49 50 51
    usageLineLength: 80,
  );

  <Command<void>>[
52 53
    RollDevCommand(
      checkouts: checkouts,
54 55 56 57
      fileSystem: fileSystem,
      platform: platform,
      stdio: stdio,
    ),
58 59 60 61
    CodesignCommand(
      checkouts: checkouts,
      flutterRoot: localFlutterRoot,
    ),
62 63 64 65 66 67 68 69 70 71
    StatusCommand(
      checkouts: checkouts,
    ),
    StartCommand(
      checkouts: checkouts,
      flutterRoot: localFlutterRoot,
    ),
    CleanCommand(
      checkouts: checkouts,
    ),
72 73 74 75
    CandidatesCommand(
      checkouts: checkouts,
      flutterRoot: localFlutterRoot,
    ),
76 77 78
    NextCommand(
      checkouts: checkouts,
    ),
79 80 81 82 83 84 85 86
  ].forEach(runner.addCommand);

  if (!assertsEnabled()) {
    stdio.printError('The conductor tool must be run with --enable-asserts.');
    io.exit(1);
  }

  try {
87
    await runner.run(args);
88 89
  } on Exception catch (e, stacktrace) {
    stdio.printError('$e\n\n$stacktrace');
90 91 92
    io.exit(1);
  }
}