Migrate flutter conductor out of dev/tools and into its own directory (#83313)
* Migrate flutter conductor out of dev/tools and into its own directory * flesh out documentation * fix analysis options * fix integration test
This commit is contained in:
committed by
GitHub
parent
36eea758ac
commit
62d00c6d5f
40
dev/conductor/bin/conductor
Executable file
40
dev/conductor/bin/conductor
Executable file
@@ -0,0 +1,40 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
# Needed because if it is set, cd may print the path it changed to.
|
||||
unset CDPATH
|
||||
|
||||
# On Mac OS, readlink -f doesn't work, so follow_links traverses the path one
|
||||
# link at a time, and then cds into the link destination and find out where it
|
||||
# ends up.
|
||||
#
|
||||
# The returned filesystem path must be a format usable by Dart's URI parser,
|
||||
# since the Dart command line tool treats its argument as a file URI, not a
|
||||
# filename. For instance, multiple consecutive slashes should be reduced to a
|
||||
# single slash, since double-slashes indicate a URI "authority", and these are
|
||||
# supposed to be filenames. There is an edge case where this will return
|
||||
# multiple slashes: when the input resolves to the root directory. However, if
|
||||
# that were the case, we wouldn't be running this shell, so we don't do anything
|
||||
# about it.
|
||||
#
|
||||
# The function is enclosed in a subshell to avoid changing the working directory
|
||||
# of the caller.
|
||||
function follow_links() (
|
||||
cd -P "$(dirname -- "$1")"
|
||||
file="$PWD/$(basename -- "$1")"
|
||||
while [[ -h "$file" ]]; do
|
||||
cd -P "$(dirname -- "$file")"
|
||||
file="$(readlink -- "$file")"
|
||||
cd -P "$(dirname -- "$file")"
|
||||
file="$PWD/$(basename -- "$file")"
|
||||
done
|
||||
echo "$file"
|
||||
)
|
||||
|
||||
PROG_NAME="$(follow_links "${BASH_SOURCE[0]}")"
|
||||
BIN_DIR="$(cd "${PROG_NAME%/*}" ; pwd -P)"
|
||||
REPO_DIR="$BIN_DIR/../../.."
|
||||
DART_BIN="$REPO_DIR/bin/dart"
|
||||
|
||||
"$DART_BIN" --enable-asserts "$REPO_DIR/dev/conductor/bin/conductor.dart" "$@"
|
||||
90
dev/conductor/bin/conductor.dart
Normal file
90
dev/conductor/bin/conductor.dart
Normal file
@@ -0,0 +1,90 @@
|
||||
// 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.
|
||||
|
||||
// @dart = 2.8
|
||||
|
||||
// See: https://github.com/flutter/flutter/wiki/Release-process
|
||||
|
||||
import 'dart:io' as io;
|
||||
|
||||
import 'package:args/command_runner.dart';
|
||||
import 'package:conductor/candidates.dart';
|
||||
import 'package:conductor/clean.dart';
|
||||
import 'package:conductor/codesign.dart';
|
||||
import 'package:conductor/globals.dart';
|
||||
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';
|
||||
import 'package:file/file.dart';
|
||||
import 'package:file/local.dart';
|
||||
import 'package:platform/platform.dart';
|
||||
import 'package:process/process.dart';
|
||||
|
||||
const String readmeUrl = 'https://github.com/flutter/flutter/tree/master/dev/conductor/README.md';
|
||||
|
||||
Future<void> main(List<String> args) async {
|
||||
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,
|
||||
parentDirectory: localFlutterRoot.parent,
|
||||
platform: platform,
|
||||
processManager: processManager,
|
||||
stdio: stdio,
|
||||
);
|
||||
|
||||
final CommandRunner<void> runner = CommandRunner<void>(
|
||||
'conductor',
|
||||
'A tool for coordinating Flutter releases. For more documentation on '
|
||||
'usage, please see $readmeUrl.',
|
||||
usageLineLength: 80,
|
||||
);
|
||||
|
||||
<Command<void>>[
|
||||
RollDevCommand(
|
||||
checkouts: checkouts,
|
||||
fileSystem: fileSystem,
|
||||
platform: platform,
|
||||
stdio: stdio,
|
||||
),
|
||||
CodesignCommand(
|
||||
checkouts: checkouts,
|
||||
flutterRoot: localFlutterRoot,
|
||||
),
|
||||
StatusCommand(
|
||||
checkouts: checkouts,
|
||||
),
|
||||
StartCommand(
|
||||
checkouts: checkouts,
|
||||
flutterRoot: localFlutterRoot,
|
||||
),
|
||||
CleanCommand(
|
||||
checkouts: checkouts,
|
||||
),
|
||||
CandidatesCommand(
|
||||
checkouts: checkouts,
|
||||
flutterRoot: localFlutterRoot,
|
||||
),
|
||||
].forEach(runner.addCommand);
|
||||
|
||||
if (!assertsEnabled()) {
|
||||
stdio.printError('The conductor tool must be run with --enable-asserts.');
|
||||
io.exit(1);
|
||||
}
|
||||
|
||||
try {
|
||||
await runner.run(args);
|
||||
} on Exception catch (e, stacktrace) {
|
||||
stdio.printError('$e\n\n$stacktrace');
|
||||
io.exit(1);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user