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
aed9b4ad
Unverified
Commit
aed9b4ad
authored
Feb 07, 2023
by
Christopher Fujino
Committed by
GitHub
Feb 07, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "Revert "Fix unable to find bundled Java version (#119244)" (#119981)" (#120107)
This reverts commit
f7c2bd05
.
parent
5be7f663
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
182 additions
and
6 deletions
+182
-6
AUTHORS
AUTHORS
+2
-1
android_studio.dart
packages/flutter_tools/lib/src/android/android_studio.dart
+16
-5
android_studio_test.dart
...tools/test/general.shard/android/android_studio_test.dart
+164
-0
No files found.
AUTHORS
View file @
aed9b4ad
...
@@ -100,4 +100,5 @@ Jingyi Chen <jingyichen@link.cuhk.edu.cn>
...
@@ -100,4 +100,5 @@ Jingyi Chen <jingyichen@link.cuhk.edu.cn>
Junhua Lin <1075209054@qq.com>
Junhua Lin <1075209054@qq.com>
Tomasz Gucio <tgucio@gmail.com>
Tomasz Gucio <tgucio@gmail.com>
Jason C.H <ctrysbita@outlook.com>
Jason C.H <ctrysbita@outlook.com>
Hubert Jóźwiak <hjozwiakdx@gmail.com>
Hubert Jóźwiak <hjozwiakdx@gmail.com>
\ No newline at end of file
Eli Albert <crasowas@gmail.com>
\ No newline at end of file
packages/flutter_tools/lib/src/android/android_studio.dart
View file @
aed9b4ad
...
@@ -441,11 +441,22 @@ class AndroidStudio implements Comparable<AndroidStudio> {
...
@@ -441,11 +441,22 @@ class AndroidStudio implements Comparable<AndroidStudio> {
return
;
return
;
}
}
final
String
javaPath
=
globals
.
platform
.
isMacOS
?
final
String
javaPath
;
version
!=
null
&&
version
.
major
<
2020
?
if
(
globals
.
platform
.
isMacOS
)
{
globals
.
fs
.
path
.
join
(
directory
,
'jre'
,
'jdk'
,
'Contents'
,
'Home'
)
:
if
(
version
!=
null
&&
version
.
major
<
2020
)
{
globals
.
fs
.
path
.
join
(
directory
,
'jre'
,
'Contents'
,
'Home'
)
:
javaPath
=
globals
.
fs
.
path
.
join
(
directory
,
'jre'
,
'jdk'
,
'Contents'
,
'Home'
);
globals
.
fs
.
path
.
join
(
directory
,
'jre'
);
}
else
if
(
version
!=
null
&&
version
.
major
==
2022
)
{
javaPath
=
globals
.
fs
.
path
.
join
(
directory
,
'jbr'
,
'Contents'
,
'Home'
);
}
else
{
javaPath
=
globals
.
fs
.
path
.
join
(
directory
,
'jre'
,
'Contents'
,
'Home'
);
}
}
else
{
if
(
version
!=
null
&&
version
.
major
==
2022
)
{
javaPath
=
globals
.
fs
.
path
.
join
(
directory
,
'jbr'
);
}
else
{
javaPath
=
globals
.
fs
.
path
.
join
(
directory
,
'jre'
);
}
}
final
String
javaExecutable
=
globals
.
fs
.
path
.
join
(
javaPath
,
'bin'
,
'java'
);
final
String
javaExecutable
=
globals
.
fs
.
path
.
join
(
javaPath
,
'bin'
,
'java'
);
if
(!
globals
.
processManager
.
canRun
(
javaExecutable
))
{
if
(!
globals
.
processManager
.
canRun
(
javaExecutable
))
{
_validationMessages
.
add
(
'Unable to find bundled Java version.'
);
_validationMessages
.
add
(
'Unable to find bundled Java version.'
);
...
...
packages/flutter_tools/test/general.shard/android/android_studio_test.dart
View file @
aed9b4ad
...
@@ -56,6 +56,19 @@ const Map<String, Object> macStudioInfoPlist2020_3 = <String, Object>{
...
@@ -56,6 +56,19 @@ const Map<String, Object> macStudioInfoPlist2020_3 = <String, Object>{
},
},
};
};
const
Map
<
String
,
Object
>
macStudioInfoPlist2022_1
=
<
String
,
Object
>{
'CFBundleGetInfoString'
:
'Android Studio 2022.1, build AI-221.6008.13.2211.9477386. Copyright JetBrains s.r.o., (c) 2000-2023'
,
'CFBundleShortVersionString'
:
'2022.1'
,
'CFBundleVersion'
:
'AI-221.6008.13.2211.9477386'
,
'JVMOptions'
:
<
String
,
Object
>{
'Properties'
:
<
String
,
Object
>{
'idea.vendor.name'
:
'Google'
,
'idea.paths.selector'
:
'AndroidStudio2022.1'
,
'idea.platform.prefix'
:
'AndroidStudio'
,
},
},
};
const
Map
<
String
,
Object
>
macStudioInfoPlistEAP
=
<
String
,
Object
>{
const
Map
<
String
,
Object
>
macStudioInfoPlistEAP
=
<
String
,
Object
>{
'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'
,
'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'
,
'CFBundleShortVersionString'
:
'EAP AI-212.5712.43.2112.8233820'
,
...
@@ -486,6 +499,84 @@ void main() {
...
@@ -486,6 +499,84 @@ void main() {
Platform:
()
=>
platform
,
Platform:
()
=>
platform
,
PlistParser:
()
=>
plistUtils
,
PlistParser:
()
=>
plistUtils
,
});
});
testUsingContext
(
'Can find Android Studio 2020.3 bundled Java version 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
;
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
.
javaPath
,
equals
(
globals
.
fs
.
path
.
join
(
studioInApplicationPlistFolder
,
'jre'
,
'Contents'
,
'Home'
,
)));
},
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
,
PlistParser:
()
=>
plistUtils
,
});
testUsingContext
(
'Can find Android Studio 2022.1 bundled Java version 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
]
=
macStudioInfoPlist2022_1
;
processManager
.
addCommand
(
FakeCommand
(
command:
<
String
>[
globals
.
fs
.
path
.
join
(
studioInApplicationPlistFolder
,
'jbr'
,
'Contents'
,
'Home'
,
'bin'
,
'java'
),
'-version'
,
],
stderr:
'123'
,
)
);
final
AndroidStudio
studio
=
AndroidStudio
.
fromMacOSBundle
(
globals
.
fs
.
directory
(
studioInApplicationPlistFolder
).
parent
.
path
,
)!;
expect
(
studio
.
javaPath
,
equals
(
globals
.
fs
.
path
.
join
(
studioInApplicationPlistFolder
,
'jbr'
,
'Contents'
,
'Home'
,
)));
},
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
,
PlistParser:
()
=>
plistUtils
,
});
});
});
late
FileSystem
windowsFileSystem
;
late
FileSystem
windowsFileSystem
;
...
@@ -596,6 +687,38 @@ void main() {
...
@@ -596,6 +687,38 @@ void main() {
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
});
});
testUsingContext
(
'Can find Android Studio 2020.3 bundled Java version on Windows'
,
()
{
windowsFileSystem
.
file
(
r'C:\Users\Dash\AppData\Local\Google\AndroidStudio2020.3\.home'
)
..
createSync
(
recursive:
true
)
..
writeAsStringSync
(
r'C:\Program Files\AndroidStudio'
);
windowsFileSystem
.
directory
(
r'C:\Program Files\AndroidStudio'
)
.
createSync
(
recursive:
true
);
final
AndroidStudio
studio
=
AndroidStudio
.
allInstalled
().
single
;
expect
(
studio
.
javaPath
,
equals
(
r'C:\Program Files\AndroidStudio\jre'
));
},
overrides:
<
Type
,
Generator
>{
Platform:
()
=>
windowsPlatform
,
FileSystem:
()
=>
windowsFileSystem
,
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
});
testUsingContext
(
'Can find Android Studio 2022.1 bundled Java version on Windows'
,
()
{
windowsFileSystem
.
file
(
r'C:\Users\Dash\AppData\Local\Google\AndroidStudio2022.1\.home'
)
..
createSync
(
recursive:
true
)
..
writeAsStringSync
(
r'C:\Program Files\AndroidStudio'
);
windowsFileSystem
.
directory
(
r'C:\Program Files\AndroidStudio'
)
.
createSync
(
recursive:
true
);
final
AndroidStudio
studio
=
AndroidStudio
.
allInstalled
().
single
;
expect
(
studio
.
javaPath
,
equals
(
r'C:\Program Files\AndroidStudio\jbr'
));
},
overrides:
<
Type
,
Generator
>{
Platform:
()
=>
windowsPlatform
,
FileSystem:
()
=>
windowsFileSystem
,
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
});
group
(
'Installation detection on Linux'
,
()
{
group
(
'Installation detection on Linux'
,
()
{
late
FileSystemUtils
fsUtils
;
late
FileSystemUtils
fsUtils
;
...
@@ -686,6 +809,47 @@ void main() {
...
@@ -686,6 +809,47 @@ void main() {
Platform:
()
=>
linuxPlatform
,
Platform:
()
=>
linuxPlatform
,
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
});
});
testUsingContext
(
'Can find Android Studio 2020.3 bundled Java version on Linux'
,
()
{
const
String
studioHomeFilePath
=
'
$homeLinux
/.cache/Google/AndroidStudio2020.3/.home'
;
const
String
studioInstallPath
=
'
$homeLinux
/AndroidStudio'
;
globals
.
fs
.
file
(
studioHomeFilePath
)
..
createSync
(
recursive:
true
)
..
writeAsStringSync
(
studioInstallPath
);
globals
.
fs
.
directory
(
studioInstallPath
).
createSync
();
final
AndroidStudio
studio
=
AndroidStudio
.
allInstalled
().
single
;
expect
(
studio
.
javaPath
,
equals
(
'
$studioInstallPath
/jre'
));
},
overrides:
<
Type
,
Generator
>{
FileSystem:
()
=>
fileSystem
,
FileSystemUtils:
()
=>
fsUtils
,
Platform:
()
=>
linuxPlatform
,
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
});
testUsingContext
(
'Can find Android Studio 2022.1 bundled Java version on Linux'
,
()
{
const
String
studioHomeFilePath
=
'
$homeLinux
/.cache/Google/AndroidStudio2022.1/.home'
;
const
String
studioInstallPath
=
'
$homeLinux
/AndroidStudio'
;
globals
.
fs
.
file
(
studioHomeFilePath
)
..
createSync
(
recursive:
true
)
..
writeAsStringSync
(
studioInstallPath
);
globals
.
fs
.
directory
(
studioInstallPath
).
createSync
();
final
AndroidStudio
studio
=
AndroidStudio
.
allInstalled
().
single
;
expect
(
studio
.
javaPath
,
equals
(
'
$studioInstallPath
/jbr'
));
},
overrides:
<
Type
,
Generator
>{
FileSystem:
()
=>
fileSystem
,
FileSystemUtils:
()
=>
fsUtils
,
Platform:
()
=>
linuxPlatform
,
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
});
});
});
}
}
...
...
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