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
c2dc92ca
Unverified
Commit
c2dc92ca
authored
Apr 14, 2022
by
Lau Ching Jun
Committed by
GitHub
Apr 14, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Default to the newer version path when checking Android Studio Java path (#101862)
parent
41b73894
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
86 additions
and
5 deletions
+86
-5
android_studio.dart
packages/flutter_tools/lib/src/android/android_studio.dart
+2
-2
android_studio_test.dart
...tools/test/general.shard/android/android_studio_test.dart
+84
-3
No files found.
packages/flutter_tools/lib/src/android/android_studio.dart
View file @
c2dc92ca
...
...
@@ -445,9 +445,9 @@ class AndroidStudio implements Comparable<AndroidStudio> {
}
final
String
javaPath
=
globals
.
platform
.
isMacOS
?
version
!=
null
&&
version
.
major
>=
2020
?
globals
.
fs
.
path
.
join
(
directory
,
'jre'
,
'Contents'
,
'Home'
)
:
version
!=
null
&&
version
.
major
<
2020
?
globals
.
fs
.
path
.
join
(
directory
,
'jre'
,
'jdk'
,
'Contents'
,
'Home'
)
:
globals
.
fs
.
path
.
join
(
directory
,
'jre'
,
'Contents'
,
'Home'
)
:
globals
.
fs
.
path
.
join
(
directory
,
'jre'
);
final
String
javaExecutable
=
globals
.
fs
.
path
.
join
(
javaPath
,
'bin'
,
'java'
);
if
(!
globals
.
processManager
.
canRun
(
javaExecutable
))
{
...
...
packages/flutter_tools/test/general.shard/android/android_studio_test.dart
View file @
c2dc92ca
...
...
@@ -58,6 +58,19 @@ const Map<String, dynamic> macStudioInfoPlist2020_3 = <String, dynamic>{
},
};
const
Map
<
String
,
dynamic
>
macStudioInfoPlistEAP
=
<
String
,
dynamic
>{
'CFBundleGetInfoString'
:
'Android Studio EAP AI-212.5712.43.2112.8233820, build AI-212.5712.43.2112.8233820. Copyright JetBrains s.r.o., (c) 2000-2022'
,
'CFBundleShortVersionString'
:
'EAP AI-212.5712.43.2112.8233820'
,
'CFBundleVersion'
:
'AI-212.5712.43.2112.8233820'
,
'JVMOptions'
:
<
String
,
dynamic
>{
'Properties'
:
<
String
,
dynamic
>{
'idea.vendor.name'
:
'Google'
,
'idea.paths.selector'
:
'AndroidStudio2021.2'
,
'idea.platform.prefix'
:
'AndroidStudio'
,
},
},
};
final
Platform
linuxPlatform
=
FakePlatform
(
environment:
<
String
,
String
>{
'HOME'
:
homeLinux
},
);
...
...
@@ -135,6 +148,14 @@ void main() {
final
String
plistFilePath
=
globals
.
fs
.
path
.
join
(
studioInApplicationPlistFolder
,
'Info.plist'
);
plistUtils
.
fileContents
[
plistFilePath
]
=
macStudioInfoPlist4_1
;
processManager
.
addCommand
(
FakeCommand
(
command:
<
String
>[
globals
.
fs
.
path
.
join
(
studioInApplicationPlistFolder
,
'jre'
,
'jdk'
,
'Contents'
,
'Home'
,
'bin'
,
'java'
),
'-version'
,
],
stderr:
'123'
,
)
);
final
AndroidStudio
studio
=
AndroidStudio
.
fromMacOSBundle
(
globals
.
fs
.
directory
(
studioInApplicationPlistFolder
)?.
parent
?.
path
,
);
...
...
@@ -147,10 +168,11 @@ void main() {
'Google'
,
'AndroidStudio4.1'
,
)));
expect
(
studio
.
validationMessages
,
<
String
>[
'Java version 123'
]);
},
overrides:
<
Type
,
Generator
>{
FileSystem:
()
=>
fileSystem
,
FileSystemUtils:
()
=>
fsUtils
,
ProcessManager:
()
=>
FakeProcessManager
.
any
()
,
ProcessManager:
()
=>
processManager
,
// Custom home paths are not supported on macOS nor Windows yet,
// so we force the platform to fake Linux here.
Platform:
()
=>
platform
,
...
...
@@ -168,6 +190,14 @@ void main() {
final
String
plistFilePath
=
globals
.
fs
.
path
.
join
(
studioInApplicationPlistFolder
,
'Info.plist'
);
plistUtils
.
fileContents
[
plistFilePath
]
=
macStudioInfoPlist2020_3
;
processManager
.
addCommand
(
FakeCommand
(
command:
<
String
>[
globals
.
fs
.
path
.
join
(
studioInApplicationPlistFolder
,
'jre'
,
'Contents'
,
'Home'
,
'bin'
,
'java'
),
'-version'
,
],
stderr:
'123'
,
)
);
final
AndroidStudio
studio
=
AndroidStudio
.
fromMacOSBundle
(
globals
.
fs
.
directory
(
studioInApplicationPlistFolder
)?.
parent
?.
path
,
);
...
...
@@ -180,10 +210,11 @@ void main() {
'Google'
,
'AndroidStudio2020.3'
,
)));
expect
(
studio
.
validationMessages
,
<
String
>[
'Java version 123'
]);
},
overrides:
<
Type
,
Generator
>{
FileSystem:
()
=>
fileSystem
,
FileSystemUtils:
()
=>
fsUtils
,
ProcessManager:
()
=>
FakeProcessManager
.
any
()
,
ProcessManager:
()
=>
processManager
,
// Custom home paths are not supported on macOS nor Windows yet,
// so we force the platform to fake Linux here.
Platform:
()
=>
platform
,
...
...
@@ -201,6 +232,14 @@ void main() {
final
String
plistFilePath
=
globals
.
fs
.
path
.
join
(
studioInApplicationPlistFolder
,
'Info.plist'
);
plistUtils
.
fileContents
[
plistFilePath
]
=
macStudioInfoPlist
;
processManager
.
addCommand
(
FakeCommand
(
command:
<
String
>[
globals
.
fs
.
path
.
join
(
studioInApplicationPlistFolder
,
'jre'
,
'jdk'
,
'Contents'
,
'Home'
,
'bin'
,
'java'
),
'-version'
,
],
stderr:
'123'
,
)
);
final
AndroidStudio
studio
=
AndroidStudio
.
fromMacOSBundle
(
globals
.
fs
.
directory
(
studioInApplicationPlistFolder
)?.
parent
?.
path
,
);
...
...
@@ -212,10 +251,52 @@ void main() {
'Application Support'
,
'AndroidStudio3.3'
,
)));
expect
(
studio
.
validationMessages
,
<
String
>[
'Java version 123'
]);
},
overrides:
<
Type
,
Generator
>{
FileSystem:
()
=>
fileSystem
,
FileSystemUtils:
()
=>
fsUtils
,
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
ProcessManager:
()
=>
processManager
,
// 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 EAP location on Mac'
,
()
{
final
String
studioInApplicationPlistFolder
=
globals
.
fs
.
path
.
join
(
'/'
,
'Application'
,
'Android Studio with suffix.app'
,
'Contents'
,
);
globals
.
fs
.
directory
(
studioInApplicationPlistFolder
).
createSync
(
recursive:
true
);
final
String
plistFilePath
=
globals
.
fs
.
path
.
join
(
studioInApplicationPlistFolder
,
'Info.plist'
);
plistUtils
.
fileContents
[
plistFilePath
]
=
macStudioInfoPlistEAP
;
processManager
.
addCommand
(
FakeCommand
(
command:
<
String
>[
globals
.
fs
.
path
.
join
(
studioInApplicationPlistFolder
,
'jre'
,
'Contents'
,
'Home'
,
'bin'
,
'java'
),
'-version'
,
],
stderr:
'123'
,
)
);
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'
,
'AndroidStudio2021.2'
,
)));
expect
(
studio
.
validationMessages
,
<
String
>[
'Java version 123'
]);
},
overrides:
<
Type
,
Generator
>{
FileSystem:
()
=>
fileSystem
,
FileSystemUtils:
()
=>
fsUtils
,
ProcessManager:
()
=>
processManager
,
// Custom home paths are not supported on macOS nor Windows yet,
// so we force the platform to fake Linux here.
Platform:
()
=>
platform
,
...
...
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