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
98cf0185
Unverified
Commit
98cf0185
authored
Mar 14, 2020
by
Dan Field
Committed by
GitHub
Mar 14, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fetch tags for version command (#52212)
parent
bbc5b9d9
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
0 deletions
+26
-0
version.dart
packages/flutter_tools/lib/src/commands/version.dart
+1
-0
version_test.dart
...tter_tools/test/commands.shard/hermetic/version_test.dart
+25
-0
No files found.
packages/flutter_tools/lib/src/commands/version.dart
View file @
98cf0185
...
@@ -41,6 +41,7 @@ class VersionCommand extends FlutterCommand {
...
@@ -41,6 +41,7 @@ class VersionCommand extends FlutterCommand {
Version
minSupportedVersion
=
Version
.
parse
(
'1.2.1'
);
Version
minSupportedVersion
=
Version
.
parse
(
'1.2.1'
);
Future
<
List
<
String
>>
getTags
()
async
{
Future
<
List
<
String
>>
getTags
()
async
{
globals
.
flutterVersion
.
fetchTagsAndUpdate
();
RunResult
runResult
;
RunResult
runResult
;
try
{
try
{
runResult
=
await
processUtils
.
run
(
runResult
=
await
processUtils
.
run
(
...
...
packages/flutter_tools/test/commands.shard/hermetic/version_test.dart
View file @
98cf0185
...
@@ -23,6 +23,7 @@ import '../../src/mocks.dart' show MockProcess;
...
@@ -23,6 +23,7 @@ import '../../src/mocks.dart' show MockProcess;
void
main
(
)
{
void
main
(
)
{
group
(
'version'
,
()
{
group
(
'version'
,
()
{
MockStdio
mockStdio
;
MockStdio
mockStdio
;
MockVersion
mockVersion
;
setUpAll
(()
{
setUpAll
(()
{
Cache
.
disableLocking
();
Cache
.
disableLocking
();
...
@@ -30,6 +31,7 @@ void main() {
...
@@ -30,6 +31,7 @@ void main() {
setUp
(()
{
setUp
(()
{
mockStdio
=
MockStdio
();
mockStdio
=
MockStdio
();
mockVersion
=
MockVersion
();
when
(
mockStdio
.
stdinHasTerminal
).
thenReturn
(
false
);
when
(
mockStdio
.
stdinHasTerminal
).
thenReturn
(
false
);
when
(
mockStdio
.
hasTerminal
).
thenReturn
(
false
);
when
(
mockStdio
.
hasTerminal
).
thenReturn
(
false
);
});
});
...
@@ -44,6 +46,7 @@ void main() {
...
@@ -44,6 +46,7 @@ void main() {
},
overrides:
<
Type
,
Generator
>{
},
overrides:
<
Type
,
Generator
>{
ProcessManager:
()
=>
MockProcessManager
(),
ProcessManager:
()
=>
MockProcessManager
(),
Stdio:
()
=>
mockStdio
,
Stdio:
()
=>
mockStdio
,
FlutterVersion:
()
=>
mockVersion
,
});
});
testUsingContext
(
'version switch prompt is accepted'
,
()
async
{
testUsingContext
(
'version switch prompt is accepted'
,
()
async
{
...
@@ -65,6 +68,7 @@ void main() {
...
@@ -65,6 +68,7 @@ void main() {
ProcessManager:
()
=>
MockProcessManager
(),
ProcessManager:
()
=>
MockProcessManager
(),
Stdio:
()
=>
mockStdio
,
Stdio:
()
=>
mockStdio
,
AnsiTerminal:
()
=>
MockTerminal
(),
AnsiTerminal:
()
=>
MockTerminal
(),
FlutterVersion:
()
=>
mockVersion
,
});
});
testUsingContext
(
'version switch prompt is declined'
,
()
async
{
testUsingContext
(
'version switch prompt is declined'
,
()
async
{
...
@@ -86,6 +90,7 @@ void main() {
...
@@ -86,6 +90,7 @@ void main() {
ProcessManager:
()
=>
MockProcessManager
(),
ProcessManager:
()
=>
MockProcessManager
(),
Stdio:
()
=>
mockStdio
,
Stdio:
()
=>
mockStdio
,
AnsiTerminal:
()
=>
MockTerminal
(),
AnsiTerminal:
()
=>
MockTerminal
(),
FlutterVersion:
()
=>
mockVersion
,
});
});
testUsingContext
(
'version switch, latest commit query fails'
,
()
async
{
testUsingContext
(
'version switch, latest commit query fails'
,
()
async
{
...
@@ -100,6 +105,7 @@ void main() {
...
@@ -100,6 +105,7 @@ void main() {
},
overrides:
<
Type
,
Generator
>{
},
overrides:
<
Type
,
Generator
>{
ProcessManager:
()
=>
MockProcessManager
(
latestCommitFails:
true
),
ProcessManager:
()
=>
MockProcessManager
(
latestCommitFails:
true
),
Stdio:
()
=>
mockStdio
,
Stdio:
()
=>
mockStdio
,
FlutterVersion:
()
=>
mockVersion
,
});
});
testUsingContext
(
'latest commit is parsable when query fails'
,
()
{
testUsingContext
(
'latest commit is parsable when query fails'
,
()
{
...
@@ -111,6 +117,7 @@ void main() {
...
@@ -111,6 +117,7 @@ void main() {
},
overrides:
<
Type
,
Generator
>{
},
overrides:
<
Type
,
Generator
>{
ProcessManager:
()
=>
MockProcessManager
(
latestCommitFails:
true
),
ProcessManager:
()
=>
MockProcessManager
(
latestCommitFails:
true
),
Stdio:
()
=>
mockStdio
,
Stdio:
()
=>
mockStdio
,
FlutterVersion:
()
=>
mockVersion
,
});
});
testUsingContext
(
'switch to not supported version without force'
,
()
async
{
testUsingContext
(
'switch to not supported version without force'
,
()
async
{
...
@@ -125,6 +132,7 @@ void main() {
...
@@ -125,6 +132,7 @@ void main() {
},
overrides:
<
Type
,
Generator
>{
},
overrides:
<
Type
,
Generator
>{
ProcessManager:
()
=>
MockProcessManager
(),
ProcessManager:
()
=>
MockProcessManager
(),
Stdio:
()
=>
mockStdio
,
Stdio:
()
=>
mockStdio
,
FlutterVersion:
()
=>
mockVersion
,
});
});
testUsingContext
(
'switch to not supported version with force'
,
()
async
{
testUsingContext
(
'switch to not supported version with force'
,
()
async
{
...
@@ -140,6 +148,7 @@ void main() {
...
@@ -140,6 +148,7 @@ void main() {
},
overrides:
<
Type
,
Generator
>{
},
overrides:
<
Type
,
Generator
>{
ProcessManager:
()
=>
MockProcessManager
(),
ProcessManager:
()
=>
MockProcessManager
(),
Stdio:
()
=>
mockStdio
,
Stdio:
()
=>
mockStdio
,
FlutterVersion:
()
=>
mockVersion
,
});
});
testUsingContext
(
'tool exit on confusing version'
,
()
async
{
testUsingContext
(
'tool exit on confusing version'
,
()
async
{
...
@@ -156,6 +165,7 @@ void main() {
...
@@ -156,6 +165,7 @@ void main() {
},
overrides:
<
Type
,
Generator
>{
},
overrides:
<
Type
,
Generator
>{
ProcessManager:
()
=>
MockProcessManager
(),
ProcessManager:
()
=>
MockProcessManager
(),
Stdio:
()
=>
mockStdio
,
Stdio:
()
=>
mockStdio
,
FlutterVersion:
()
=>
mockVersion
,
});
});
testUsingContext
(
"exit tool if can't get the tags"
,
()
async
{
testUsingContext
(
"exit tool if can't get the tags"
,
()
async
{
...
@@ -169,6 +179,7 @@ void main() {
...
@@ -169,6 +179,7 @@ void main() {
},
overrides:
<
Type
,
Generator
>{
},
overrides:
<
Type
,
Generator
>{
ProcessManager:
()
=>
MockProcessManager
(
failGitTag:
true
),
ProcessManager:
()
=>
MockProcessManager
(
failGitTag:
true
),
Stdio:
()
=>
mockStdio
,
Stdio:
()
=>
mockStdio
,
FlutterVersion:
()
=>
mockVersion
,
});
});
testUsingContext
(
'Does not run pub when outside a project'
,
()
async
{
testUsingContext
(
'Does not run pub when outside a project'
,
()
async
{
...
@@ -180,10 +191,24 @@ void main() {
...
@@ -180,10 +191,24 @@ void main() {
},
overrides:
<
Type
,
Generator
>{
},
overrides:
<
Type
,
Generator
>{
ProcessManager:
()
=>
MockProcessManager
(),
ProcessManager:
()
=>
MockProcessManager
(),
Stdio:
()
=>
mockStdio
,
Stdio:
()
=>
mockStdio
,
FlutterVersion:
()
=>
mockVersion
,
});
testUsingContext
(
'Fetches upstream tags'
,
()
async
{
final
VersionCommand
command
=
VersionCommand
();
await
createTestCommandRunner
(
command
).
run
(<
String
>[
'version'
,
]);
verify
(
mockVersion
.
fetchTagsAndUpdate
()).
called
(
1
);
},
overrides:
<
Type
,
Generator
>{
ProcessManager:
()
=>
MockProcessManager
(),
Stdio:
()
=>
mockStdio
,
FlutterVersion:
()
=>
mockVersion
,
});
});
});
});
}
}
class
MockVersion
extends
Mock
implements
FlutterVersion
{}
class
MockTerminal
extends
Mock
implements
AnsiTerminal
{}
class
MockTerminal
extends
Mock
implements
AnsiTerminal
{}
class
MockStdio
extends
Mock
implements
Stdio
{}
class
MockStdio
extends
Mock
implements
Stdio
{}
class
MockProcessManager
extends
Mock
implements
ProcessManager
{
class
MockProcessManager
extends
Mock
implements
ProcessManager
{
...
...
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