Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
b3f9944f
Unverified
Commit
b3f9944f
authored
Oct 07, 2020
by
Jonah Williams
Committed by
GitHub
Oct 07, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[flutter_tools] remove deprecated flutter command (#67478)
parent
a4e0e2a8
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
0 additions
and
486 deletions
+0
-486
executable.dart
packages/flutter_tools/lib/executable.dart
+0
-2
version.dart
packages/flutter_tools/lib/src/commands/version.dart
+0
-177
version_test.dart
...tter_tools/test/commands.shard/hermetic/version_test.dart
+0
-307
No files found.
packages/flutter_tools/lib/executable.dart
View file @
b3f9944f
...
...
@@ -42,7 +42,6 @@ import 'src/commands/test.dart';
import
'src/commands/train.dart'
;
import
'src/commands/update_packages.dart'
;
import
'src/commands/upgrade.dart'
;
import
'src/commands/version.dart'
;
import
'src/features.dart'
;
import
'src/globals.dart'
as
globals
;
// Files in `isolated` are intentionally excluded from google3 tooling.
...
...
@@ -116,7 +115,6 @@ Future<void> main(List<String> args) async {
ShellCompletionCommand
(),
TestCommand
(
verboseHelp:
verboseHelp
),
UpgradeCommand
(),
VersionCommand
(),
SymbolizeCommand
(
stdio:
globals
.
stdio
,
fileSystem:
globals
.
fs
,
...
...
packages/flutter_tools/lib/src/commands/version.dart
deleted
100644 → 0
View file @
a4e0e2a8
// 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.
import
'../base/common.dart'
;
import
'../base/io.dart'
;
import
'../base/os.dart'
;
import
'../base/process.dart'
;
import
'../base/version.dart'
;
import
'../cache.dart'
;
import
'../dart/pub.dart'
;
import
'../globals.dart'
as
globals
;
import
'../runner/flutter_command.dart'
;
class
VersionCommand
extends
FlutterCommand
{
VersionCommand
()
:
super
()
{
argParser
.
addFlag
(
'force'
,
abbr:
'f'
,
help:
'Force switch to older Flutter versions that do not include a version command'
,
);
// Don't use usesPubOption here. That will cause the version command to
// require a pubspec.yaml file, which it doesn't need.
argParser
.
addFlag
(
'pub'
,
defaultsTo:
true
,
hide:
true
,
help:
'Whether to run "flutter pub get" after switching versions.'
,
);
}
@override
bool
get
deprecated
=>
true
;
@override
final
String
name
=
'version'
;
@override
final
String
description
=
'List or switch flutter versions.'
;
// The first version of Flutter which includes the flutter version command. Switching to older
// versions will require the user to manually upgrade.
Version
minSupportedVersion
=
Version
.
parse
(
'1.2.1'
);
Future
<
List
<
String
>>
getTags
()
async
{
globals
.
flutterVersion
.
fetchTagsAndUpdate
();
RunResult
runResult
;
try
{
runResult
=
await
processUtils
.
run
(
<
String
>[
'git'
,
'tag'
,
'-l'
,
'*.*.*'
,
'--sort=-creatordate'
],
throwOnError:
true
,
workingDirectory:
Cache
.
flutterRoot
,
);
}
on
ProcessException
catch
(
error
)
{
throwToolExit
(
'Unable to get the tags. '
'This is likely due to an internal git error.'
'
\n
Error:
$error
.'
);
}
return
runResult
.
toString
().
split
(
'
\n
'
);
}
@override
Future
<
FlutterCommandResult
>
runCommand
()
async
{
final
List
<
String
>
tags
=
await
getTags
();
if
(
argResults
.
rest
.
isEmpty
)
{
tags
.
forEach
(
globals
.
printStatus
);
return
FlutterCommandResult
.
success
();
}
globals
.
printStatus
(
'╔══════════════════════════════════════════════════════════════════════════════╗
\n
'
'║ Warning: "flutter version" will leave the SDK in a detached HEAD state. ║
\n
'
'║ If you are using the command to return to a previously installed SDK version ║
\n
'
'║ consider using the "flutter downgrade" command instead. ║
\n
'
'╚══════════════════════════════════════════════════════════════════════════════╝
\n
'
,
emphasis:
true
,
);
if
(
globals
.
stdio
.
stdinHasTerminal
)
{
globals
.
terminal
.
usesTerminalUi
=
true
;
final
String
result
=
await
globals
.
terminal
.
promptForCharInput
(
<
String
>[
'y'
,
'n'
],
logger:
globals
.
logger
,
prompt:
'Are you sure you want to proceed?'
);
if
(
result
==
'n'
)
{
return
FlutterCommandResult
.
success
();
}
}
final
String
version
=
argResults
.
rest
[
0
].
replaceFirst
(
RegExp
(
'^v'
),
''
);
final
List
<
String
>
matchingTags
=
tags
.
where
((
String
tag
)
=>
tag
.
contains
(
version
)).
toList
();
String
matchingTag
;
// TODO(fujino): make this a tool exit and fix tests
if
(
matchingTags
.
isEmpty
)
{
globals
.
printError
(
'There is no version:
$version
'
);
matchingTag
=
version
;
}
else
{
matchingTag
=
matchingTags
.
first
.
trim
();
}
// check min supported version
final
Version
targetVersion
=
Version
.
parse
(
version
);
if
(
targetVersion
==
null
)
{
throwToolExit
(
'Failed to parse version "
$version
"'
);
}
bool
withForce
=
false
;
if
(
targetVersion
<
minSupportedVersion
)
{
if
(!
boolArg
(
'force'
))
{
globals
.
printError
(
'Version command is not supported in
$targetVersion
and it is supported since version
$minSupportedVersion
'
'which means if you switch to version
$minSupportedVersion
then you can not use version command. '
'If you really want to switch to version
$targetVersion
, please use `--force` flag: `flutter version --force
$targetVersion
`.'
);
return
const
FlutterCommandResult
(
ExitStatus
.
success
);
}
withForce
=
true
;
}
try
{
await
processUtils
.
run
(
<
String
>[
'git'
,
'checkout'
,
matchingTag
],
throwOnError:
true
,
workingDirectory:
Cache
.
flutterRoot
,
);
}
on
Exception
catch
(
e
)
{
throwToolExit
(
'Unable to checkout version branch for version
$version
:
$e
'
);
}
globals
.
printStatus
(
'Switching Flutter to version
$matchingTag${withForce ? ' with force' : ''}
'
);
// Check for and download any engine and pkg/ updates.
// We run the 'flutter' shell script re-entrantly here
// so that it will download the updated Dart and so forth
// if necessary.
globals
.
printStatus
(
'Downloading engine...'
);
int
code
=
await
processUtils
.
stream
(<
String
>[
globals
.
fs
.
path
.
join
(
'bin'
,
'flutter'
),
'--no-color'
,
'precache'
,
],
workingDirectory:
Cache
.
flutterRoot
,
allowReentrantFlutter:
true
);
if
(
code
!=
0
)
{
throwToolExit
(
null
,
exitCode:
code
);
}
final
String
projectRoot
=
findProjectRoot
();
if
(
projectRoot
!=
null
&&
boolArg
(
'pub'
))
{
globals
.
printStatus
(
''
);
await
pub
.
get
(
context:
PubContext
.
pubUpgrade
,
directory:
projectRoot
,
upgrade:
true
,
checkLastModified:
false
,
generateSyntheticPackage:
false
,
);
}
// Run a doctor check in case system requirements have changed.
globals
.
printStatus
(
''
);
globals
.
printStatus
(
'Running flutter doctor...'
);
code
=
await
processUtils
.
stream
(
<
String
>[
globals
.
fs
.
path
.
join
(
'bin'
,
'flutter'
),
'doctor'
,
],
workingDirectory:
Cache
.
flutterRoot
,
allowReentrantFlutter:
true
,
);
if
(
code
!=
0
)
{
throwToolExit
(
null
,
exitCode:
code
);
}
return
FlutterCommandResult
.
success
();
}
}
packages/flutter_tools/test/commands.shard/hermetic/version_test.dart
deleted
100644 → 0
View file @
a4e0e2a8
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment