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
7779a147
Unverified
Commit
7779a147
authored
Jul 24, 2020
by
雷宇辰
Committed by
GitHub
Jul 24, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[flutter_tools] Make flutter git upstream configurable (#61513)
parent
f9499f44
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
48 additions
and
1 deletion
+48
-1
version.dart
packages/flutter_tools/lib/src/version.dart
+8
-1
version_test.dart
packages/flutter_tools/test/general.shard/version_test.dart
+40
-0
No files found.
packages/flutter_tools/lib/src/version.dart
View file @
7779a147
...
...
@@ -24,7 +24,7 @@ enum Channel {
}
/// The flutter GitHub repository.
const
String
_flutterGit
=
'https://github.com/flutter/flutter.git'
;
String
get
_flutterGit
=>
globals
.
platform
.
environment
[
'FLUTTER_GIT_URL'
]
??
'https://github.com/flutter/flutter.git'
;
/// Retrieve a human-readable name for a given [channel].
///
...
...
@@ -259,6 +259,13 @@ class FlutterVersion {
branch:
'
$_versionCheckRemote
/
$branch
'
,
lenient:
false
,
);
}
on
VersionCheckError
catch
(
error
)
{
if
(
globals
.
platform
.
environment
.
containsKey
(
'FLUTTER_GIT_URL'
))
{
globals
.
logger
.
printError
(
'Warning: the Flutter git upstream was overriden '
'by the environment variable FLUTTER_GIT_URL =
$_flutterGit
'
);
}
globals
.
logger
.
printError
(
error
.
toString
());
rethrow
;
}
finally
{
await
_removeVersionCheckRemoteIfExists
();
}
...
...
packages/flutter_tools/test/general.shard/version_test.dart
View file @
7779a147
...
...
@@ -7,6 +7,7 @@ import 'dart:convert';
import
'package:collection/collection.dart'
show
ListEquality
;
import
'package:flutter_tools/src/base/context.dart'
;
import
'package:flutter_tools/src/base/io.dart'
;
import
'package:flutter_tools/src/base/platform.dart'
;
import
'package:flutter_tools/src/base/process.dart'
;
import
'package:flutter_tools/src/base/time.dart'
;
import
'package:flutter_tools/src/base/utils.dart'
;
...
...
@@ -609,6 +610,45 @@ void main() {
environment:
anyNamed
(
'environment'
),
)).
called
(
1
);
});
testUsingContext
(
'determine uses overridden git url'
,
()
{
final
MockProcessUtils
processUtils
=
MockProcessUtils
();
when
(
processUtils
.
runSync
(
<
String
>[
'git'
,
'rev-parse'
,
'--abbrev-ref'
,
'HEAD'
],
workingDirectory:
anyNamed
(
'workingDirectory'
),
environment:
anyNamed
(
'environment'
),
)).
thenReturn
(
RunResult
(
ProcessResult
(
108
,
0
,
'master'
,
''
),
<
String
>[
'git'
,
'fetch'
]));
when
(
processUtils
.
runSync
(
<
String
>[
'git'
,
'fetch'
,
'https://githubmirror.com/flutter.git'
,
'--tags'
,
'-f'
],
workingDirectory:
anyNamed
(
'workingDirectory'
),
environment:
anyNamed
(
'environment'
),
)).
thenReturn
(
RunResult
(
ProcessResult
(
109
,
0
,
''
,
''
),
<
String
>[
'git'
,
'fetch'
]));
when
(
processUtils
.
runSync
(
<
String
>[
'git'
,
'tag'
,
'--contains'
,
'HEAD'
],
workingDirectory:
anyNamed
(
'workingDirectory'
),
environment:
anyNamed
(
'environment'
),
)).
thenReturn
(
RunResult
(
ProcessResult
(
110
,
0
,
''
,
''
),
<
String
>[
'git'
,
'tag'
,
'--contains'
,
'HEAD'
],
));
when
(
processUtils
.
runSync
(
<
String
>[
'git'
,
'describe'
,
'--match'
,
'*.*.*-*.*.pre'
,
'--first-parent'
,
'--long'
,
'--tags'
],
workingDirectory:
anyNamed
(
'workingDirectory'
),
environment:
anyNamed
(
'environment'
),
)).
thenReturn
(
RunResult
(
ProcessResult
(
111
,
0
,
'v0.1.2-3-1234abcd'
,
''
),
<
String
>[
'git'
,
'describe'
]));
GitTagVersion
.
determine
(
processUtils
,
workingDirectory:
'.'
,
fetchTags:
true
);
verify
(
processUtils
.
runSync
(
<
String
>[
'git'
,
'fetch'
,
'https://githubmirror.com/flutter.git'
,
'--tags'
,
'-f'
],
workingDirectory:
anyNamed
(
'workingDirectory'
),
environment:
anyNamed
(
'environment'
),
)).
called
(
1
);
},
overrides:
<
Type
,
Generator
>{
Platform:
()
=>
FakePlatform
(
environment:
<
String
,
String
>{
'FLUTTER_GIT_URL'
:
'https://githubmirror.com/flutter.git'
,
}),
});
}
void
_expectVersionMessage
(
String
message
)
{
...
...
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