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
422a97d1
Unverified
Commit
422a97d1
authored
Nov 05, 2020
by
Mokusesei
Committed by
GitHub
Nov 05, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix: fix android studio 4.1 plugin path for macOS (#69364)
parent
ada6b7e5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
117 additions
and
14 deletions
+117
-14
android_studio.dart
packages/flutter_tools/lib/src/android/android_studio.dart
+39
-14
android_studio_test.dart
...tools/test/general.shard/android/android_studio_test.dart
+78
-0
No files found.
packages/flutter_tools/lib/src/android/android_studio.dart
View file @
422a97d1
...
...
@@ -66,14 +66,28 @@ class AndroidStudio implements Comparable<AndroidStudio> {
pathsSelectorValue
=
jvmProperties
[
'idea.paths.selector'
]
as
String
;
}
}
final
String
presetPluginsPath
=
pathsSelectorValue
==
null
?
null
:
globals
.
fs
.
path
.
join
(
globals
.
fsUtils
.
homeDirPath
,
'Library'
,
'Application Support'
,
pathsSelectorValue
,
);
final
int
major
=
version
?.
major
;
final
int
minor
=
version
?.
minor
;
String
presetPluginsPath
;
if
(
pathsSelectorValue
!=
null
)
{
if
(
major
>=
4
&&
minor
>=
1
)
{
presetPluginsPath
=
globals
.
fs
.
path
.
join
(
globals
.
fsUtils
.
homeDirPath
,
'Library'
,
'Application Support'
,
'Google'
,
pathsSelectorValue
,
);
}
else
{
presetPluginsPath
=
globals
.
fs
.
path
.
join
(
globals
.
fsUtils
.
homeDirPath
,
'Library'
,
'Application Support'
,
pathsSelectorValue
,
);
}
}
return
AndroidStudio
(
studioPath
,
version:
version
,
presetPluginsPath:
presetPluginsPath
);
}
...
...
@@ -127,12 +141,23 @@ class AndroidStudio implements Comparable<AndroidStudio> {
final
int
major
=
version
?.
major
;
final
int
minor
=
version
?.
minor
;
if
(
globals
.
platform
.
isMacOS
)
{
return
globals
.
fs
.
path
.
join
(
globals
.
fsUtils
.
homeDirPath
,
'Library'
,
'Application Support'
,
'AndroidStudio
$major
.
$minor
'
,
);
/// plugin path of Android Studio has been changed after version 4.1.
if
(
major
>=
4
&&
minor
>=
1
)
{
return
globals
.
fs
.
path
.
join
(
globals
.
fsUtils
.
homeDirPath
,
'Library'
,
'Application Support'
,
'Google'
,
'AndroidStudio
$major
.
$minor
'
,
);
}
else
{
return
globals
.
fs
.
path
.
join
(
globals
.
fsUtils
.
homeDirPath
,
'Library'
,
'Application Support'
,
'AndroidStudio
$major
.
$minor
'
,
);
}
}
else
{
return
globals
.
fs
.
path
.
join
(
globals
.
fsUtils
.
homeDirPath
,
...
...
packages/flutter_tools/test/general.shard/android/android_studio_test.dart
View file @
422a97d1
...
...
@@ -29,6 +29,19 @@ const Map<String, dynamic> macStudioInfoPlist = <String, dynamic>{
},
};
const
Map
<
String
,
dynamic
>
macStudioInfoPlist4_1
=
<
String
,
dynamic
>{
'CFBundleGetInfoString'
:
'Android Studio 4.1, build AI-201.8743.12.41.6858069. Copyright JetBrains s.r.o., (c) 2000-2020'
,
'CFBundleShortVersionString'
:
'4.1'
,
'CFBundleVersion'
:
'AI-201.8743.12.41.6858069'
,
'JVMOptions'
:
<
String
,
dynamic
>{
'Properties'
:
<
String
,
dynamic
>{
'idea.vendor.name'
:
'Google'
,
'idea.paths.selector'
:
'AndroidStudio4.1'
,
'idea.platform.prefix'
:
'AndroidStudio'
,
},
},
};
final
Platform
linuxPlatform
=
FakePlatform
(
operatingSystem:
'linux'
,
environment:
<
String
,
String
>{
'HOME'
:
homeLinux
},
...
...
@@ -96,6 +109,71 @@ void main() {
);
});
testUsingContext
(
'Can discover Android Studio >=4.1 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'
);
when
(
plistUtils
.
parseFile
(
plistFilePath
)).
thenReturn
(
macStudioInfoPlist4_1
);
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'
,
'AndroidStudio4.1'
,
)));
},
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
(
'/'
,
'Application'
,
'Android Studio.app'
,
'Contents'
,
);
globals
.
fs
.
directory
(
studioInApplicationPlistFolder
).
createSync
(
recursive:
true
);
final
String
plistFilePath
=
globals
.
fs
.
path
.
join
(
studioInApplicationPlistFolder
,
'Info.plist'
);
when
(
plistUtils
.
parseFile
(
plistFilePath
)).
thenReturn
(
macStudioInfoPlist
);
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'
,
'AndroidStudio3.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
(
'extracts custom paths for directly downloaded Android Studio 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