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
cd690f95
Unverified
Commit
cd690f95
authored
Oct 27, 2020
by
Anurag Roy
Committed by
GitHub
Oct 27, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[flutter_tools] Add --verify-only flag to flutter upgrade (#68866)
* Add --verify-only flag for flutter upgrade
parent
18f0a228
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
48 additions
and
0 deletions
+48
-0
upgrade.dart
packages/flutter_tools/lib/src/commands/upgrade.dart
+20
-0
upgrade_test.dart
...ter_tools/test/commands.shard/permeable/upgrade_test.dart
+28
-0
No files found.
packages/flutter_tools/lib/src/commands/upgrade.dart
View file @
cd690f95
...
@@ -38,6 +38,11 @@ class UpgradeCommand extends FlutterCommand {
...
@@ -38,6 +38,11 @@ class UpgradeCommand extends FlutterCommand {
'working-directory'
,
'working-directory'
,
hide:
true
,
hide:
true
,
help:
'Override the upgrade working directory for integration testing.'
help:
'Override the upgrade working directory for integration testing.'
)
..
addFlag
(
'verify-only'
,
help:
'Verifies for any new flutter update, without fetching the update.'
,
negatable:
false
,
);
);
}
}
...
@@ -63,6 +68,7 @@ class UpgradeCommand extends FlutterCommand {
...
@@ -63,6 +68,7 @@ class UpgradeCommand extends FlutterCommand {
flutterVersion:
stringArg
(
'working-directory'
)
==
null
flutterVersion:
stringArg
(
'working-directory'
)
==
null
?
globals
.
flutterVersion
?
globals
.
flutterVersion
:
FlutterVersion
(
const
SystemClock
(),
_commandRunner
.
workingDirectory
),
:
FlutterVersion
(
const
SystemClock
(),
_commandRunner
.
workingDirectory
),
verifyOnly:
boolArg
(
'verify-only'
),
);
);
}
}
}
}
...
@@ -78,6 +84,7 @@ class UpgradeCommandRunner {
...
@@ -78,6 +84,7 @@ class UpgradeCommandRunner {
@required
bool
testFlow
,
@required
bool
testFlow
,
@required
GitTagVersion
gitTagVersion
,
@required
GitTagVersion
gitTagVersion
,
@required
FlutterVersion
flutterVersion
,
@required
FlutterVersion
flutterVersion
,
@required
bool
verifyOnly
,
})
async
{
})
async
{
if
(!
continueFlow
)
{
if
(!
continueFlow
)
{
await
runCommandFirstHalf
(
await
runCommandFirstHalf
(
...
@@ -85,6 +92,7 @@ class UpgradeCommandRunner {
...
@@ -85,6 +92,7 @@ class UpgradeCommandRunner {
gitTagVersion:
gitTagVersion
,
gitTagVersion:
gitTagVersion
,
flutterVersion:
flutterVersion
,
flutterVersion:
flutterVersion
,
testFlow:
testFlow
,
testFlow:
testFlow
,
verifyOnly:
verifyOnly
,
);
);
}
else
{
}
else
{
await
runCommandSecondHalf
(
flutterVersion
);
await
runCommandSecondHalf
(
flutterVersion
);
...
@@ -97,12 +105,24 @@ class UpgradeCommandRunner {
...
@@ -97,12 +105,24 @@ class UpgradeCommandRunner {
@required
GitTagVersion
gitTagVersion
,
@required
GitTagVersion
gitTagVersion
,
@required
FlutterVersion
flutterVersion
,
@required
FlutterVersion
flutterVersion
,
@required
bool
testFlow
,
@required
bool
testFlow
,
@required
bool
verifyOnly
,
})
async
{
})
async
{
final
String
upstreamRevision
=
await
fetchRemoteRevision
();
final
String
upstreamRevision
=
await
fetchRemoteRevision
();
if
(
flutterVersion
.
frameworkRevision
==
upstreamRevision
)
{
if
(
flutterVersion
.
frameworkRevision
==
upstreamRevision
)
{
globals
.
printStatus
(
'Flutter is already up to date on channel
${flutterVersion.channel}
'
);
globals
.
printStatus
(
'Flutter is already up to date on channel
${flutterVersion.channel}
'
);
globals
.
printStatus
(
'
$flutterVersion
'
);
globals
.
printStatus
(
'
$flutterVersion
'
);
return
;
return
;
}
else
if
(
verifyOnly
)
{
globals
.
printStatus
(
'A new version of Flutter is available on channel
${flutterVersion.channel}
\n
'
);
// TODO(fujino): use a [FlutterVersion] once that class supports arbitrary revisions.
globals
.
printStatus
(
'The latest revision:
$upstreamRevision
'
,
emphasis:
true
);
globals
.
printStatus
(
'Your current version:
${flutterVersion.frameworkRevision}
\n
'
);
globals
.
printStatus
(
'To upgrade now, run "flutter upgrade".'
);
if
(
flutterVersion
.
channel
==
'stable'
)
{
globals
.
printStatus
(
'
\n
See the announcement and release notes:'
);
globals
.
printStatus
(
'https://flutter.dev/docs/development/tools/sdk/release-notes'
);
}
return
;
}
}
if
(!
force
&&
gitTagVersion
==
const
GitTagVersion
.
unknown
())
{
if
(!
force
&&
gitTagVersion
==
const
GitTagVersion
.
unknown
())
{
// If the commit is a recognized branch and not master,
// If the commit is a recognized branch and not master,
...
...
packages/flutter_tools/test/commands.shard/permeable/upgrade_test.dart
View file @
cd690f95
...
@@ -54,6 +54,7 @@ void main() {
...
@@ -54,6 +54,7 @@ void main() {
testFlow:
false
,
testFlow:
false
,
gitTagVersion:
const
GitTagVersion
.
unknown
(),
gitTagVersion:
const
GitTagVersion
.
unknown
(),
flutterVersion:
flutterVersion
,
flutterVersion:
flutterVersion
,
verifyOnly:
false
,
);
);
expect
(
result
,
throwsToolExit
());
expect
(
result
,
throwsToolExit
());
expect
(
processManager
.
hasRemainingExpectations
,
isFalse
);
expect
(
processManager
.
hasRemainingExpectations
,
isFalse
);
...
@@ -69,6 +70,7 @@ void main() {
...
@@ -69,6 +70,7 @@ void main() {
testFlow:
false
,
testFlow:
false
,
gitTagVersion:
gitTagVersion
,
gitTagVersion:
gitTagVersion
,
flutterVersion:
flutterVersion
,
flutterVersion:
flutterVersion
,
verifyOnly:
false
,
);
);
expect
(
result
,
throwsToolExit
());
expect
(
result
,
throwsToolExit
());
expect
(
processManager
.
hasRemainingExpectations
,
isFalse
);
expect
(
processManager
.
hasRemainingExpectations
,
isFalse
);
...
@@ -87,6 +89,7 @@ void main() {
...
@@ -87,6 +89,7 @@ void main() {
testFlow:
false
,
testFlow:
false
,
gitTagVersion:
gitTagVersion
,
gitTagVersion:
gitTagVersion
,
flutterVersion:
flutterVersion
,
flutterVersion:
flutterVersion
,
verifyOnly:
false
,
);
);
expect
(
await
result
,
FlutterCommandResult
.
success
());
expect
(
await
result
,
FlutterCommandResult
.
success
());
expect
(
testLogger
.
statusText
,
contains
(
'Flutter is already up to date'
));
expect
(
testLogger
.
statusText
,
contains
(
'Flutter is already up to date'
));
...
@@ -96,6 +99,28 @@ void main() {
...
@@ -96,6 +99,28 @@ void main() {
Platform:
()
=>
fakePlatform
,
Platform:
()
=>
fakePlatform
,
});
});
testUsingContext
(
'Correctly provides upgrade version on verify only'
,
()
async
{
const
String
revision
=
'abc123'
;
when
(
flutterVersion
.
frameworkRevision
).
thenReturn
(
revision
);
fakeCommandRunner
.
alreadyUpToDate
=
false
;
final
Future
<
FlutterCommandResult
>
result
=
fakeCommandRunner
.
runCommand
(
force:
false
,
continueFlow:
false
,
testFlow:
false
,
gitTagVersion:
gitTagVersion
,
flutterVersion:
flutterVersion
,
verifyOnly:
true
,
);
expect
(
await
result
,
FlutterCommandResult
.
success
());
expect
(
testLogger
.
statusText
,
contains
(
'A new version of Flutter is available'
));
expect
(
testLogger
.
statusText
,
contains
(
fakeCommandRunner
.
remoteRevision
));
expect
(
testLogger
.
statusText
,
contains
(
revision
));
expect
(
processManager
.
hasRemainingExpectations
,
isFalse
);
},
overrides:
<
Type
,
Generator
>{
ProcessManager:
()
=>
processManager
,
Platform:
()
=>
fakePlatform
,
});
testUsingContext
(
'fetchRemoteRevision returns revision if git succeeds'
,
()
async
{
testUsingContext
(
'fetchRemoteRevision returns revision if git succeeds'
,
()
async
{
const
String
revision
=
'abc123'
;
const
String
revision
=
'abc123'
;
...
@@ -255,6 +280,7 @@ void main() {
...
@@ -255,6 +280,7 @@ void main() {
testFlow:
false
,
testFlow:
false
,
gitTagVersion:
const
GitTagVersion
.
unknown
(),
gitTagVersion:
const
GitTagVersion
.
unknown
(),
flutterVersion:
flutterVersion
,
flutterVersion:
flutterVersion
,
verifyOnly:
false
,
);
);
expect
(
await
result
,
FlutterCommandResult
.
success
());
expect
(
await
result
,
FlutterCommandResult
.
success
());
expect
(
processManager
.
hasRemainingExpectations
,
isFalse
);
expect
(
processManager
.
hasRemainingExpectations
,
isFalse
);
...
@@ -272,6 +298,7 @@ void main() {
...
@@ -272,6 +298,7 @@ void main() {
testFlow:
false
,
testFlow:
false
,
gitTagVersion:
gitTagVersion
,
gitTagVersion:
gitTagVersion
,
flutterVersion:
flutterVersion
,
flutterVersion:
flutterVersion
,
verifyOnly:
false
,
);
);
expect
(
await
result
,
FlutterCommandResult
.
success
());
expect
(
await
result
,
FlutterCommandResult
.
success
());
expect
(
processManager
.
hasRemainingExpectations
,
isFalse
);
expect
(
processManager
.
hasRemainingExpectations
,
isFalse
);
...
@@ -287,6 +314,7 @@ void main() {
...
@@ -287,6 +314,7 @@ void main() {
testFlow:
false
,
testFlow:
false
,
gitTagVersion:
gitTagVersion
,
gitTagVersion:
gitTagVersion
,
flutterVersion:
flutterVersion
,
flutterVersion:
flutterVersion
,
verifyOnly:
false
,
);
);
expect
(
await
result
,
FlutterCommandResult
.
success
());
expect
(
await
result
,
FlutterCommandResult
.
success
());
expect
(
processManager
.
hasRemainingExpectations
,
isFalse
);
expect
(
processManager
.
hasRemainingExpectations
,
isFalse
);
...
...
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