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
ad16823e
Unverified
Commit
ad16823e
authored
Mar 05, 2020
by
Jonah Williams
Committed by
GitHub
Mar 05, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[flutter_tools] support new SDK structure for sdkmanager (#51980)
parent
c411f588
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
31 additions
and
36 deletions
+31
-36
android_sdk.dart
packages/flutter_tools/lib/src/android/android_sdk.dart
+14
-3
android_workflow.dart
packages/flutter_tools/lib/src/android/android_workflow.dart
+0
-6
android_sdk_test.dart
...er_tools/test/general.shard/android/android_sdk_test.dart
+17
-1
android_workflow_test.dart
...ols/test/general.shard/android/android_workflow_test.dart
+0
-26
No files found.
packages/flutter_tools/lib/src/android/android_sdk.dart
View file @
ad16823e
...
...
@@ -282,13 +282,15 @@ class AndroidSdk {
List
<
AndroidSdkVersion
>
_sdkVersions
;
AndroidSdkVersion
_latestVersion
;
/// Whether the `platform-tools` directory exists in the Android SDK.
/// Whether the `platform-tools`
or `cmdline-tools`
directory exists in the Android SDK.
///
/// It is possible to have an Android SDK folder that is missing this with
/// the expectation that it will be downloaded later, e.g. by gradle or the
/// sdkmanager. The [licensesAvailable] property should be used to determine
/// whether the licenses are at least possibly accepted.
bool
get
platformToolsAvailable
=>
globals
.
fs
.
directory
(
globals
.
fs
.
path
.
join
(
directory
,
'platform-tools'
)).
existsSync
();
bool
get
platformToolsAvailable
=>
globals
.
fs
.
directory
(
globals
.
fs
.
path
.
join
(
directory
,
'cmdline-tools'
)).
existsSync
()
||
globals
.
fs
.
directory
(
globals
.
fs
.
path
.
join
(
directory
,
'platform-tools'
)).
existsSync
();
/// Whether the `licenses` directory exists in the Android SDK.
///
...
...
@@ -545,8 +547,17 @@ class AndroidSdk {
_latestVersion
=
_sdkVersions
.
isEmpty
?
null
:
_sdkVersions
.
last
;
}
/// Returns the filesystem path of the Android SDK manager tool or null if not found.
/// Returns the filesystem path of the Android SDK manager tool.
///
/// The sdkmanager was previously in the tools directory but this component
/// was marked as obsolete in 3.6.
String
get
sdkManagerPath
{
final
File
cmdlineTool
=
globals
.
fs
.
file
(
globals
.
fs
.
path
.
join
(
directory
,
'cmdline-tools'
,
'latest'
,
'bin'
,
'sdkmanager'
)
);
if
(
cmdlineTool
.
existsSync
())
{
return
cmdlineTool
.
path
;
}
return
globals
.
fs
.
path
.
join
(
directory
,
'tools'
,
'bin'
,
'sdkmanager'
);
}
...
...
packages/flutter_tools/lib/src/android/android_workflow.dart
View file @
ad16823e
...
...
@@ -359,12 +359,6 @@ class AndroidLicenseValidator extends DoctorValidator {
throwToolExit
(
userMessages
.
androidMissingSdkManager
(
androidSdk
.
sdkManagerPath
));
}
final
Version
sdkManagerVersion
=
Version
.
parse
(
androidSdk
.
sdkManagerVersion
);
if
(
sdkManagerVersion
==
null
||
sdkManagerVersion
.
major
<
26
)
{
// SDK manager is found, but needs to be updated.
throwToolExit
(
userMessages
.
androidSdkManagerOutdated
(
androidSdk
.
sdkManagerPath
));
}
try
{
final
Process
process
=
await
processUtils
.
start
(
<
String
>[
androidSdk
.
sdkManagerPath
,
'--licenses'
],
...
...
packages/flutter_tools/test/general.shard/android/android_sdk_test.dart
View file @
ad16823e
...
...
@@ -60,11 +60,27 @@ void main() {
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
});
testUsingContext
(
'returns sdkmanager path'
,
()
{
testUsingContext
(
'returns sdkmanager path
under cmdline tools
'
,
()
{
sdkDir
=
MockAndroidSdk
.
createSdkDirectory
();
globals
.
config
.
setValue
(
'android-sdk'
,
sdkDir
.
path
);
final
AndroidSdk
sdk
=
AndroidSdk
.
locateAndroidSdk
();
globals
.
fs
.
file
(
globals
.
fs
.
path
.
join
(
sdk
.
directory
,
'cmdline-tools'
,
'latest'
,
'bin'
,
'sdkmanager'
)
).
createSync
(
recursive:
true
);
expect
(
sdk
.
sdkManagerPath
,
globals
.
fs
.
path
.
join
(
sdk
.
directory
,
'cmdline-tools'
,
'latest'
,
'bin'
,
'sdkmanager'
));
},
overrides:
<
Type
,
Generator
>{
FileSystem:
()
=>
fs
,
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
});
testUsingContext
(
'returns sdkmanager path under tools if cmdline doesnt exist'
,
()
{
sdkDir
=
MockAndroidSdk
.
createSdkDirectory
();
globals
.
config
.
setValue
(
'android-sdk'
,
sdkDir
.
path
);
final
AndroidSdk
sdk
=
AndroidSdk
.
locateAndroidSdk
();
expect
(
sdk
.
sdkManagerPath
,
globals
.
fs
.
path
.
join
(
sdk
.
directory
,
'tools'
,
'bin'
,
'sdkmanager'
));
},
overrides:
<
Type
,
Generator
>{
FileSystem:
()
=>
fs
,
...
...
packages/flutter_tools/test/general.shard/android/android_workflow_test.dart
View file @
ad16823e
...
...
@@ -169,32 +169,6 @@ void main() {
Stdio:
()
=>
stdio
,
}));
testUsingContext
(
'runLicenseManager errors for version < 26'
,
()
async
{
when
(
sdk
.
sdkManagerPath
).
thenReturn
(
'/foo/bar/sdkmanager'
);
when
(
sdk
.
sdkManagerVersion
).
thenReturn
(
'25.0.0'
);
expect
(
AndroidLicenseValidator
.
runLicenseManager
(),
throwsToolExit
(
message:
'To update, run'
));
},
overrides:
Map
<
Type
,
Generator
>.
unmodifiable
(<
Type
,
Generator
>{
AndroidSdk:
()
=>
sdk
,
FileSystem:
()
=>
fs
,
ProcessManager:
()
=>
processManager
,
Platform:
()
=>
FakePlatform
()..
environment
=
<
String
,
String
>{
'HOME'
:
'/home/me'
},
Stdio:
()
=>
stdio
,
}));
testUsingContext
(
'runLicenseManager errors correctly for null version'
,
()
async
{
when
(
sdk
.
sdkManagerPath
).
thenReturn
(
'/foo/bar/sdkmanager'
);
when
(
sdk
.
sdkManagerVersion
).
thenReturn
(
null
);
expect
(
AndroidLicenseValidator
.
runLicenseManager
(),
throwsToolExit
(
message:
'To update, run'
));
},
overrides:
Map
<
Type
,
Generator
>.
unmodifiable
(<
Type
,
Generator
>{
AndroidSdk:
()
=>
sdk
,
FileSystem:
()
=>
fs
,
ProcessManager:
()
=>
processManager
,
Platform:
()
=>
FakePlatform
()..
environment
=
<
String
,
String
>{
'HOME'
:
'/home/me'
},
Stdio:
()
=>
stdio
,
}));
testUsingContext
(
'runLicenseManager errors when sdkmanager is not found'
,
()
async
{
when
(
sdk
.
sdkManagerPath
).
thenReturn
(
'/foo/bar/sdkmanager'
);
processManager
.
canRunSucceeds
=
false
;
...
...
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