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
f9aa5842
Unverified
Commit
f9aa5842
authored
Jul 29, 2021
by
Taha Tesser
Committed by
GitHub
Jul 29, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[tools] Fix Android Studio Arctic Fox Java path on macOS (#87267)
parent
f226c1ea
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
49 additions
and
2 deletions
+49
-2
android_studio.dart
packages/flutter_tools/lib/src/android/android_studio.dart
+4
-2
android_studio_test.dart
...tools/test/general.shard/android/android_studio_test.dart
+45
-0
No files found.
packages/flutter_tools/lib/src/android/android_studio.dart
View file @
f9aa5842
...
...
@@ -37,7 +37,7 @@ class AndroidStudio implements Comparable<AndroidStudio> {
this
.
studioAppName
=
'AndroidStudio'
,
this
.
presetPluginsPath
,
})
:
version
=
version
??
Version
.
unknown
{
_init
();
_init
(
version:
version
);
}
factory
AndroidStudio
.
fromMacOSBundle
(
String
bundlePath
)
{
...
...
@@ -435,7 +435,7 @@ class AndroidStudio implements Comparable<AndroidStudio> {
return
keyMatcher
.
stringMatch
(
plistValue
)?.
split
(
'='
).
last
.
trim
().
replaceAll
(
'"'
,
''
);
}
void
_init
()
{
void
_init
(
{
Version
?
version
}
)
{
_isValid
=
false
;
_validationMessages
.
clear
();
...
...
@@ -449,6 +449,8 @@ class AndroidStudio implements Comparable<AndroidStudio> {
}
final
String
javaPath
=
globals
.
platform
.
isMacOS
?
version
!=
null
&&
version
.
major
>=
2020
?
globals
.
fs
.
path
.
join
(
directory
,
'jre'
,
'Contents'
,
'Home'
)
:
globals
.
fs
.
path
.
join
(
directory
,
'jre'
,
'jdk'
,
'Contents'
,
'Home'
)
:
globals
.
fs
.
path
.
join
(
directory
,
'jre'
);
final
String
javaExecutable
=
globals
.
fs
.
path
.
join
(
javaPath
,
'bin'
,
'java'
);
...
...
packages/flutter_tools/test/general.shard/android/android_studio_test.dart
View file @
f9aa5842
...
...
@@ -45,6 +45,19 @@ const Map<String, dynamic> macStudioInfoPlist4_1 = <String, dynamic>{
},
};
const
Map
<
String
,
dynamic
>
macStudioInfoPlist2020_3
=
<
String
,
dynamic
>{
'CFBundleGetInfoString'
:
'Android Studio 2020.3, build AI-203.7717.56.2031.7583922. Copyright JetBrains s.r.o., (c) 2000-2021'
,
'CFBundleShortVersionString'
:
'2020.3'
,
'CFBundleVersion'
:
'AI-203.7717.56.2031.7583922'
,
'JVMOptions'
:
<
String
,
dynamic
>{
'Properties'
:
<
String
,
dynamic
>{
'idea.vendor.name'
:
'Google'
,
'idea.paths.selector'
:
'AndroidStudio2020.3'
,
'idea.platform.prefix'
:
'AndroidStudio'
,
},
},
};
final
Platform
linuxPlatform
=
FakePlatform
(
operatingSystem:
'linux'
,
environment:
<
String
,
String
>{
'HOME'
:
homeLinux
},
...
...
@@ -144,6 +157,38 @@ void main() {
Platform:
()
=>
platform
,
PlistParser:
()
=>
plistUtils
,
});
testUsingContext
(
'Can discover Android Studio >=2020.3 location on Mac'
,
()
{
final
String
studioInApplicationPlistFolder
=
globals
.
fs
.
path
.
join
(
'/'
,
'Application'
,
'Android Studio.app'
,
'Contents'
,
);
globals
.
fs
.
directory
(
studioInApplicationPlistFolder
).
createSync
(
recursive:
true
);
final
String
plistFilePath
=
globals
.
fs
.
path
.
join
(
studioInApplicationPlistFolder
,
'Info.plist'
);
plistUtils
.
fileContents
[
plistFilePath
]
=
macStudioInfoPlist2020_3
;
final
AndroidStudio
studio
=
AndroidStudio
.
fromMacOSBundle
(
globals
.
fs
.
directory
(
studioInApplicationPlistFolder
)?.
parent
?.
path
,
);
expect
(
studio
,
isNotNull
);
expect
(
studio
.
pluginsPath
,
equals
(
globals
.
fs
.
path
.
join
(
homeMac
,
'Library'
,
'Application Support'
,
'Google'
,
'AndroidStudio2020.3'
,
)));
},
overrides:
<
Type
,
Generator
>{
FileSystem:
()
=>
fileSystem
,
FileSystemUtils:
()
=>
fsUtils
,
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
// Custom home paths are not supported on macOS nor Windows yet,
// so we force the platform to fake Linux here.
Platform:
()
=>
platform
,
PlistParser:
()
=>
plistUtils
,
});
testUsingContext
(
'Can discover Android Studio <4.1 location on Mac'
,
()
{
final
String
studioInApplicationPlistFolder
=
globals
.
fs
.
path
.
join
(
...
...
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