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
4a11cc4b
Unverified
Commit
4a11cc4b
authored
Feb 15, 2022
by
Christopher Fujino
Committed by
GitHub
Feb 15, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[flutter_tools] do not validate maven upstream if cloud storage override provided (#98293)
parent
e9f83cf4
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
20 deletions
+29
-20
http_host_validator.dart
packages/flutter_tools/lib/src/http_host_validator.dart
+11
-6
http_host_validator_test.dart
...est/commands.shard/hermetic/http_host_validator_test.dart
+18
-14
No files found.
packages/flutter_tools/lib/src/http_host_validator.dart
View file @
4a11cc4b
...
...
@@ -18,16 +18,21 @@ const String kDoctorHostTimeout = 'FLUTTER_DOCTOR_HOST_TIMEOUT';
const
String
kPubDevHttpHost
=
'https://pub.dev/'
;
const
String
kgCloudHttpHost
=
'https://cloud.google.com/'
;
/// Android specific required HTTP hosts.
const
List
<
String
>
androidRequiredHttpHosts
=
<
String
>[
'https://maven.google.com/'
,
];
/// MacOS specific required HTTP hosts.
const
List
<
String
>
macOSRequiredHttpHosts
=
<
String
>[
'https://cocoapods.org/'
,
];
/// Android specific required HTTP hosts.
List
<
String
>
androidRequiredHttpHosts
(
Platform
platform
)
{
return
<
String
>[
// If kEnvCloudUrl is set, it will be used as the maven host
if
(!
platform
.
environment
.
containsKey
(
kEnvCloudUrl
))
'https://maven.google.com/'
,
];
}
// Validator that checks all provided hosts are reachable and responsive
class
HttpHostValidator
extends
DoctorValidator
{
HttpHostValidator
(
...
...
@@ -49,7 +54,7 @@ class HttpHostValidator extends DoctorValidator {
List
<
String
>
get
_requiredHosts
=>
<
String
>[
if
(
_featureFlags
.
isMacOSEnabled
)
...
macOSRequiredHttpHosts
,
if
(
_featureFlags
.
isAndroidEnabled
)
...
androidRequiredHttpHosts
,
if
(
_featureFlags
.
isAndroidEnabled
)
...
androidRequiredHttpHosts
(
_platform
)
,
_platform
.
environment
[
kEnvPubHostedUrl
]
??
kPubDevHttpHost
,
_platform
.
environment
[
kEnvCloudUrl
]
??
kgCloudHttpHost
,
];
...
...
packages/flutter_tools/test/commands.shard/hermetic/http_host_validator_test.dart
View file @
4a11cc4b
...
...
@@ -48,12 +48,13 @@ void main() {
testWithoutContext
(
'all http hosts are not available'
,
()
async
{
// Run the check for all operating systems one by one
for
(
final
String
os
in
osTested
)
{
final
Platform
platform
=
FakePlatform
(
operatingSystem:
os
);
final
HttpHostValidator
httpHostValidator
=
HttpHostValidator
(
platform:
FakePlatform
(
operatingSystem:
os
)
,
platform:
platform
,
featureFlags:
TestFeatureFlags
(),
httpClient:
FakeHttpClient
.
list
(<
FakeRequest
>[
FakeRequest
(
Uri
.
parse
(
kgCloudHttpHost
),
method:
HttpMethod
.
head
,
responseError:
const
OSError
(
'Name or service not known'
,
-
2
)),
FakeRequest
(
Uri
.
parse
(
androidRequiredHttpHosts
[
0
]),
method:
HttpMethod
.
head
,
responseError:
const
OSError
(
'Name or service not known'
,
-
2
)),
FakeRequest
(
Uri
.
parse
(
androidRequiredHttpHosts
(
platform
)
[
0
]),
method:
HttpMethod
.
head
,
responseError:
const
OSError
(
'Name or service not known'
,
-
2
)),
FakeRequest
(
Uri
.
parse
(
kPubDevHttpHost
),
method:
HttpMethod
.
head
,
responseError:
const
OSError
(
'Name or service not known'
,
-
2
)),
FakeRequest
(
Uri
.
parse
(
macOSRequiredHttpHosts
[
0
]),
method:
HttpMethod
.
head
,
responseError:
const
OSError
(
'Name or service not known'
,
-
2
)),
]),
...
...
@@ -70,12 +71,13 @@ void main() {
testWithoutContext
(
'one http hosts are not available'
,
()
async
{
// Run the check for all operating systems one by one
for
(
final
String
os
in
osTested
)
{
final
Platform
platform
=
FakePlatform
(
operatingSystem:
os
);
final
HttpHostValidator
httpHostValidator
=
HttpHostValidator
(
platform:
FakePlatform
(
operatingSystem:
os
)
,
platform:
platform
,
featureFlags:
TestFeatureFlags
(),
httpClient:
FakeHttpClient
.
list
(<
FakeRequest
>[
FakeRequest
(
Uri
.
parse
(
kgCloudHttpHost
),
method:
HttpMethod
.
head
,
responseError:
const
OSError
(
'Name or service not known'
,
-
2
)),
FakeRequest
(
Uri
.
parse
(
androidRequiredHttpHosts
[
0
]),
method:
HttpMethod
.
head
),
FakeRequest
(
Uri
.
parse
(
androidRequiredHttpHosts
(
platform
)
[
0
]),
method:
HttpMethod
.
head
),
FakeRequest
(
Uri
.
parse
(
kPubDevHttpHost
),
method:
HttpMethod
.
head
),
FakeRequest
(
Uri
.
parse
(
macOSRequiredHttpHosts
[
0
]),
method:
HttpMethod
.
head
),
]),
...
...
@@ -92,12 +94,13 @@ void main() {
testWithoutContext
(
'one http hosts are not available'
,
()
async
{
// Run the check for all operating systems one by one
for
(
final
String
os
in
osTested
)
{
final
Platform
platform
=
FakePlatform
(
operatingSystem:
os
);
final
HttpHostValidator
httpHostValidator
=
HttpHostValidator
(
platform:
FakePlatform
(
operatingSystem:
os
)
,
platform:
platform
,
featureFlags:
TestFeatureFlags
(),
httpClient:
FakeHttpClient
.
list
(<
FakeRequest
>[
FakeRequest
(
Uri
.
parse
(
kgCloudHttpHost
),
method:
HttpMethod
.
head
,
responseError:
const
OSError
(
'Name or service not known'
,
-
2
)),
FakeRequest
(
Uri
.
parse
(
androidRequiredHttpHosts
[
0
]),
method:
HttpMethod
.
head
),
FakeRequest
(
Uri
.
parse
(
androidRequiredHttpHosts
(
platform
)
[
0
]),
method:
HttpMethod
.
head
),
FakeRequest
(
Uri
.
parse
(
kPubDevHttpHost
),
method:
HttpMethod
.
head
),
FakeRequest
(
Uri
.
parse
(
macOSRequiredHttpHosts
[
0
]),
method:
HttpMethod
.
head
),
]),
...
...
@@ -135,12 +138,12 @@ void main() {
testWithoutContext
(
'all http hosts are not available'
,
()
async
{
// Run the check for all operating systems one by one
for
(
final
String
os
in
osTested
)
{
final
Platform
platform
=
FakePlatform
(
operatingSystem:
os
,
environment:
kTestEnvironment
);
final
HttpHostValidator
httpHostValidator
=
HttpHostValidator
(
platform:
FakePlatform
(
operatingSystem:
os
,
environment:
kTestEnvironment
)
,
platform:
platform
,
featureFlags:
TestFeatureFlags
(),
httpClient:
FakeHttpClient
.
list
(<
FakeRequest
>[
FakeRequest
(
Uri
.
parse
(
kTestEnvGCloudHost
),
method:
HttpMethod
.
head
,
responseError:
const
OSError
(
'Name or service not known'
,
-
2
)),
FakeRequest
(
Uri
.
parse
(
androidRequiredHttpHosts
[
0
]),
method:
HttpMethod
.
head
,
responseError:
const
OSError
(
'Name or service not known'
,
-
2
)),
FakeRequest
(
Uri
.
parse
(
kTestEnvPubHost
),
method:
HttpMethod
.
head
,
responseError:
const
OSError
(
'Name or service not known'
,
-
2
)),
FakeRequest
(
Uri
.
parse
(
macOSRequiredHttpHosts
[
0
]),
method:
HttpMethod
.
head
,
responseError:
const
OSError
(
'Name or service not known'
,
-
2
)),
]),
...
...
@@ -157,12 +160,12 @@ void main() {
testWithoutContext
(
'one http hosts are not available'
,
()
async
{
// Run the check for all operating systems one by one
for
(
final
String
os
in
osTested
)
{
final
Platform
platform
=
FakePlatform
(
operatingSystem:
os
,
environment:
kTestEnvironment
);
final
HttpHostValidator
httpHostValidator
=
HttpHostValidator
(
platform:
FakePlatform
(
operatingSystem:
os
,
environment:
kTestEnvironment
)
,
platform:
platform
,
featureFlags:
TestFeatureFlags
(),
httpClient:
FakeHttpClient
.
list
(<
FakeRequest
>[
FakeRequest
(
Uri
.
parse
(
kTestEnvGCloudHost
),
method:
HttpMethod
.
head
,
responseError:
const
OSError
(
'Name or service not known'
,
-
2
)),
FakeRequest
(
Uri
.
parse
(
androidRequiredHttpHosts
[
0
]),
method:
HttpMethod
.
head
),
FakeRequest
(
Uri
.
parse
(
kTestEnvPubHost
),
method:
HttpMethod
.
head
),
FakeRequest
(
Uri
.
parse
(
macOSRequiredHttpHosts
[
0
]),
method:
HttpMethod
.
head
),
]),
...
...
@@ -179,12 +182,12 @@ void main() {
testWithoutContext
(
'one http hosts are not available'
,
()
async
{
// Run the check for all operating systems one by one
for
(
final
String
os
in
osTested
)
{
final
Platform
platform
=
FakePlatform
(
operatingSystem:
os
,
environment:
kTestEnvironment
);
final
HttpHostValidator
httpHostValidator
=
HttpHostValidator
(
platform:
FakePlatform
(
operatingSystem:
os
,
environment:
kTestEnvironment
)
,
platform:
platform
,
featureFlags:
TestFeatureFlags
(),
httpClient:
FakeHttpClient
.
list
(<
FakeRequest
>[
FakeRequest
(
Uri
.
parse
(
kTestEnvGCloudHost
),
method:
HttpMethod
.
head
,
responseError:
const
OSError
(
'Name or service not known'
,
-
2
)),
FakeRequest
(
Uri
.
parse
(
androidRequiredHttpHosts
[
0
]),
method:
HttpMethod
.
head
),
FakeRequest
(
Uri
.
parse
(
kTestEnvPubHost
),
method:
HttpMethod
.
head
),
FakeRequest
(
Uri
.
parse
(
macOSRequiredHttpHosts
[
0
]),
method:
HttpMethod
.
head
),
]),
...
...
@@ -224,13 +227,14 @@ void main() {
testWithoutContext
(
'all http hosts are available - iOS disabled'
,
()
async
{
// Run the check for all operating systems one by one
for
(
final
String
os
in
osTested
)
{
final
Platform
platform
=
FakePlatform
(
operatingSystem:
os
);
final
HttpHostValidator
httpHostValidator
=
HttpHostValidator
(
platform:
FakePlatform
(
operatingSystem:
os
)
,
platform:
platform
,
featureFlags:
TestFeatureFlags
(
isIOSEnabled:
false
),
httpClient:
FakeHttpClient
.
list
(<
FakeRequest
>[
FakeRequest
(
Uri
.
parse
(
kgCloudHttpHost
),
method:
HttpMethod
.
head
),
FakeRequest
(
Uri
.
parse
(
kPubDevHttpHost
),
method:
HttpMethod
.
head
),
FakeRequest
(
Uri
.
parse
(
androidRequiredHttpHosts
[
0
]),
method:
HttpMethod
.
head
),
FakeRequest
(
Uri
.
parse
(
androidRequiredHttpHosts
(
platform
)
[
0
]),
method:
HttpMethod
.
head
),
]),
);
...
...
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