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
050ee9d1
Unverified
Commit
050ee9d1
authored
Mar 01, 2018
by
jcollins-g
Committed by
GitHub
Mar 01, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve robustness of --version parsing for sdkmanager (#15029)
parent
701eff4a
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
20 additions
and
5 deletions
+20
-5
android_sdk.dart
packages/flutter_tools/lib/src/android/android_sdk.dart
+2
-1
android_workflow.dart
packages/flutter_tools/lib/src/android/android_workflow.dart
+1
-1
android_sdk_test.dart
packages/flutter_tools/test/android/android_sdk_test.dart
+2
-2
android_workflow_test.dart
...ges/flutter_tools/test/android/android_workflow_test.dart
+15
-1
No files found.
packages/flutter_tools/lib/src/android/android_sdk.dart
View file @
050ee9d1
...
...
@@ -347,7 +347,8 @@ class AndroidSdk {
throwToolExit
(
'Android sdkmanager not found. Update to the latest Android SDK to resolve this.'
);
final
ProcessResult
result
=
processManager
.
runSync
(<
String
>[
sdkManagerPath
,
'--version'
],
environment:
sdkManagerEnv
);
if
(
result
.
exitCode
!=
0
)
{
throwToolExit
(
'sdkmanager --version failed:
${result.exitCode}
'
,
exitCode:
result
.
exitCode
);
printTrace
(
'sdkmanager --version failed: exitCode:
${result.exitCode}
stdout:
${result.stdout}
stderr:
${result.stderr}
'
);
return
null
;
}
return
result
.
stdout
.
trim
();
}
...
...
packages/flutter_tools/lib/src/android/android_workflow.dart
View file @
050ee9d1
...
...
@@ -213,7 +213,7 @@ class AndroidWorkflow extends DoctorValidator implements Workflow {
);
final
Version
sdkManagerVersion
=
new
Version
.
parse
(
androidSdk
.
sdkManagerVersion
);
if
(
sdkManagerVersion
.
major
<
26
)
if
(
sdkManagerVersion
==
null
||
sdkManagerVersion
.
major
<
26
)
// SDK manager is found, but needs to be updated.
throwToolExit
(
'A newer version of the Android SDK is required. To update, run:
\n
'
...
...
packages/flutter_tools/test/android/android_sdk_test.dart
View file @
050ee9d1
...
...
@@ -81,7 +81,7 @@ void main() {
ProcessManager:
()
=>
processManager
,
});
testUsingContext
(
'
throws
on sdkmanager version check failure'
,
()
{
testUsingContext
(
'
does not throw
on sdkmanager version check failure'
,
()
{
sdkDir
=
MockAndroidSdk
.
createSdkDirectory
();
Config
.
instance
.
setValue
(
'android-sdk'
,
sdkDir
.
path
);
...
...
@@ -89,7 +89,7 @@ void main() {
when
(
processManager
.
canRun
(
sdk
.
sdkManagerPath
)).
thenReturn
(
true
);
when
(
processManager
.
runSync
(<
String
>[
sdk
.
sdkManagerPath
,
'--version'
],
environment:
argThat
(
isNotNull
)))
.
thenReturn
(
new
ProcessResult
(
1
,
1
,
'26.1.1
\n
'
,
'Mystery error'
));
expect
(
()
=>
sdk
.
sdkManagerVersion
,
throwsToolExit
(
exitCode:
1
)
);
expect
(
sdk
.
sdkManagerVersion
,
isNull
);
},
overrides:
<
Type
,
Generator
>{
FileSystem:
()
=>
fs
,
ProcessManager:
()
=>
processManager
,
...
...
packages/flutter_tools/test/android/android_workflow_test.dart
View file @
050ee9d1
...
...
@@ -132,7 +132,21 @@ void main() {
when
(
sdk
.
sdkManagerPath
).
thenReturn
(
'/foo/bar/sdkmanager'
);
when
(
sdk
.
sdkManagerVersion
).
thenReturn
(
'25.0.0'
);
expect
(
AndroidWorkflow
.
runLicenseManager
(),
throwsToolExit
());
expect
(
AndroidWorkflow
.
runLicenseManager
(),
throwsToolExit
(
message:
'To update, run'
));
},
overrides:
<
Type
,
Generator
>{
AndroidSdk:
()
=>
sdk
,
FileSystem:
()
=>
fs
,
Platform:
()
=>
new
FakePlatform
()..
environment
=
<
String
,
String
>{
'HOME'
:
'/home/me'
},
ProcessManager:
()
=>
processManager
,
Stdio:
()
=>
stdio
,
});
testUsingContext
(
'runLicenseManager errors correctly for null version'
,
()
async
{
MockAndroidSdk
.
createSdkDirectory
();
when
(
sdk
.
sdkManagerPath
).
thenReturn
(
'/foo/bar/sdkmanager'
);
when
(
sdk
.
sdkManagerVersion
).
thenReturn
(
null
);
expect
(
AndroidWorkflow
.
runLicenseManager
(),
throwsToolExit
(
message:
'To update, run'
));
},
overrides:
<
Type
,
Generator
>{
AndroidSdk:
()
=>
sdk
,
FileSystem:
()
=>
fs
,
...
...
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