conductor.dart 2.53 KB
Newer Older
1 2 3 4
// 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.

5 6
// @dart = 2.8

7 8 9 10 11
// See: https://github.com/flutter/flutter/wiki/Release-process

import 'dart:io' as io;

import 'package:args/command_runner.dart';
12 13 14 15
import 'package:conductor/candidates.dart';
import 'package:conductor/clean.dart';
import 'package:conductor/codesign.dart';
import 'package:conductor/globals.dart';
16
import 'package:conductor/next.dart';
17 18 19 20 21
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';
22 23 24 25 26
import 'package:file/file.dart';
import 'package:file/local.dart';
import 'package:platform/platform.dart';
import 'package:process/process.dart';

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

29
Future<void> main(List<String> args) async {
30 31 32 33 34 35 36 37 38 39
  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,
40
    parentDirectory: localFlutterRoot.parent,
41 42
    platform: platform,
    processManager: processManager,
43
    stdio: stdio,
44
  );
45

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

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

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

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