implicit-casts:false in dev (#45787)
This commit is contained in:
committed by
GitHub
parent
fa0c49d775
commit
ec1a015045
@@ -78,7 +78,7 @@ void main(List<String> arguments) {
|
||||
|
||||
final ArgResults parsedArguments = argParser.parse(arguments);
|
||||
|
||||
if (parsedArguments['help']) {
|
||||
if (parsedArguments['help'] as bool) {
|
||||
print(argParser.usage);
|
||||
exit(0);
|
||||
}
|
||||
@@ -93,8 +93,9 @@ void main(List<String> arguments) {
|
||||
|
||||
Directory tempDirectory;
|
||||
if (parsedArguments.wasParsed('temp')) {
|
||||
tempDirectory = Directory(path.join(Directory.systemTemp.absolute.path, path.basename(parsedArguments['temp'])));
|
||||
if (path.basename(parsedArguments['temp']) != parsedArguments['temp']) {
|
||||
final String tempArg = parsedArguments['temp'] as String;
|
||||
tempDirectory = Directory(path.join(Directory.systemTemp.absolute.path, path.basename(tempArg)));
|
||||
if (path.basename(tempArg) != tempArg) {
|
||||
stderr.writeln('Supplied temporary directory name should be a name, not a path. Using ${tempDirectory.absolute.path} instead.');
|
||||
}
|
||||
print('Leaving temporary output in ${tempDirectory.absolute.path}.');
|
||||
@@ -106,7 +107,11 @@ void main(List<String> arguments) {
|
||||
tempDirectory.createSync();
|
||||
}
|
||||
try {
|
||||
exitCode = SampleChecker(flutterPackage, tempDirectory: tempDirectory, verbose: parsedArguments['verbose']).checkSamples();
|
||||
exitCode = SampleChecker(
|
||||
flutterPackage,
|
||||
tempDirectory: tempDirectory,
|
||||
verbose: parsedArguments['verbose'] as bool,
|
||||
).checkSamples();
|
||||
} on SampleCheckerException catch (e) {
|
||||
stderr.write(e);
|
||||
exit(1);
|
||||
|
||||
@@ -290,10 +290,11 @@ const Set<String> _exemptTestImports = <String>{
|
||||
Future<void> verifyNoTestImports(String workingDirectory) async {
|
||||
final List<String> errors = <String>[];
|
||||
assert("// foo\nimport 'binding_test.dart' as binding;\n'".contains(_testImportPattern));
|
||||
for (FileSystemEntity entity in Directory(path.join(workingDirectory, 'packages'))
|
||||
final Iterable<File> dartFiles = Directory(path.join(workingDirectory, 'packages'))
|
||||
.listSync(recursive: true)
|
||||
.where((FileSystemEntity entity) => entity is File && path.extension(entity.path) == '.dart')) {
|
||||
final File file = entity;
|
||||
.whereType<File>()
|
||||
.where((File file) => path.extension(file.path) == '.dart');
|
||||
for (File file in dartFiles) {
|
||||
for (String line in file.readAsLinesSync()) {
|
||||
final Match match = _testImportPattern.firstMatch(line);
|
||||
if (match != null && !_exemptTestImports.contains(match.group(2)))
|
||||
@@ -316,11 +317,9 @@ Future<void> verifyNoTestPackageImports(String workingDirectory) async {
|
||||
final List<String> shims = <String>[];
|
||||
final List<String> errors = Directory(workingDirectory)
|
||||
.listSync(recursive: true)
|
||||
.where((FileSystemEntity entity) {
|
||||
return entity is File && entity.path.endsWith('.dart');
|
||||
})
|
||||
.map<String>((FileSystemEntity entity) {
|
||||
final File file = entity;
|
||||
.whereType<File>()
|
||||
.where((File file) => file.path.endsWith('.dart'))
|
||||
.map<String>((File file) {
|
||||
final String name = Uri.file(path.relative(file.path,
|
||||
from: workingDirectory)).toFilePath(windows: false);
|
||||
if (name.startsWith('bin/cache') ||
|
||||
@@ -395,14 +394,10 @@ Future<void> verifyGeneratedPluginRegistrants(String flutterRoot) async {
|
||||
|
||||
final Map<String, List<File>> packageToRegistrants = <String, List<File>>{};
|
||||
|
||||
for (FileSystemEntity entity in flutterRootDir.listSync(recursive: true)) {
|
||||
if (entity is! File)
|
||||
continue;
|
||||
if (_isGeneratedPluginRegistrant(entity)) {
|
||||
final String package = _getPackageFor(entity, flutterRootDir);
|
||||
final List<File> registrants = packageToRegistrants.putIfAbsent(package, () => <File>[]);
|
||||
registrants.add(entity);
|
||||
}
|
||||
for (File file in flutterRootDir.listSync(recursive: true).whereType<File>().where(_isGeneratedPluginRegistrant)) {
|
||||
final String package = _getPackageFor(file, flutterRootDir);
|
||||
final List<File> registrants = packageToRegistrants.putIfAbsent(package, () => <File>[]);
|
||||
registrants.add(file);
|
||||
}
|
||||
|
||||
final Set<String> outOfDate = <String>{};
|
||||
@@ -497,10 +492,11 @@ Future<void> verifyNoBadImportsInFlutter(String workingDirectory) async {
|
||||
|
||||
Future<void> verifyNoBadImportsInFlutterTools(String workingDirectory) async {
|
||||
final List<String> errors = <String>[];
|
||||
for (FileSystemEntity entity in Directory(path.join(workingDirectory, 'packages', 'flutter_tools', 'lib'))
|
||||
final Iterable<File> files = Directory(path.join(workingDirectory, 'packages', 'flutter_tools', 'lib'))
|
||||
.listSync(recursive: true)
|
||||
.where((FileSystemEntity entity) => entity is File && path.extension(entity.path) == '.dart')) {
|
||||
final File file = entity;
|
||||
.whereType<File>()
|
||||
.where((File file) => path.extension(file.path) == '.dart');
|
||||
for (File file in files) {
|
||||
if (file.readAsStringSync().contains('package:flutter_tools/')) {
|
||||
errors.add('$yellow${file.path}$reset imports flutter_tools.');
|
||||
}
|
||||
@@ -745,31 +741,33 @@ final RegExp _importPattern = RegExp(r'''^\s*import (['"])package:flutter/([^.]+
|
||||
final RegExp _importMetaPattern = RegExp(r'''^\s*import (['"])package:meta/meta\.dart\1''');
|
||||
|
||||
Set<String> _findFlutterDependencies(String srcPath, List<String> errors, { bool checkForMeta = false }) {
|
||||
return Directory(srcPath).listSync(recursive: true).where((FileSystemEntity entity) {
|
||||
return entity is File && path.extension(entity.path) == '.dart';
|
||||
}).map<Set<String>>((FileSystemEntity entity) {
|
||||
final Set<String> result = <String>{};
|
||||
final File file = entity;
|
||||
for (String line in file.readAsLinesSync()) {
|
||||
Match match = _importPattern.firstMatch(line);
|
||||
if (match != null)
|
||||
result.add(match.group(2));
|
||||
if (checkForMeta) {
|
||||
match = _importMetaPattern.firstMatch(line);
|
||||
if (match != null) {
|
||||
errors.add(
|
||||
'${file.path}\nThis package imports the ${yellow}meta$reset package.\n'
|
||||
'You should instead import the "foundation.dart" library.'
|
||||
);
|
||||
return Directory(srcPath)
|
||||
.listSync(recursive: true)
|
||||
.whereType<File>()
|
||||
.where((File file) => path.extension(file.path) == '.dart')
|
||||
.map<Set<String>>((File file) {
|
||||
final Set<String> result = <String>{};
|
||||
for (String line in file.readAsLinesSync()) {
|
||||
Match match = _importPattern.firstMatch(line);
|
||||
if (match != null)
|
||||
result.add(match.group(2));
|
||||
if (checkForMeta) {
|
||||
match = _importMetaPattern.firstMatch(line);
|
||||
if (match != null) {
|
||||
errors.add(
|
||||
'${file.path}\nThis package imports the ${yellow}meta$reset package.\n'
|
||||
'You should instead import the "foundation.dart" library.'
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}).reduce((Set<String> value, Set<String> element) {
|
||||
value ??= <String>{};
|
||||
value.addAll(element);
|
||||
return value;
|
||||
});
|
||||
return result;
|
||||
})
|
||||
.reduce((Set<String> value, Set<String> element) {
|
||||
value ??= <String>{};
|
||||
value.addAll(element);
|
||||
return value;
|
||||
});
|
||||
}
|
||||
|
||||
List<T> _deepSearch<T>(Map<T, Set<T>> map, T start, [ Set<T> seen ]) {
|
||||
|
||||
@@ -82,9 +82,9 @@ class FlutterCompactFormatter {
|
||||
print(raw);
|
||||
return null;
|
||||
}
|
||||
final Map<String, dynamic> decoded = json.decode(raw);
|
||||
final Map<String, dynamic> decoded = json.decode(raw) as Map<String, dynamic>;
|
||||
final TestResult originalResult = _tests[decoded['testID']];
|
||||
switch (decoded['type']) {
|
||||
switch (decoded['type'] as String) {
|
||||
case 'done':
|
||||
stdout.write(_clearLine);
|
||||
stdout.write('$_bold${_stopwatch.elapsed}$_noColor ');
|
||||
@@ -92,7 +92,7 @@ class FlutterCompactFormatter {
|
||||
'$_green+$successes $_yellow~$skips $_red-$failures:$_bold$_gray Done.$_noColor');
|
||||
break;
|
||||
case 'testStart':
|
||||
final Map<String, dynamic> testData = decoded['test'];
|
||||
final Map<String, dynamic> testData = decoded['test'] as Map<String, dynamic>;
|
||||
if (testData['url'] == null) {
|
||||
started += 1;
|
||||
stdout.write(_clearLine);
|
||||
@@ -101,20 +101,20 @@ class FlutterCompactFormatter {
|
||||
'$_green+$successes $_yellow~$skips $_red-$failures: $_gray${testData['name']}$_noColor');
|
||||
break;
|
||||
}
|
||||
_tests[testData['id']] = TestResult(
|
||||
id: testData['id'],
|
||||
name: testData['name'],
|
||||
line: testData['root_line'] ?? testData['line'],
|
||||
column: testData['root_column'] ?? testData['column'],
|
||||
path: testData['root_url'] ?? testData['url'],
|
||||
startTime: decoded['time'],
|
||||
_tests[testData['id'] as int] = TestResult(
|
||||
id: testData['id'] as int,
|
||||
name: testData['name'] as String,
|
||||
line: testData['root_line'] as int ?? testData['line'] as int,
|
||||
column: testData['root_column'] as int ?? testData['column'] as int,
|
||||
path: testData['root_url'] as String ?? testData['url'] as String,
|
||||
startTime: decoded['time'] as int,
|
||||
);
|
||||
break;
|
||||
case 'testDone':
|
||||
if (originalResult == null) {
|
||||
break;
|
||||
}
|
||||
originalResult.endTime = decoded['time'];
|
||||
originalResult.endTime = decoded['time'] as int;
|
||||
if (decoded['skipped'] == true) {
|
||||
skips += 1;
|
||||
originalResult.status = TestStatus.skipped;
|
||||
@@ -129,8 +129,8 @@ class FlutterCompactFormatter {
|
||||
}
|
||||
break;
|
||||
case 'error':
|
||||
final String error = decoded['error'];
|
||||
final String stackTrace = decoded['stackTrace'];
|
||||
final String error = decoded['error'] as String;
|
||||
final String stackTrace = decoded['stackTrace'] as String;
|
||||
if (originalResult != null) {
|
||||
originalResult.errorMessage = error;
|
||||
originalResult.stackTrace = stackTrace;
|
||||
@@ -143,7 +143,7 @@ class FlutterCompactFormatter {
|
||||
break;
|
||||
case 'print':
|
||||
if (originalResult != null) {
|
||||
originalResult.messages.add(decoded['message']);
|
||||
originalResult.messages.add(decoded['message'] as String);
|
||||
}
|
||||
break;
|
||||
case 'group':
|
||||
|
||||
@@ -39,7 +39,7 @@ class PreparePackageException implements Exception {
|
||||
if (message != null) {
|
||||
output += ': $message';
|
||||
}
|
||||
final String stderr = result?.stderr ?? '';
|
||||
final String stderr = result?.stderr as String ?? '';
|
||||
if (stderr.isNotEmpty) {
|
||||
output += ':\n$stderr';
|
||||
}
|
||||
@@ -526,15 +526,15 @@ class ArchivePublisher {
|
||||
newEntry['sha256'] = await _getChecksum(outputFile);
|
||||
|
||||
// Search for any entries with the same hash and channel and remove them.
|
||||
final List<dynamic> releases = jsonData['releases'];
|
||||
final List<dynamic> releases = jsonData['releases'] as List<dynamic>;
|
||||
jsonData['releases'] = <Map<String, dynamic>>[
|
||||
for (Map<String, dynamic> entry in releases)
|
||||
for (Map<String, dynamic> entry in releases.cast<Map<String, dynamic>>())
|
||||
if (entry['hash'] != newEntry['hash'] || entry['channel'] != newEntry['channel'])
|
||||
entry,
|
||||
newEntry,
|
||||
]..sort((Map<String, dynamic> a, Map<String, dynamic> b) {
|
||||
final DateTime aDate = DateTime.parse(a['release_date']);
|
||||
final DateTime bDate = DateTime.parse(b['release_date']);
|
||||
final DateTime aDate = DateTime.parse(a['release_date'] as String);
|
||||
final DateTime bDate = DateTime.parse(b['release_date'] as String);
|
||||
return bDate.compareTo(aDate);
|
||||
});
|
||||
return jsonData;
|
||||
@@ -556,7 +556,7 @@ class ArchivePublisher {
|
||||
|
||||
Map<String, dynamic> jsonData;
|
||||
try {
|
||||
jsonData = json.decode(currentMetadata);
|
||||
jsonData = json.decode(currentMetadata) as Map<String, dynamic>;
|
||||
} on FormatException catch (e) {
|
||||
throw PreparePackageException('Unable to parse JSON metadata received from cloud: $e');
|
||||
}
|
||||
@@ -665,7 +665,7 @@ Future<void> main(List<String> rawArguments) async {
|
||||
|
||||
final ArgResults parsedArguments = argParser.parse(rawArguments);
|
||||
|
||||
if (parsedArguments['help']) {
|
||||
if (parsedArguments['help'] as bool) {
|
||||
print(argParser.usage);
|
||||
exit(0);
|
||||
}
|
||||
@@ -676,7 +676,7 @@ Future<void> main(List<String> rawArguments) async {
|
||||
exit(exitCode);
|
||||
}
|
||||
|
||||
final String revision = parsedArguments['revision'];
|
||||
final String revision = parsedArguments['revision'] as String;
|
||||
if (revision.isEmpty) {
|
||||
errorExit('Invalid argument: --revision must be specified.');
|
||||
}
|
||||
@@ -684,19 +684,20 @@ Future<void> main(List<String> rawArguments) async {
|
||||
errorExit('Invalid argument: --revision must be the entire hash, not just a prefix.');
|
||||
}
|
||||
|
||||
if (parsedArguments['branch'].isEmpty) {
|
||||
if ((parsedArguments['branch'] as String).isEmpty) {
|
||||
errorExit('Invalid argument: --branch must be specified.');
|
||||
}
|
||||
|
||||
final String tempDirArg = parsedArguments['temp_dir'] as String;
|
||||
Directory tempDir;
|
||||
bool removeTempDir = false;
|
||||
if (parsedArguments['temp_dir'] == null || parsedArguments['temp_dir'].isEmpty) {
|
||||
if (tempDirArg == null || tempDirArg.isEmpty) {
|
||||
tempDir = Directory.systemTemp.createTempSync('flutter_package.');
|
||||
removeTempDir = true;
|
||||
} else {
|
||||
tempDir = Directory(parsedArguments['temp_dir']);
|
||||
tempDir = Directory(tempDirArg);
|
||||
if (!tempDir.existsSync()) {
|
||||
errorExit("Temporary directory ${parsedArguments['temp_dir']} doesn't exist.");
|
||||
errorExit("Temporary directory $tempDirArg doesn't exist.");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -704,20 +705,20 @@ Future<void> main(List<String> rawArguments) async {
|
||||
if (parsedArguments['output'] == null) {
|
||||
outputDir = tempDir;
|
||||
} else {
|
||||
outputDir = Directory(parsedArguments['output']);
|
||||
outputDir = Directory(parsedArguments['output'] as String);
|
||||
if (!outputDir.existsSync()) {
|
||||
outputDir.createSync(recursive: true);
|
||||
}
|
||||
}
|
||||
|
||||
final Branch branch = fromBranchName(parsedArguments['branch']);
|
||||
final ArchiveCreator creator = ArchiveCreator(tempDir, outputDir, revision, branch, strict: parsedArguments['publish']);
|
||||
final Branch branch = fromBranchName(parsedArguments['branch'] as String);
|
||||
final ArchiveCreator creator = ArchiveCreator(tempDir, outputDir, revision, branch, strict: parsedArguments['publish'] as bool);
|
||||
int exitCode = 0;
|
||||
String message;
|
||||
try {
|
||||
final String version = await creator.initializeRepo();
|
||||
final File outputFile = await creator.createArchive();
|
||||
if (parsedArguments['publish']) {
|
||||
if (parsedArguments['publish'] as bool) {
|
||||
final ArchivePublisher publisher = ArchivePublisher(
|
||||
tempDir,
|
||||
revision,
|
||||
|
||||
@@ -47,7 +47,7 @@ class FakeProcessManager extends Mock implements ProcessManager {
|
||||
void verifyCalls(List<String> calls) {
|
||||
int index = 0;
|
||||
for (String call in calls) {
|
||||
expect(call.split(' '), orderedEquals(invocations[index].positionalArguments[0]));
|
||||
expect(call.split(' '), orderedEquals(invocations[index].positionalArguments[0] as Iterable<dynamic>));
|
||||
index++;
|
||||
}
|
||||
expect(invocations.length, equals(calls.length));
|
||||
@@ -66,17 +66,17 @@ class FakeProcessManager extends Mock implements ProcessManager {
|
||||
|
||||
Future<Process> _nextProcess(Invocation invocation) async {
|
||||
invocations.add(invocation);
|
||||
return Future<Process>.value(_popProcess(invocation.positionalArguments[0]));
|
||||
return Future<Process>.value(_popProcess(invocation.positionalArguments[0] as List<String>));
|
||||
}
|
||||
|
||||
ProcessResult _nextResultSync(Invocation invocation) {
|
||||
invocations.add(invocation);
|
||||
return _popResult(invocation.positionalArguments[0]);
|
||||
return _popResult(invocation.positionalArguments[0] as List<String>);
|
||||
}
|
||||
|
||||
Future<ProcessResult> _nextResult(Invocation invocation) async {
|
||||
invocations.add(invocation);
|
||||
return Future<ProcessResult>.value(_popResult(invocation.positionalArguments[0]));
|
||||
return Future<ProcessResult>.value(_popResult(invocation.positionalArguments[0] as List<String>));
|
||||
}
|
||||
|
||||
void _setupMock() {
|
||||
@@ -117,8 +117,8 @@ class FakeProcessManager extends Mock implements ProcessManager {
|
||||
/// A fake process that can be used to interact with a process "started" by the FakeProcessManager.
|
||||
class FakeProcess extends Mock implements Process {
|
||||
FakeProcess(ProcessResult result, {void stdinResults(String input)})
|
||||
: stdoutStream = Stream<List<int>>.fromIterable(<List<int>>[result.stdout.codeUnits]),
|
||||
stderrStream = Stream<List<int>>.fromIterable(<List<int>>[result.stderr.codeUnits]),
|
||||
: stdoutStream = Stream<List<int>>.value((result.stdout as String).codeUnits),
|
||||
stderrStream = Stream<List<int>>.value((result.stderr as String).codeUnits),
|
||||
desiredExitCode = result.exitCode,
|
||||
stdinSink = IOSink(StringStreamConsumer(stdinResults)) {
|
||||
_setupMock();
|
||||
|
||||
@@ -328,13 +328,13 @@ void main() {
|
||||
expect(contents, contains('"channel": "dev"'));
|
||||
// Make sure old matching entries are removed.
|
||||
expect(contents, isNot(contains('v0.0.0')));
|
||||
final Map<String, dynamic> jsonData = json.decode(contents);
|
||||
final List<dynamic> releases = jsonData['releases'];
|
||||
final Map<String, dynamic> jsonData = json.decode(contents) as Map<String, dynamic>;
|
||||
final List<dynamic> releases = jsonData['releases'] as List<dynamic>;
|
||||
expect(releases.length, equals(3));
|
||||
// Make sure the new entry is first (and hopefully it takes less than a
|
||||
// minute to go from publishArchive above to this line!).
|
||||
expect(
|
||||
DateTime.now().difference(DateTime.parse(releases[0]['release_date'])),
|
||||
DateTime.now().difference(DateTime.parse(releases[0]['release_date'] as String)),
|
||||
lessThan(const Duration(minutes: 1)),
|
||||
);
|
||||
const JsonEncoder encoder = JsonEncoder.withIndent(' ');
|
||||
|
||||
@@ -41,7 +41,7 @@ class UnpublishException implements Exception {
|
||||
if (message != null) {
|
||||
output += ': $message';
|
||||
}
|
||||
final String stderr = result?.stderr ?? '';
|
||||
final String stderr = result?.stderr as String ?? '';
|
||||
if (stderr.isNotEmpty) {
|
||||
output += ':\n$stderr';
|
||||
}
|
||||
@@ -242,8 +242,8 @@ class ArchiveUnpublisher {
|
||||
/// Remove the archive from Google Storage.
|
||||
Future<void> unpublishArchive() async {
|
||||
final Map<String, dynamic> jsonData = await _loadMetadata();
|
||||
final List<Map<String, String>> releases = jsonData['releases'].map<Map<String, String>>((dynamic entry) {
|
||||
final Map<String, dynamic> mapEntry = entry;
|
||||
final List<Map<String, String>> releases = (jsonData['releases'] as List<dynamic>).map<Map<String, String>>((dynamic entry) {
|
||||
final Map<String, dynamic> mapEntry = entry as Map<String, dynamic>;
|
||||
return mapEntry.cast<String, String>();
|
||||
}).toList();
|
||||
final Map<Channel, Map<String, String>> paths = await _getArchivePaths(releases);
|
||||
@@ -306,7 +306,7 @@ class ArchiveUnpublisher {
|
||||
|
||||
Map<String, dynamic> jsonData;
|
||||
try {
|
||||
jsonData = json.decode(currentMetadata);
|
||||
jsonData = json.decode(currentMetadata) as Map<String, dynamic>;
|
||||
} on FormatException catch (e) {
|
||||
throw UnpublishException('Unable to parse JSON metadata received from cloud: $e');
|
||||
}
|
||||
@@ -449,7 +449,7 @@ Future<void> main(List<String> rawArguments) async {
|
||||
|
||||
final ArgResults parsedArguments = argParser.parse(rawArguments);
|
||||
|
||||
if (parsedArguments['help']) {
|
||||
if (parsedArguments['help'] as bool) {
|
||||
print(argParser.usage);
|
||||
exit(0);
|
||||
}
|
||||
@@ -460,7 +460,7 @@ Future<void> main(List<String> rawArguments) async {
|
||||
exit(exitCode);
|
||||
}
|
||||
|
||||
final List<String> revisions = parsedArguments['revision'];
|
||||
final List<String> revisions = parsedArguments['revision'] as List<String>;
|
||||
if (revisions.isEmpty) {
|
||||
errorExit('Invalid argument: at least one --revision must be specified.');
|
||||
}
|
||||
@@ -473,25 +473,28 @@ Future<void> main(List<String> rawArguments) async {
|
||||
}
|
||||
}
|
||||
|
||||
final String tempDirArg = parsedArguments['temp_dir'] as String;
|
||||
Directory tempDir;
|
||||
bool removeTempDir = false;
|
||||
if (parsedArguments['temp_dir'] == null || parsedArguments['temp_dir'].isEmpty) {
|
||||
if (tempDirArg == null || tempDirArg.isEmpty) {
|
||||
tempDir = Directory.systemTemp.createTempSync('flutter_package.');
|
||||
removeTempDir = true;
|
||||
} else {
|
||||
tempDir = Directory(parsedArguments['temp_dir']);
|
||||
tempDir = Directory(tempDirArg);
|
||||
if (!tempDir.existsSync()) {
|
||||
errorExit("Temporary directory ${parsedArguments['temp_dir']} doesn't exist.");
|
||||
errorExit("Temporary directory $tempDirArg doesn't exist.");
|
||||
}
|
||||
}
|
||||
|
||||
if (!parsedArguments['confirm']) {
|
||||
if (!(parsedArguments['confirm'] as bool)) {
|
||||
_printBanner('This will be just a dry run. To actually perform the changes below, re-run with --confirm argument.');
|
||||
}
|
||||
|
||||
final List<String> channelOptions = parsedArguments['channel'].isNotEmpty ? parsedArguments['channel'] : allowedChannelValues;
|
||||
final List<String> channelArg = parsedArguments['channel'] as List<String>;
|
||||
final List<String> channelOptions = channelArg.isNotEmpty ? channelArg : allowedChannelValues;
|
||||
final Set<Channel> channels = channelOptions.map<Channel>((String value) => fromChannelName(value)).toSet();
|
||||
final List<String> platformOptions = parsedArguments['platform'].isNotEmpty ? parsedArguments['platform'] : allowedPlatformNames;
|
||||
final List<String> platformArg = parsedArguments['platform'] as List<String>;
|
||||
final List<String> platformOptions = platformArg.isNotEmpty ? platformArg : allowedPlatformNames;
|
||||
final List<PublishedPlatform> platforms = platformOptions.map<PublishedPlatform>((String value) => fromPublishedPlatform(value)).toList();
|
||||
int exitCode = 0;
|
||||
String message;
|
||||
@@ -503,7 +506,7 @@ Future<void> main(List<String> rawArguments) async {
|
||||
revisions.toSet(),
|
||||
channels,
|
||||
platform,
|
||||
confirmed: parsedArguments['confirm'],
|
||||
confirmed: parsedArguments['confirm'] as bool,
|
||||
);
|
||||
await publisher.unpublishArchive();
|
||||
}
|
||||
@@ -522,7 +525,7 @@ Future<void> main(List<String> rawArguments) async {
|
||||
if (exitCode != 0) {
|
||||
errorExit('$message\n$stack', exitCode: exitCode);
|
||||
}
|
||||
if (!parsedArguments['confirm']) {
|
||||
if (!(parsedArguments['confirm'] as bool)) {
|
||||
_printBanner('This was just a dry run. To actually perform the above changes, re-run with --confirm argument.');
|
||||
}
|
||||
exit(0);
|
||||
|
||||
Reference in New Issue
Block a user