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
2e17a8e6
Unverified
Commit
2e17a8e6
authored
Mar 15, 2021
by
Gurjinder Partola
Committed by
GitHub
Mar 15, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix avdmanager path detection (#78166)
parent
71fb9162
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
79 additions
and
3 deletions
+79
-3
android_sdk.dart
packages/flutter_tools/lib/src/android/android_sdk.dart
+11
-3
android_sdk_test.dart
...er_tools/test/general.shard/android/android_sdk_test.dart
+68
-0
No files found.
packages/flutter_tools/lib/src/android/android_sdk.dart
View file @
2e17a8e6
...
@@ -263,9 +263,17 @@ class AndroidSdk {
...
@@ -263,9 +263,17 @@ class AndroidSdk {
String
getAvdManagerPath
()
{
String
getAvdManagerPath
()
{
final
String
binaryName
=
globals
.
platform
.
isWindows
?
'avdmanager.bat'
:
'avdmanager'
;
final
String
binaryName
=
globals
.
platform
.
isWindows
?
'avdmanager.bat'
:
'avdmanager'
;
final
File
file
=
directory
.
childDirectory
(
'tools'
).
childDirectory
(
'bin'
).
childFile
(
binaryName
);
final
File
cmdlineToolsBinary
=
directory
if
(
file
.
existsSync
())
{
.
childDirectory
(
'cmdline-tools'
)
return
file
.
path
;
.
childDirectory
(
'latest'
)
.
childDirectory
(
'bin'
)
.
childFile
(
binaryName
);
if
(
cmdlineToolsBinary
.
existsSync
())
{
return
cmdlineToolsBinary
.
path
;
}
final
File
toolsBinary
=
directory
.
childDirectory
(
'tools'
).
childDirectory
(
'bin'
).
childFile
(
binaryName
);
if
(
toolsBinary
.
existsSync
())
{
return
toolsBinary
.
path
;
}
}
return
null
;
return
null
;
}
}
...
...
packages/flutter_tools/test/general.shard/android/android_sdk_test.dart
View file @
2e17a8e6
...
@@ -230,6 +230,74 @@ void main() {
...
@@ -230,6 +230,74 @@ void main() {
Config:
()
=>
config
,
Config:
()
=>
config
,
Platform:
()
=>
FakePlatform
(
operatingSystem:
'linux'
),
Platform:
()
=>
FakePlatform
(
operatingSystem:
'linux'
),
});
});
testUsingContext
(
'returns avdmanager path under cmdline tools'
,
()
{
sdkDir
=
MockAndroidSdk
.
createSdkDirectory
();
config
.
setValue
(
'android-sdk'
,
sdkDir
.
path
);
final
AndroidSdk
sdk
=
AndroidSdk
.
locateAndroidSdk
();
fileSystem
.
file
(
fileSystem
.
path
.
join
(
sdk
.
directory
.
path
,
'cmdline-tools'
,
'latest'
,
'bin'
,
'avdmanager'
)
).
createSync
(
recursive:
true
);
expect
(
sdk
.
avdManagerPath
,
fileSystem
.
path
.
join
(
sdk
.
directory
.
path
,
'cmdline-tools'
,
'latest'
,
'bin'
,
'avdmanager'
));
},
overrides:
<
Type
,
Generator
>{
FileSystem:
()
=>
fileSystem
,
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
Platform:
()
=>
FakePlatform
(
operatingSystem:
'linux'
),
Config:
()
=>
config
,
});
testUsingContext
(
'returns avdmanager path under cmdline tools on windows'
,
()
{
sdkDir
=
MockAndroidSdk
.
createSdkDirectory
();
config
.
setValue
(
'android-sdk'
,
sdkDir
.
path
);
final
AndroidSdk
sdk
=
AndroidSdk
.
locateAndroidSdk
();
fileSystem
.
file
(
fileSystem
.
path
.
join
(
sdk
.
directory
.
path
,
'cmdline-tools'
,
'latest'
,
'bin'
,
'avdmanager.bat'
)
).
createSync
(
recursive:
true
);
expect
(
sdk
.
avdManagerPath
,
fileSystem
.
path
.
join
(
sdk
.
directory
.
path
,
'cmdline-tools'
,
'latest'
,
'bin'
,
'avdmanager.bat'
));
},
overrides:
<
Type
,
Generator
>{
FileSystem:
()
=>
fileSystem
,
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
Platform:
()
=>
FakePlatform
(
operatingSystem:
'windows'
),
Config:
()
=>
config
,
});
testUsingContext
(
"returns avdmanager path under tools if cmdline doesn't exist"
,
()
{
sdkDir
=
MockAndroidSdk
.
createSdkDirectory
();
config
.
setValue
(
'android-sdk'
,
sdkDir
.
path
);
final
AndroidSdk
sdk
=
AndroidSdk
.
locateAndroidSdk
();
fileSystem
.
file
(
fileSystem
.
path
.
join
(
sdk
.
directory
.
path
,
'tools'
,
'bin'
,
'avdmanager'
)
).
createSync
(
recursive:
true
);
expect
(
sdk
.
avdManagerPath
,
fileSystem
.
path
.
join
(
sdk
.
directory
.
path
,
'tools'
,
'bin'
,
'avdmanager'
));
},
overrides:
<
Type
,
Generator
>{
FileSystem:
()
=>
fileSystem
,
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
Platform:
()
=>
FakePlatform
(
operatingSystem:
'linux'
),
Config:
()
=>
config
,
});
testUsingContext
(
"returns avdmanager path under tools if cmdline doesn't exist on windows"
,
()
{
sdkDir
=
MockAndroidSdk
.
createSdkDirectory
();
config
.
setValue
(
'android-sdk'
,
sdkDir
.
path
);
final
AndroidSdk
sdk
=
AndroidSdk
.
locateAndroidSdk
();
fileSystem
.
file
(
fileSystem
.
path
.
join
(
sdk
.
directory
.
path
,
'tools'
,
'bin'
,
'avdmanager.bat'
)
).
createSync
(
recursive:
true
);
expect
(
sdk
.
avdManagerPath
,
fileSystem
.
path
.
join
(
sdk
.
directory
.
path
,
'tools'
,
'bin'
,
'avdmanager.bat'
));
},
overrides:
<
Type
,
Generator
>{
FileSystem:
()
=>
fileSystem
,
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
Platform:
()
=>
FakePlatform
(
operatingSystem:
'windows'
),
Config:
()
=>
config
,
});
});
});
}
}
...
...
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