[flutter_conductor] migrate conductor to null-safety (#86117)
This commit is contained in:
parent
5456cad343
commit
711f9b7c43
@ -2,8 +2,6 @@
|
|||||||
// Use of this source code is governed by a BSD-style license that can be
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
// @dart = 2.8
|
|
||||||
|
|
||||||
// See: https://github.com/flutter/flutter/wiki/Release-process
|
// See: https://github.com/flutter/flutter/wiki/Release-process
|
||||||
|
|
||||||
import 'dart:io' as io;
|
import 'dart:io' as io;
|
||||||
|
@ -2,11 +2,9 @@
|
|||||||
// Use of this source code is governed by a BSD-style license that can be
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
// @dart = 2.8
|
import 'package:args/args.dart';
|
||||||
|
|
||||||
import 'package:args/command_runner.dart';
|
import 'package:args/command_runner.dart';
|
||||||
import 'package:file/file.dart';
|
import 'package:file/file.dart';
|
||||||
import 'package:meta/meta.dart';
|
|
||||||
import 'package:platform/platform.dart';
|
import 'package:platform/platform.dart';
|
||||||
|
|
||||||
import './globals.dart';
|
import './globals.dart';
|
||||||
@ -22,7 +20,7 @@ const String kStateOption = 'state-file';
|
|||||||
/// If the release was not completed, this command will abort the release.
|
/// If the release was not completed, this command will abort the release.
|
||||||
class CleanCommand extends Command<void> {
|
class CleanCommand extends Command<void> {
|
||||||
CleanCommand({
|
CleanCommand({
|
||||||
@required this.checkouts,
|
required this.checkouts,
|
||||||
}) : platform = checkouts.platform,
|
}) : platform = checkouts.platform,
|
||||||
fileSystem = checkouts.fileSystem,
|
fileSystem = checkouts.fileSystem,
|
||||||
stdio = checkouts.stdio {
|
stdio = checkouts.stdio {
|
||||||
@ -52,13 +50,14 @@ class CleanCommand extends Command<void> {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
void run() {
|
void run() {
|
||||||
final File stateFile = checkouts.fileSystem.file(argResults[kStateOption]);
|
final ArgResults argumentResults = argResults!;
|
||||||
|
final File stateFile = checkouts.fileSystem.file(argumentResults[kStateOption]);
|
||||||
if (!stateFile.existsSync()) {
|
if (!stateFile.existsSync()) {
|
||||||
throw ConductorException(
|
throw ConductorException(
|
||||||
'No persistent state file found at ${stateFile.path}!');
|
'No persistent state file found at ${stateFile.path}!');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(argResults[kYesFlag] as bool)) {
|
if (!(argumentResults[kYesFlag] as bool)) {
|
||||||
stdio.printStatus(
|
stdio.printStatus(
|
||||||
'Are you sure you want to clean up the persistent state file at\n'
|
'Are you sure you want to clean up the persistent state file at\n'
|
||||||
'${stateFile.path} (y/n)?',
|
'${stateFile.path} (y/n)?',
|
||||||
|
@ -2,11 +2,9 @@
|
|||||||
// Use of this source code is governed by a BSD-style license that can be
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
// @dart = 2.8
|
|
||||||
|
|
||||||
import 'package:args/command_runner.dart';
|
import 'package:args/command_runner.dart';
|
||||||
import 'package:file/file.dart' show File;
|
import 'package:file/file.dart' show File;
|
||||||
import 'package:meta/meta.dart' show required, visibleForTesting;
|
import 'package:meta/meta.dart' show visibleForTesting;
|
||||||
import './globals.dart';
|
import './globals.dart';
|
||||||
import './proto/conductor_state.pb.dart' as pb;
|
import './proto/conductor_state.pb.dart' as pb;
|
||||||
import './proto/conductor_state.pbenum.dart';
|
import './proto/conductor_state.pbenum.dart';
|
||||||
@ -21,7 +19,7 @@ const String kForceFlag = 'force';
|
|||||||
/// Command to proceed from one [pb.ReleasePhase] to the next.
|
/// Command to proceed from one [pb.ReleasePhase] to the next.
|
||||||
class NextCommand extends Command<void> {
|
class NextCommand extends Command<void> {
|
||||||
NextCommand({
|
NextCommand({
|
||||||
@required this.checkouts,
|
required this.checkouts,
|
||||||
}) {
|
}) {
|
||||||
final String defaultPath = defaultStateFilePath(checkouts.platform);
|
final String defaultPath = defaultStateFilePath(checkouts.platform);
|
||||||
argParser.addOption(
|
argParser.addOption(
|
||||||
@ -51,10 +49,10 @@ class NextCommand extends Command<void> {
|
|||||||
@override
|
@override
|
||||||
void run() {
|
void run() {
|
||||||
runNext(
|
runNext(
|
||||||
autoAccept: argResults[kYesFlag] as bool,
|
autoAccept: argResults![kYesFlag] as bool,
|
||||||
checkouts: checkouts,
|
checkouts: checkouts,
|
||||||
force: argResults[kForceFlag] as bool,
|
force: argResults![kForceFlag] as bool,
|
||||||
stateFile: checkouts.fileSystem.file(argResults[kStateOption]),
|
stateFile: checkouts.fileSystem.file(argResults![kStateOption]),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -77,10 +75,10 @@ bool prompt(String message, Stdio stdio) {
|
|||||||
|
|
||||||
@visibleForTesting
|
@visibleForTesting
|
||||||
void runNext({
|
void runNext({
|
||||||
@required bool autoAccept,
|
required bool autoAccept,
|
||||||
@required bool force,
|
required bool force,
|
||||||
@required Checkouts checkouts,
|
required Checkouts checkouts,
|
||||||
@required File stateFile,
|
required File stateFile,
|
||||||
}) {
|
}) {
|
||||||
final Stdio stdio = checkouts.stdio;
|
final Stdio stdio = checkouts.stdio;
|
||||||
const List<CherrypickState> finishedStates = <CherrypickState>[
|
const List<CherrypickState> finishedStates = <CherrypickState>[
|
||||||
@ -341,7 +339,6 @@ void runNext({
|
|||||||
break;
|
break;
|
||||||
case pb.ReleasePhase.RELEASE_COMPLETED:
|
case pb.ReleasePhase.RELEASE_COMPLETED:
|
||||||
throw ConductorException('This release is finished.');
|
throw ConductorException('This release is finished.');
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
final ReleasePhase nextPhase = getNextPhase(state.currentPhase);
|
final ReleasePhase nextPhase = getNextPhase(state.currentPhase);
|
||||||
stdio.printStatus('\nUpdating phase from ${state.currentPhase} to $nextPhase...\n');
|
stdio.printStatus('\nUpdating phase from ${state.currentPhase} to $nextPhase...\n');
|
||||||
|
@ -22,8 +22,8 @@ if ! type dart >/dev/null 2>&1; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Pin protoc-gen-dart to pre-nullsafe version.
|
# Use null-safe protoc_plugin
|
||||||
dart pub global activate protoc_plugin 19.3.1
|
dart pub global activate protoc_plugin 20.0.0
|
||||||
|
|
||||||
protoc --dart_out="$DIR" --proto_path="$DIR" "$DIR/conductor_state.proto"
|
protoc --dart_out="$DIR" --proto_path="$DIR" "$DIR/conductor_state.proto"
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
// Generated code. Do not modify.
|
// Generated code. Do not modify.
|
||||||
// source: conductor_state.proto
|
// source: conductor_state.proto
|
||||||
//
|
//
|
||||||
// @dart = 2.7
|
// @dart = 2.12
|
||||||
// ignore_for_file: annotate_overrides,camel_case_types,unnecessary_const,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type,unnecessary_this,prefer_final_fields
|
// ignore_for_file: annotate_overrides,camel_case_types,unnecessary_const,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type,unnecessary_this,prefer_final_fields
|
||||||
|
|
||||||
import 'dart:core' as $core;
|
import 'dart:core' as $core;
|
||||||
@ -30,8 +30,8 @@ class Remote extends $pb.GeneratedMessage {
|
|||||||
|
|
||||||
Remote._() : super();
|
Remote._() : super();
|
||||||
factory Remote({
|
factory Remote({
|
||||||
$core.String name,
|
$core.String? name,
|
||||||
$core.String url,
|
$core.String? url,
|
||||||
}) {
|
}) {
|
||||||
final _result = create();
|
final _result = create();
|
||||||
if (name != null) {
|
if (name != null) {
|
||||||
@ -62,7 +62,7 @@ class Remote extends $pb.GeneratedMessage {
|
|||||||
static $pb.PbList<Remote> createRepeated() => $pb.PbList<Remote>();
|
static $pb.PbList<Remote> createRepeated() => $pb.PbList<Remote>();
|
||||||
@$core.pragma('dart2js:noInline')
|
@$core.pragma('dart2js:noInline')
|
||||||
static Remote getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<Remote>(create);
|
static Remote getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<Remote>(create);
|
||||||
static Remote _defaultInstance;
|
static Remote? _defaultInstance;
|
||||||
|
|
||||||
@$pb.TagNumber(1)
|
@$pb.TagNumber(1)
|
||||||
$core.String get name => $_getSZ(0);
|
$core.String get name => $_getSZ(0);
|
||||||
@ -106,9 +106,9 @@ class Cherrypick extends $pb.GeneratedMessage {
|
|||||||
|
|
||||||
Cherrypick._() : super();
|
Cherrypick._() : super();
|
||||||
factory Cherrypick({
|
factory Cherrypick({
|
||||||
$core.String trunkRevision,
|
$core.String? trunkRevision,
|
||||||
$core.String appliedRevision,
|
$core.String? appliedRevision,
|
||||||
CherrypickState state,
|
CherrypickState? state,
|
||||||
}) {
|
}) {
|
||||||
final _result = create();
|
final _result = create();
|
||||||
if (trunkRevision != null) {
|
if (trunkRevision != null) {
|
||||||
@ -142,7 +142,7 @@ class Cherrypick extends $pb.GeneratedMessage {
|
|||||||
static $pb.PbList<Cherrypick> createRepeated() => $pb.PbList<Cherrypick>();
|
static $pb.PbList<Cherrypick> createRepeated() => $pb.PbList<Cherrypick>();
|
||||||
@$core.pragma('dart2js:noInline')
|
@$core.pragma('dart2js:noInline')
|
||||||
static Cherrypick getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<Cherrypick>(create);
|
static Cherrypick getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<Cherrypick>(create);
|
||||||
static Cherrypick _defaultInstance;
|
static Cherrypick? _defaultInstance;
|
||||||
|
|
||||||
@$pb.TagNumber(1)
|
@$pb.TagNumber(1)
|
||||||
$core.String get trunkRevision => $_getSZ(0);
|
$core.String get trunkRevision => $_getSZ(0);
|
||||||
@ -210,15 +210,15 @@ class Repository extends $pb.GeneratedMessage {
|
|||||||
|
|
||||||
Repository._() : super();
|
Repository._() : super();
|
||||||
factory Repository({
|
factory Repository({
|
||||||
$core.String candidateBranch,
|
$core.String? candidateBranch,
|
||||||
$core.String startingGitHead,
|
$core.String? startingGitHead,
|
||||||
$core.String currentGitHead,
|
$core.String? currentGitHead,
|
||||||
$core.String checkoutPath,
|
$core.String? checkoutPath,
|
||||||
Remote upstream,
|
Remote? upstream,
|
||||||
Remote mirror,
|
Remote? mirror,
|
||||||
$core.Iterable<Cherrypick> cherrypicks,
|
$core.Iterable<Cherrypick>? cherrypicks,
|
||||||
$core.String dartRevision,
|
$core.String? dartRevision,
|
||||||
$core.String workingBranch,
|
$core.String? workingBranch,
|
||||||
}) {
|
}) {
|
||||||
final _result = create();
|
final _result = create();
|
||||||
if (candidateBranch != null) {
|
if (candidateBranch != null) {
|
||||||
@ -270,7 +270,7 @@ class Repository extends $pb.GeneratedMessage {
|
|||||||
static $pb.PbList<Repository> createRepeated() => $pb.PbList<Repository>();
|
static $pb.PbList<Repository> createRepeated() => $pb.PbList<Repository>();
|
||||||
@$core.pragma('dart2js:noInline')
|
@$core.pragma('dart2js:noInline')
|
||||||
static Repository getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<Repository>(create);
|
static Repository getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<Repository>(create);
|
||||||
static Repository _defaultInstance;
|
static Repository? _defaultInstance;
|
||||||
|
|
||||||
@$pb.TagNumber(1)
|
@$pb.TagNumber(1)
|
||||||
$core.String get candidateBranch => $_getSZ(0);
|
$core.String get candidateBranch => $_getSZ(0);
|
||||||
@ -407,15 +407,15 @@ class ConductorState extends $pb.GeneratedMessage {
|
|||||||
|
|
||||||
ConductorState._() : super();
|
ConductorState._() : super();
|
||||||
factory ConductorState({
|
factory ConductorState({
|
||||||
$core.String releaseChannel,
|
$core.String? releaseChannel,
|
||||||
$core.String releaseVersion,
|
$core.String? releaseVersion,
|
||||||
Repository engine,
|
Repository? engine,
|
||||||
Repository framework,
|
Repository? framework,
|
||||||
$fixnum.Int64 createdDate,
|
$fixnum.Int64? createdDate,
|
||||||
$fixnum.Int64 lastUpdatedDate,
|
$fixnum.Int64? lastUpdatedDate,
|
||||||
$core.Iterable<$core.String> logs,
|
$core.Iterable<$core.String>? logs,
|
||||||
ReleasePhase currentPhase,
|
ReleasePhase? currentPhase,
|
||||||
$core.String conductorVersion,
|
$core.String? conductorVersion,
|
||||||
}) {
|
}) {
|
||||||
final _result = create();
|
final _result = create();
|
||||||
if (releaseChannel != null) {
|
if (releaseChannel != null) {
|
||||||
@ -468,7 +468,7 @@ class ConductorState extends $pb.GeneratedMessage {
|
|||||||
static $pb.PbList<ConductorState> createRepeated() => $pb.PbList<ConductorState>();
|
static $pb.PbList<ConductorState> createRepeated() => $pb.PbList<ConductorState>();
|
||||||
@$core.pragma('dart2js:noInline')
|
@$core.pragma('dart2js:noInline')
|
||||||
static ConductorState getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<ConductorState>(create);
|
static ConductorState getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<ConductorState>(create);
|
||||||
static ConductorState _defaultInstance;
|
static ConductorState? _defaultInstance;
|
||||||
|
|
||||||
@$pb.TagNumber(1)
|
@$pb.TagNumber(1)
|
||||||
$core.String get releaseChannel => $_getSZ(0);
|
$core.String get releaseChannel => $_getSZ(0);
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
// Generated code. Do not modify.
|
// Generated code. Do not modify.
|
||||||
// source: conductor_state.proto
|
// source: conductor_state.proto
|
||||||
//
|
//
|
||||||
// @dart = 2.7
|
// @dart = 2.12
|
||||||
// ignore_for_file: annotate_overrides,camel_case_types,unnecessary_const,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type,unnecessary_this,prefer_final_fields
|
// ignore_for_file: annotate_overrides,camel_case_types,unnecessary_const,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type,unnecessary_this,prefer_final_fields
|
||||||
|
|
||||||
// ignore_for_file: UNDEFINED_SHOWN_NAME
|
// ignore_for_file: UNDEFINED_SHOWN_NAME
|
||||||
@ -40,7 +40,7 @@ class ReleasePhase extends $pb.ProtobufEnum {
|
|||||||
];
|
];
|
||||||
|
|
||||||
static final $core.Map<$core.int, ReleasePhase> _byValue = $pb.ProtobufEnum.initByValue(values);
|
static final $core.Map<$core.int, ReleasePhase> _byValue = $pb.ProtobufEnum.initByValue(values);
|
||||||
static ReleasePhase valueOf($core.int value) => _byValue[value];
|
static ReleasePhase? valueOf($core.int value) => _byValue[value];
|
||||||
|
|
||||||
const ReleasePhase._($core.int v, $core.String n) : super(v, n);
|
const ReleasePhase._($core.int v, $core.String n) : super(v, n);
|
||||||
}
|
}
|
||||||
@ -63,7 +63,7 @@ class CherrypickState extends $pb.ProtobufEnum {
|
|||||||
];
|
];
|
||||||
|
|
||||||
static final $core.Map<$core.int, CherrypickState> _byValue = $pb.ProtobufEnum.initByValue(values);
|
static final $core.Map<$core.int, CherrypickState> _byValue = $pb.ProtobufEnum.initByValue(values);
|
||||||
static CherrypickState valueOf($core.int value) => _byValue[value];
|
static CherrypickState? valueOf($core.int value) => _byValue[value];
|
||||||
|
|
||||||
const CherrypickState._($core.int v, $core.String n) : super(v, n);
|
const CherrypickState._($core.int v, $core.String n) : super(v, n);
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
// Generated code. Do not modify.
|
// Generated code. Do not modify.
|
||||||
// source: conductor_state.proto
|
// source: conductor_state.proto
|
||||||
//
|
//
|
||||||
// @dart = 2.7
|
// @dart = 2.12
|
||||||
// ignore_for_file: annotate_overrides,camel_case_types,unnecessary_const,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type,unnecessary_this,prefer_final_fields,deprecated_member_use_from_same_package
|
// ignore_for_file: annotate_overrides,camel_case_types,unnecessary_const,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type,unnecessary_this,prefer_final_fields,deprecated_member_use_from_same_package
|
||||||
|
|
||||||
import 'dart:core' as $core;
|
import 'dart:core' as $core;
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
// Generated code. Do not modify.
|
// Generated code. Do not modify.
|
||||||
// source: conductor_state.proto
|
// source: conductor_state.proto
|
||||||
//
|
//
|
||||||
// @dart = 2.7
|
// @dart = 2.12
|
||||||
// ignore_for_file: annotate_overrides,camel_case_types,unnecessary_const,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type,unnecessary_this,prefer_final_fields,deprecated_member_use_from_same_package
|
// ignore_for_file: annotate_overrides,camel_case_types,unnecessary_const,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type,unnecessary_this,prefer_final_fields,deprecated_member_use_from_same_package
|
||||||
|
|
||||||
export 'conductor_state.pb.dart';
|
export 'conductor_state.pb.dart';
|
||||||
|
@ -111,7 +111,7 @@ bool rollDev({
|
|||||||
required FrameworkRepository repository,
|
required FrameworkRepository repository,
|
||||||
}) {
|
}) {
|
||||||
final String remoteName = argResults[kRemoteName] as String;
|
final String remoteName = argResults[kRemoteName] as String;
|
||||||
final String level = argResults[kIncrement] as String;
|
final String? level = argResults[kIncrement] as String?;
|
||||||
final String candidateBranch = argResults[kCandidateBranch] as String;
|
final String candidateBranch = argResults[kCandidateBranch] as String;
|
||||||
final bool justPrint = argResults[kJustPrint] as bool;
|
final bool justPrint = argResults[kJustPrint] as bool;
|
||||||
final bool autoApprove = argResults[kYes] as bool;
|
final bool autoApprove = argResults[kYes] as bool;
|
||||||
|
@ -2,12 +2,10 @@
|
|||||||
// Use of this source code is governed by a BSD-style license that can be
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
// @dart = 2.8
|
import 'package:args/args.dart';
|
||||||
|
|
||||||
import 'package:args/command_runner.dart';
|
import 'package:args/command_runner.dart';
|
||||||
import 'package:file/file.dart';
|
import 'package:file/file.dart';
|
||||||
import 'package:fixnum/fixnum.dart';
|
import 'package:fixnum/fixnum.dart';
|
||||||
import 'package:meta/meta.dart';
|
|
||||||
import 'package:platform/platform.dart';
|
import 'package:platform/platform.dart';
|
||||||
import 'package:process/process.dart';
|
import 'package:process/process.dart';
|
||||||
|
|
||||||
@ -35,8 +33,8 @@ const String kStateOption = 'state-file';
|
|||||||
/// Command to print the status of the current Flutter release.
|
/// Command to print the status of the current Flutter release.
|
||||||
class StartCommand extends Command<void> {
|
class StartCommand extends Command<void> {
|
||||||
StartCommand({
|
StartCommand({
|
||||||
@required this.checkouts,
|
required this.checkouts,
|
||||||
@required this.flutterRoot,
|
required this.flutterRoot,
|
||||||
}) : platform = checkouts.platform,
|
}) : platform = checkouts.platform,
|
||||||
processManager = checkouts.processManager,
|
processManager = checkouts.processManager,
|
||||||
fileSystem = checkouts.fileSystem,
|
fileSystem = checkouts.fileSystem,
|
||||||
@ -125,7 +123,7 @@ class StartCommand extends Command<void> {
|
|||||||
final Stdio stdio;
|
final Stdio stdio;
|
||||||
|
|
||||||
/// Git revision for the currently running Conductor.
|
/// Git revision for the currently running Conductor.
|
||||||
String conductorVersion;
|
late final String conductorVersion;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get name => 'start';
|
String get name => 'start';
|
||||||
@ -135,6 +133,7 @@ class StartCommand extends Command<void> {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
void run() {
|
void run() {
|
||||||
|
final ArgResults argumentResults = argResults!;
|
||||||
if (!platform.isMacOS && !platform.isLinux) {
|
if (!platform.isMacOS && !platform.isLinux) {
|
||||||
throw ConductorException(
|
throw ConductorException(
|
||||||
'Error! This tool is only supported on macOS and Linux',
|
'Error! This tool is only supported on macOS and Linux',
|
||||||
@ -142,64 +141,64 @@ class StartCommand extends Command<void> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
final File stateFile = checkouts.fileSystem.file(
|
final File stateFile = checkouts.fileSystem.file(
|
||||||
getValueFromEnvOrArgs(kStateOption, argResults, platform.environment),
|
getValueFromEnvOrArgs(kStateOption, argumentResults, platform.environment),
|
||||||
);
|
);
|
||||||
if (stateFile.existsSync()) {
|
if (stateFile.existsSync()) {
|
||||||
throw ConductorException(
|
throw ConductorException(
|
||||||
'Error! A persistent state file already found at ${argResults[kStateOption]}.\n\n'
|
'Error! A persistent state file already found at ${argResults![kStateOption]}.\n\n'
|
||||||
'Run `conductor clean` to cancel a previous release.');
|
'Run `conductor clean` to cancel a previous release.');
|
||||||
}
|
}
|
||||||
final String frameworkUpstream = getValueFromEnvOrArgs(
|
final String frameworkUpstream = getValueFromEnvOrArgs(
|
||||||
kFrameworkUpstreamOption,
|
kFrameworkUpstreamOption,
|
||||||
argResults,
|
argumentResults,
|
||||||
platform.environment,
|
platform.environment,
|
||||||
);
|
)!;
|
||||||
final String frameworkMirror = getValueFromEnvOrArgs(
|
final String frameworkMirror = getValueFromEnvOrArgs(
|
||||||
kFrameworkMirrorOption,
|
kFrameworkMirrorOption,
|
||||||
argResults,
|
argumentResults,
|
||||||
platform.environment,
|
platform.environment,
|
||||||
);
|
)!;
|
||||||
final String engineUpstream = getValueFromEnvOrArgs(
|
final String engineUpstream = getValueFromEnvOrArgs(
|
||||||
kEngineUpstreamOption,
|
kEngineUpstreamOption,
|
||||||
argResults,
|
argumentResults,
|
||||||
platform.environment,
|
platform.environment,
|
||||||
);
|
)!;
|
||||||
final String engineMirror = getValueFromEnvOrArgs(
|
final String engineMirror = getValueFromEnvOrArgs(
|
||||||
kEngineMirrorOption,
|
kEngineMirrorOption,
|
||||||
argResults,
|
argumentResults,
|
||||||
platform.environment,
|
platform.environment,
|
||||||
);
|
)!;
|
||||||
final String candidateBranch = getValueFromEnvOrArgs(
|
final String candidateBranch = getValueFromEnvOrArgs(
|
||||||
kCandidateOption,
|
kCandidateOption,
|
||||||
argResults,
|
argumentResults,
|
||||||
platform.environment,
|
platform.environment,
|
||||||
);
|
)!;
|
||||||
final String releaseChannel = getValueFromEnvOrArgs(
|
final String releaseChannel = getValueFromEnvOrArgs(
|
||||||
kReleaseOption,
|
kReleaseOption,
|
||||||
argResults,
|
argumentResults,
|
||||||
platform.environment,
|
platform.environment,
|
||||||
);
|
)!;
|
||||||
final List<String> frameworkCherrypickRevisions = getValuesFromEnvOrArgs(
|
final List<String> frameworkCherrypickRevisions = getValuesFromEnvOrArgs(
|
||||||
kFrameworkCherrypicksOption,
|
kFrameworkCherrypicksOption,
|
||||||
argResults,
|
argumentResults,
|
||||||
platform.environment,
|
platform.environment,
|
||||||
);
|
);
|
||||||
final List<String> engineCherrypickRevisions = getValuesFromEnvOrArgs(
|
final List<String> engineCherrypickRevisions = getValuesFromEnvOrArgs(
|
||||||
kEngineCherrypicksOption,
|
kEngineCherrypicksOption,
|
||||||
argResults,
|
argumentResults,
|
||||||
platform.environment,
|
platform.environment,
|
||||||
);
|
);
|
||||||
final String dartRevision = getValueFromEnvOrArgs(
|
final String? dartRevision = getValueFromEnvOrArgs(
|
||||||
kDartRevisionOption,
|
kDartRevisionOption,
|
||||||
argResults,
|
argumentResults,
|
||||||
platform.environment,
|
platform.environment,
|
||||||
allowNull: true,
|
allowNull: true,
|
||||||
);
|
);
|
||||||
final String incrementLetter = getValueFromEnvOrArgs(
|
final String incrementLetter = getValueFromEnvOrArgs(
|
||||||
kIncrementOption,
|
kIncrementOption,
|
||||||
argResults,
|
argumentResults,
|
||||||
platform.environment,
|
platform.environment,
|
||||||
);
|
)!;
|
||||||
|
|
||||||
if (!releaseCandidateBranchRegex.hasMatch(candidateBranch)) {
|
if (!releaseCandidateBranchRegex.hasMatch(candidateBranch)) {
|
||||||
throw ConductorException(
|
throw ConductorException(
|
||||||
@ -270,7 +269,7 @@ class StartCommand extends Command<void> {
|
|||||||
cherrypicks: engineCherrypicks,
|
cherrypicks: engineCherrypicks,
|
||||||
dartRevision: dartRevision,
|
dartRevision: dartRevision,
|
||||||
upstream: pb.Remote(name: 'upstream', url: engine.upstreamRemote.url),
|
upstream: pb.Remote(name: 'upstream', url: engine.upstreamRemote.url),
|
||||||
mirror: pb.Remote(name: 'mirror', url: engine.mirrorRemote.url),
|
mirror: pb.Remote(name: 'mirror', url: engine.mirrorRemote!.url),
|
||||||
);
|
);
|
||||||
final FrameworkRepository framework = FrameworkRepository(
|
final FrameworkRepository framework = FrameworkRepository(
|
||||||
checkouts,
|
checkouts,
|
||||||
@ -328,7 +327,7 @@ class StartCommand extends Command<void> {
|
|||||||
checkoutPath: framework.checkoutDirectory.path,
|
checkoutPath: framework.checkoutDirectory.path,
|
||||||
cherrypicks: frameworkCherrypicks,
|
cherrypicks: frameworkCherrypicks,
|
||||||
upstream: pb.Remote(name: 'upstream', url: framework.upstreamRemote.url),
|
upstream: pb.Remote(name: 'upstream', url: framework.upstreamRemote.url),
|
||||||
mirror: pb.Remote(name: 'mirror', url: framework.mirrorRemote.url),
|
mirror: pb.Remote(name: 'mirror', url: framework.mirrorRemote!.url),
|
||||||
);
|
);
|
||||||
|
|
||||||
state.currentPhase = ReleasePhase.APPLY_ENGINE_CHERRYPICKS;
|
state.currentPhase = ReleasePhase.APPLY_ENGINE_CHERRYPICKS;
|
||||||
@ -344,10 +343,10 @@ class StartCommand extends Command<void> {
|
|||||||
|
|
||||||
// To minimize merge conflicts, sort the commits by rev-list order.
|
// To minimize merge conflicts, sort the commits by rev-list order.
|
||||||
List<String> _sortCherrypicks({
|
List<String> _sortCherrypicks({
|
||||||
@required Repository repository,
|
required Repository repository,
|
||||||
@required List<String> cherrypicks,
|
required List<String> cherrypicks,
|
||||||
@required String upstreamRef,
|
required String upstreamRef,
|
||||||
@required String releaseRef,
|
required String releaseRef,
|
||||||
}) {
|
}) {
|
||||||
if (cherrypicks.isEmpty) {
|
if (cherrypicks.isEmpty) {
|
||||||
return cherrypicks;
|
return cherrypicks;
|
||||||
|
@ -2,8 +2,6 @@
|
|||||||
// Use of this source code is governed by a BSD-style license that can be
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
// @dart = 2.8
|
|
||||||
|
|
||||||
import 'dart:convert' show jsonDecode, jsonEncode;
|
import 'dart:convert' show jsonDecode, jsonEncode;
|
||||||
|
|
||||||
import 'package:file/file.dart' show File;
|
import 'package:file/file.dart' show File;
|
||||||
@ -29,9 +27,12 @@ String luciConsoleLink(String channel, String groupName) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
String defaultStateFilePath(Platform platform) {
|
String defaultStateFilePath(Platform platform) {
|
||||||
assert(platform.environment['HOME'] != null);
|
final String? home = platform.environment['HOME'];
|
||||||
|
if (home == null) {
|
||||||
|
throw ConductorException(r'Environment variable $HOME must be set!');
|
||||||
|
}
|
||||||
return <String>[
|
return <String>[
|
||||||
platform.environment['HOME'],
|
home,
|
||||||
kStateFileName,
|
kStateFileName,
|
||||||
].join(platform.pathSeparator);
|
].join(platform.pathSeparator);
|
||||||
}
|
}
|
||||||
@ -170,12 +171,13 @@ String phaseInstructions(pb.ConductorState state) {
|
|||||||
///
|
///
|
||||||
/// Will throw a [ConductorException] if [ReleasePhase.RELEASE_COMPLETED] is
|
/// Will throw a [ConductorException] if [ReleasePhase.RELEASE_COMPLETED] is
|
||||||
/// passed as an argument, as there is no next phase.
|
/// passed as an argument, as there is no next phase.
|
||||||
ReleasePhase getNextPhase(ReleasePhase previousPhase) {
|
ReleasePhase getNextPhase(ReleasePhase currentPhase) {
|
||||||
assert(previousPhase != null);
|
assert(currentPhase != null);
|
||||||
if (previousPhase == ReleasePhase.RELEASE_COMPLETED) {
|
final ReleasePhase? nextPhase = ReleasePhase.valueOf(currentPhase.value + 1);
|
||||||
|
if (nextPhase == null) {
|
||||||
throw ConductorException('There is no next ReleasePhase!');
|
throw ConductorException('There is no next ReleasePhase!');
|
||||||
}
|
}
|
||||||
return ReleasePhase.valueOf(previousPhase.value + 1);
|
return nextPhase;
|
||||||
}
|
}
|
||||||
|
|
||||||
void writeStateToFile(File file, pb.ConductorState state, List<String> logs) {
|
void writeStateToFile(File file, pb.ConductorState state, List<String> logs) {
|
||||||
|
@ -2,11 +2,8 @@
|
|||||||
// Use of this source code is governed by a BSD-style license that can be
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
// @dart = 2.8
|
|
||||||
|
|
||||||
import 'package:args/command_runner.dart';
|
import 'package:args/command_runner.dart';
|
||||||
import 'package:file/file.dart';
|
import 'package:file/file.dart';
|
||||||
import 'package:meta/meta.dart';
|
|
||||||
import 'package:platform/platform.dart';
|
import 'package:platform/platform.dart';
|
||||||
|
|
||||||
import './proto/conductor_state.pb.dart' as pb;
|
import './proto/conductor_state.pb.dart' as pb;
|
||||||
@ -20,7 +17,7 @@ const String kStateOption = 'state-file';
|
|||||||
/// Command to print the status of the current Flutter release.
|
/// Command to print the status of the current Flutter release.
|
||||||
class StatusCommand extends Command<void> {
|
class StatusCommand extends Command<void> {
|
||||||
StatusCommand({
|
StatusCommand({
|
||||||
@required this.checkouts,
|
required this.checkouts,
|
||||||
}) : platform = checkouts.platform,
|
}) : platform = checkouts.platform,
|
||||||
fileSystem = checkouts.fileSystem,
|
fileSystem = checkouts.fileSystem,
|
||||||
stdio = checkouts.stdio {
|
stdio = checkouts.stdio {
|
||||||
@ -51,16 +48,16 @@ class StatusCommand extends Command<void> {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
void run() {
|
void run() {
|
||||||
final File stateFile = checkouts.fileSystem.file(argResults[kStateOption]);
|
final File stateFile = checkouts.fileSystem.file(argResults![kStateOption]);
|
||||||
if (!stateFile.existsSync()) {
|
if (!stateFile.existsSync()) {
|
||||||
stdio.printStatus(
|
stdio.printStatus(
|
||||||
'No persistent state file found at ${argResults[kStateOption]}.');
|
'No persistent state file found at ${argResults![kStateOption]}.');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
final pb.ConductorState state = readStateFromFile(stateFile);
|
final pb.ConductorState state = readStateFromFile(stateFile);
|
||||||
|
|
||||||
stdio.printStatus(presentState(state));
|
stdio.printStatus(presentState(state));
|
||||||
if (argResults[kVerboseFlag] as bool) {
|
if (argResults![kVerboseFlag] as bool) {
|
||||||
stdio.printStatus('\nLogs:');
|
stdio.printStatus('\nLogs:');
|
||||||
state.logs.forEach(stdio.printStatus);
|
state.logs.forEach(stdio.printStatus);
|
||||||
}
|
}
|
||||||
|
@ -2,8 +2,6 @@
|
|||||||
// Use of this source code is governed by a BSD-style license that can be
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
// @dart = 2.8
|
|
||||||
|
|
||||||
import 'package:args/command_runner.dart';
|
import 'package:args/command_runner.dart';
|
||||||
import 'package:conductor/clean.dart';
|
import 'package:conductor/clean.dart';
|
||||||
import 'package:conductor/repository.dart';
|
import 'package:conductor/repository.dart';
|
||||||
@ -19,32 +17,19 @@ void main() {
|
|||||||
const String flutterRoot = '/flutter';
|
const String flutterRoot = '/flutter';
|
||||||
const String checkoutsParentDirectory = '$flutterRoot/dev/tools/';
|
const String checkoutsParentDirectory = '$flutterRoot/dev/tools/';
|
||||||
|
|
||||||
MemoryFileSystem fileSystem;
|
late MemoryFileSystem fileSystem;
|
||||||
FakePlatform platform;
|
late FakePlatform platform;
|
||||||
TestStdio stdio;
|
late TestStdio stdio;
|
||||||
FakeProcessManager processManager;
|
late FakeProcessManager processManager;
|
||||||
|
late CommandRunner<void> runner;
|
||||||
|
|
||||||
setUp(() {
|
setUp(() {
|
||||||
stdio = TestStdio();
|
stdio = TestStdio();
|
||||||
fileSystem = MemoryFileSystem.test();
|
fileSystem = MemoryFileSystem.test();
|
||||||
});
|
final String operatingSystem = const LocalPlatform().operatingSystem;
|
||||||
|
|
||||||
tearDown(() {
|
|
||||||
// Ensure these don't get re-used between tests
|
|
||||||
stdio = null;
|
|
||||||
fileSystem = null;
|
|
||||||
processManager = null;
|
|
||||||
platform = null;
|
|
||||||
});
|
|
||||||
|
|
||||||
CommandRunner<void> createRunner({
|
|
||||||
List<FakeCommand> commands,
|
|
||||||
String operatingSystem,
|
|
||||||
}) {
|
|
||||||
operatingSystem ??= const LocalPlatform().operatingSystem;
|
|
||||||
final String pathSeparator = operatingSystem == 'windows' ? r'\' : '/';
|
final String pathSeparator = operatingSystem == 'windows' ? r'\' : '/';
|
||||||
|
|
||||||
processManager = FakeProcessManager.list(commands ?? <FakeCommand>[]);
|
processManager = FakeProcessManager.empty();
|
||||||
platform = FakePlatform(
|
platform = FakePlatform(
|
||||||
environment: <String, String>{'HOME': '/path/to/user/home'},
|
environment: <String, String>{'HOME': '/path/to/user/home'},
|
||||||
pathSeparator: pathSeparator,
|
pathSeparator: pathSeparator,
|
||||||
@ -59,11 +44,10 @@ void main() {
|
|||||||
final CleanCommand command = CleanCommand(
|
final CleanCommand command = CleanCommand(
|
||||||
checkouts: checkouts,
|
checkouts: checkouts,
|
||||||
);
|
);
|
||||||
return CommandRunner<void>('clean-test', '')..addCommand(command);
|
runner = CommandRunner<void>('clean-test', '')..addCommand(command);
|
||||||
}
|
});
|
||||||
|
|
||||||
test('throws if no state file found', () async {
|
test('throws if no state file found', () async {
|
||||||
final CommandRunner<void> runner = createRunner();
|
|
||||||
const String stateFile = '/state-file.json';
|
const String stateFile = '/state-file.json';
|
||||||
|
|
||||||
await expectLater(
|
await expectLater(
|
||||||
@ -80,7 +64,6 @@ void main() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('deletes state file', () async {
|
test('deletes state file', () async {
|
||||||
final CommandRunner<void> runner = createRunner();
|
|
||||||
final File stateFile = fileSystem.file('/state-file.json');
|
final File stateFile = fileSystem.file('/state-file.json');
|
||||||
stateFile.writeAsStringSync('{}');
|
stateFile.writeAsStringSync('{}');
|
||||||
|
|
||||||
|
@ -56,7 +56,7 @@ class TestStdio extends Stdio {
|
|||||||
|
|
||||||
class FakeArgResults implements ArgResults {
|
class FakeArgResults implements ArgResults {
|
||||||
FakeArgResults({
|
FakeArgResults({
|
||||||
required String level,
|
required String? level,
|
||||||
required String candidateBranch,
|
required String candidateBranch,
|
||||||
String remote = 'upstream',
|
String remote = 'upstream',
|
||||||
bool justPrint = false,
|
bool justPrint = false,
|
||||||
|
@ -2,8 +2,6 @@
|
|||||||
// Use of this source code is governed by a BSD-style license that can be
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
// @dart = 2.8
|
|
||||||
|
|
||||||
import 'package:args/command_runner.dart';
|
import 'package:args/command_runner.dart';
|
||||||
import 'package:conductor/next.dart';
|
import 'package:conductor/next.dart';
|
||||||
import 'package:conductor/proto/conductor_state.pb.dart' as pb;
|
import 'package:conductor/proto/conductor_state.pb.dart' as pb;
|
||||||
@ -12,7 +10,6 @@ import 'package:conductor/repository.dart';
|
|||||||
import 'package:conductor/state.dart';
|
import 'package:conductor/state.dart';
|
||||||
import 'package:file/file.dart';
|
import 'package:file/file.dart';
|
||||||
import 'package:file/memory.dart';
|
import 'package:file/memory.dart';
|
||||||
import 'package:meta/meta.dart';
|
|
||||||
import 'package:platform/platform.dart';
|
import 'package:platform/platform.dart';
|
||||||
|
|
||||||
import './common.dart';
|
import './common.dart';
|
||||||
@ -31,8 +28,8 @@ void main() {
|
|||||||
const String revision3 = '789aaa';
|
const String revision3 = '789aaa';
|
||||||
const String releaseVersion = '1.2.0-3.0.pre';
|
const String releaseVersion = '1.2.0-3.0.pre';
|
||||||
const String releaseChannel = 'beta';
|
const String releaseChannel = 'beta';
|
||||||
MemoryFileSystem fileSystem;
|
late MemoryFileSystem fileSystem;
|
||||||
TestStdio stdio;
|
late TestStdio stdio;
|
||||||
const String stateFile = '/state-file.json';
|
const String stateFile = '/state-file.json';
|
||||||
|
|
||||||
setUp(() {
|
setUp(() {
|
||||||
@ -41,7 +38,7 @@ void main() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
CommandRunner<void> createRunner({
|
CommandRunner<void> createRunner({
|
||||||
@required Checkouts checkouts,
|
required Checkouts checkouts,
|
||||||
}) {
|
}) {
|
||||||
final NextCommand command = NextCommand(
|
final NextCommand command = NextCommand(
|
||||||
checkouts: checkouts,
|
checkouts: checkouts,
|
||||||
@ -239,9 +236,9 @@ void main() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
group('CODESIGN_ENGINE_BINARIES to APPLY_FRAMEWORK_CHERRYPICKS', () {
|
group('CODESIGN_ENGINE_BINARIES to APPLY_FRAMEWORK_CHERRYPICKS', () {
|
||||||
pb.ConductorState state;
|
late pb.ConductorState state;
|
||||||
FakeProcessManager processManager;
|
late FakeProcessManager processManager;
|
||||||
FakePlatform platform;
|
late FakePlatform platform;
|
||||||
|
|
||||||
setUp(() {
|
setUp(() {
|
||||||
state = pb.ConductorState(
|
state = pb.ConductorState(
|
||||||
@ -341,9 +338,9 @@ void main() {
|
|||||||
const String frameworkCheckoutPath = '$checkoutsParentDirectory/framework';
|
const String frameworkCheckoutPath = '$checkoutsParentDirectory/framework';
|
||||||
const String engineCheckoutPath = '$checkoutsParentDirectory/engine';
|
const String engineCheckoutPath = '$checkoutsParentDirectory/engine';
|
||||||
const String oldEngineVersion = '000000001';
|
const String oldEngineVersion = '000000001';
|
||||||
FakeProcessManager processManager;
|
late FakeProcessManager processManager;
|
||||||
FakePlatform platform;
|
late FakePlatform platform;
|
||||||
pb.ConductorState state;
|
late pb.ConductorState state;
|
||||||
|
|
||||||
setUp(() {
|
setUp(() {
|
||||||
processManager = FakeProcessManager.empty();
|
processManager = FakeProcessManager.empty();
|
||||||
@ -640,8 +637,8 @@ void main() {
|
|||||||
group('PUBLISH_VERSION to PUBLISH_CHANNEL', () {
|
group('PUBLISH_VERSION to PUBLISH_CHANNEL', () {
|
||||||
const String remoteName = 'upstream';
|
const String remoteName = 'upstream';
|
||||||
const String releaseVersion = '1.2.0-3.0.pre';
|
const String releaseVersion = '1.2.0-3.0.pre';
|
||||||
pb.ConductorState state;
|
late pb.ConductorState state;
|
||||||
FakePlatform platform;
|
late FakePlatform platform;
|
||||||
|
|
||||||
setUp(() {
|
setUp(() {
|
||||||
state = pb.ConductorState(
|
state = pb.ConductorState(
|
||||||
@ -766,8 +763,8 @@ void main() {
|
|||||||
|
|
||||||
group('PUBLISH_CHANNEL to VERIFY_RELEASE', () {
|
group('PUBLISH_CHANNEL to VERIFY_RELEASE', () {
|
||||||
const String remoteName = 'upstream';
|
const String remoteName = 'upstream';
|
||||||
pb.ConductorState state;
|
late pb.ConductorState state;
|
||||||
FakePlatform platform;
|
late FakePlatform platform;
|
||||||
|
|
||||||
setUp(() {
|
setUp(() {
|
||||||
state = pb.ConductorState(
|
state = pb.ConductorState(
|
||||||
|
@ -2,8 +2,6 @@
|
|||||||
// Use of this source code is governed by a BSD-style license that can be
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
// @dart = 2.8
|
|
||||||
|
|
||||||
import 'package:conductor/globals.dart';
|
import 'package:conductor/globals.dart';
|
||||||
import 'package:conductor/repository.dart';
|
import 'package:conductor/repository.dart';
|
||||||
import 'package:conductor/roll_dev.dart';
|
import 'package:conductor/roll_dev.dart';
|
||||||
@ -23,13 +21,13 @@ void main() {
|
|||||||
const String nextVersion = '1.2.0-2.0.pre';
|
const String nextVersion = '1.2.0-2.0.pre';
|
||||||
const String candidateBranch = 'flutter-1.2-candidate.2';
|
const String candidateBranch = 'flutter-1.2-candidate.2';
|
||||||
const String checkoutsParentDirectory = '/path/to/directory/';
|
const String checkoutsParentDirectory = '/path/to/directory/';
|
||||||
FakeArgResults fakeArgResults;
|
late FakeArgResults fakeArgResults;
|
||||||
MemoryFileSystem fileSystem;
|
late MemoryFileSystem fileSystem;
|
||||||
TestStdio stdio;
|
late TestStdio stdio;
|
||||||
FrameworkRepository repo;
|
late FrameworkRepository repo;
|
||||||
Checkouts checkouts;
|
late Checkouts checkouts;
|
||||||
FakePlatform platform;
|
late FakePlatform platform;
|
||||||
FakeProcessManager processManager;
|
late FakeProcessManager processManager;
|
||||||
|
|
||||||
setUp(() {
|
setUp(() {
|
||||||
stdio = TestStdio();
|
stdio = TestStdio();
|
||||||
|
@ -2,8 +2,6 @@
|
|||||||
// Use of this source code is governed by a BSD-style license that can be
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
// @dart = 2.8
|
|
||||||
|
|
||||||
import 'dart:convert' show jsonDecode;
|
import 'dart:convert' show jsonDecode;
|
||||||
|
|
||||||
import 'package:args/command_runner.dart';
|
import 'package:args/command_runner.dart';
|
||||||
@ -28,11 +26,11 @@ void main() {
|
|||||||
const String candidateBranch = 'flutter-1.2-candidate.3';
|
const String candidateBranch = 'flutter-1.2-candidate.3';
|
||||||
const String releaseChannel = 'stable';
|
const String releaseChannel = 'stable';
|
||||||
const String revision = 'abcd1234';
|
const String revision = 'abcd1234';
|
||||||
Checkouts checkouts;
|
late Checkouts checkouts;
|
||||||
MemoryFileSystem fileSystem;
|
late MemoryFileSystem fileSystem;
|
||||||
FakePlatform platform;
|
late FakePlatform platform;
|
||||||
TestStdio stdio;
|
late TestStdio stdio;
|
||||||
FakeProcessManager processManager;
|
late FakeProcessManager processManager;
|
||||||
|
|
||||||
setUp(() {
|
setUp(() {
|
||||||
stdio = TestStdio();
|
stdio = TestStdio();
|
||||||
@ -40,9 +38,9 @@ void main() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
CommandRunner<void> createRunner({
|
CommandRunner<void> createRunner({
|
||||||
Map<String, String> environment,
|
Map<String, String>? environment,
|
||||||
String operatingSystem,
|
String? operatingSystem,
|
||||||
List<FakeCommand> commands,
|
List<FakeCommand>? commands,
|
||||||
}) {
|
}) {
|
||||||
operatingSystem ??= const LocalPlatform().operatingSystem;
|
operatingSystem ??= const LocalPlatform().operatingSystem;
|
||||||
final String pathSeparator = operatingSystem == 'windows' ? r'\' : '/';
|
final String pathSeparator = operatingSystem == 'windows' ? r'\' : '/';
|
||||||
@ -74,13 +72,6 @@ void main() {
|
|||||||
return CommandRunner<void>('codesign-test', '')..addCommand(command);
|
return CommandRunner<void>('codesign-test', '')..addCommand(command);
|
||||||
}
|
}
|
||||||
|
|
||||||
tearDown(() {
|
|
||||||
// Ensure we don't re-use these between tests.
|
|
||||||
processManager = null;
|
|
||||||
checkouts = null;
|
|
||||||
platform = null;
|
|
||||||
});
|
|
||||||
|
|
||||||
test('throws exception if run from Windows', () async {
|
test('throws exception if run from Windows', () async {
|
||||||
final CommandRunner<void> runner = createRunner(
|
final CommandRunner<void> runner = createRunner(
|
||||||
commands: <FakeCommand>[
|
commands: <FakeCommand>[
|
||||||
@ -251,7 +242,7 @@ void main() {
|
|||||||
);
|
);
|
||||||
|
|
||||||
final String stateFilePath = fileSystem.path.join(
|
final String stateFilePath = fileSystem.path.join(
|
||||||
platform.environment['HOME'],
|
platform.environment['HOME']!,
|
||||||
kStateFileName,
|
kStateFileName,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user