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
66e54223
Commit
66e54223
authored
Sep 12, 2018
by
Joao da Silva
Committed by
Mehmet Fidanboylu
Sep 12, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Check for AndroidStudio plugins in the right .dot dir. (#20619)
This fixes issues 11940 and 18155.
parent
d02e67e7
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
56 additions
and
5 deletions
+56
-5
android_studio.dart
packages/flutter_tools/lib/src/android/android_studio.dart
+12
-5
android_studio_test.dart
packages/flutter_tools/test/android/android_studio_test.dart
+44
-0
No files found.
packages/flutter_tools/lib/src/android/android_studio.dart
View file @
66e54223
...
...
@@ -25,17 +25,19 @@ AndroidStudio get androidStudio => context[AndroidStudio];
// $HOME/Applications/Android Studio.app/Contents/
final
RegExp
_dotHomeStudioVersionMatcher
=
RegExp
(
r'^\.
AndroidStudio(
[^\d]*)([\d.]+)'
);
RegExp
(
r'^\.
(AndroidStudio
[^\d]*)([\d.]+)'
);
String
get
javaPath
=>
androidStudio
?.
javaPath
;
class
AndroidStudio
implements
Comparable
<
AndroidStudio
>
{
AndroidStudio
(
this
.
directory
,
{
Version
version
,
this
.
configured
})
AndroidStudio
(
this
.
directory
,
{
Version
version
,
this
.
configured
,
this
.
studioAppName
=
'AndroidStudio'
})
:
this
.
version
=
version
??
Version
.
unknown
{
_init
();
}
final
String
directory
;
final
String
studioAppName
;
final
Version
version
;
final
String
configured
;
...
...
@@ -65,7 +67,8 @@ class AndroidStudio implements Comparable<AndroidStudio> {
return
null
;
}
final
Version
version
=
Version
.
parse
(
versionMatch
[
2
]);
if
(
version
==
null
)
{
final
String
studioAppName
=
versionMatch
[
1
];
if
(
studioAppName
==
null
||
version
==
null
)
{
return
null
;
}
String
installPath
;
...
...
@@ -77,7 +80,11 @@ class AndroidStudio implements Comparable<AndroidStudio> {
// ignored, installPath will be null, which is handled below
}
if
(
installPath
!=
null
&&
fs
.
isDirectorySync
(
installPath
))
{
return
AndroidStudio
(
installPath
,
version:
version
);
return
AndroidStudio
(
installPath
,
version:
version
,
studioAppName:
studioAppName
,
);
}
return
null
;
}
...
...
@@ -98,7 +105,7 @@ class AndroidStudio implements Comparable<AndroidStudio> {
'AndroidStudio
$major
.
$minor
'
);
}
else
{
_pluginsPath
=
fs
.
path
.
join
(
homeDirPath
,
'.
AndroidStudio
$major
.
$minor
'
,
'.
$studioAppName
$major
.
$minor
'
,
'config'
,
'plugins'
);
}
...
...
packages/flutter_tools/test/android/android_studio_test.dart
0 → 100644
View file @
66e54223
import
'package:file/memory.dart'
;
import
'package:flutter_tools/src/android/android_studio.dart'
;
import
'package:flutter_tools/src/base/file_system.dart'
;
import
'package:flutter_tools/src/base/platform.dart'
;
import
'../src/common.dart'
;
import
'../src/context.dart'
;
const
String
home
=
'/home/me'
;
Platform
linuxPlatform
(
)
{
return
FakePlatform
.
fromPlatform
(
const
LocalPlatform
())
..
operatingSystem
=
'linux'
..
environment
=
<
String
,
String
>{
'HOME'
:
home
};
}
void
main
(
)
{
const
String
installPath
=
'/opt/android-studio-with-cheese-5.0'
;
const
String
studioHome
=
'
$home
/.AndroidStudioWithCheese5.0'
;
const
String
homeFile
=
'
$studioHome
/system/.home'
;
MemoryFileSystem
fs
;
setUp
(()
{
fs
=
MemoryFileSystem
();
fs
.
directory
(
installPath
).
createSync
(
recursive:
true
);
fs
.
file
(
homeFile
).
createSync
(
recursive:
true
);
fs
.
file
(
homeFile
).
writeAsStringSync
(
installPath
);
});
group
(
'pluginsPath'
,
()
{
testUsingContext
(
'extracts custom paths from home dir'
,
()
{
final
AndroidStudio
studio
=
AndroidStudio
.
fromHomeDot
(
fs
.
directory
(
studioHome
));
expect
(
studio
,
isNotNull
);
expect
(
studio
.
pluginsPath
,
equals
(
'/home/me/.AndroidStudioWithCheese5.0/config/plugins'
));
},
overrides:
<
Type
,
Generator
>{
FileSystem:
()
=>
fs
,
// Note that custom home paths are not supported on macOS nor Windows yet:
Platform:
()
=>
linuxPlatform
(),
});
});
}
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