Unverified Commit 4c24eb10 authored by Vyacheslav Egorov's avatar Vyacheslav Egorov Committed by GitHub

Revert "Fix: fix android studio 4.1 plugin path for macOS" (#69870)

This reverts commit 422a97d1 due to https://github.com/flutter/flutter/issues/69863
parent 4bd89b39
...@@ -66,28 +66,14 @@ class AndroidStudio implements Comparable<AndroidStudio> { ...@@ -66,28 +66,14 @@ class AndroidStudio implements Comparable<AndroidStudio> {
pathsSelectorValue = jvmProperties['idea.paths.selector'] as String; pathsSelectorValue = jvmProperties['idea.paths.selector'] as String;
} }
} }
final String presetPluginsPath = pathsSelectorValue == null
final int major = version?.major; ? null
final int minor = version?.minor; : globals.fs.path.join(
String presetPluginsPath; globals.fsUtils.homeDirPath,
if (pathsSelectorValue != null) { 'Library',
if (major >= 4 && minor >= 1) { 'Application Support',
presetPluginsPath = globals.fs.path.join( pathsSelectorValue,
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); return AndroidStudio(studioPath, version: version, presetPluginsPath: presetPluginsPath);
} }
...@@ -141,23 +127,12 @@ class AndroidStudio implements Comparable<AndroidStudio> { ...@@ -141,23 +127,12 @@ class AndroidStudio implements Comparable<AndroidStudio> {
final int major = version?.major; final int major = version?.major;
final int minor = version?.minor; final int minor = version?.minor;
if (globals.platform.isMacOS) { if (globals.platform.isMacOS) {
/// plugin path of Android Studio has been changed after version 4.1. return globals.fs.path.join(
if (major >= 4 && minor >= 1) { globals.fsUtils.homeDirPath,
return globals.fs.path.join( 'Library',
globals.fsUtils.homeDirPath, 'Application Support',
'Library', 'AndroidStudio$major.$minor',
'Application Support', );
'Google',
'AndroidStudio$major.$minor',
);
} else {
return globals.fs.path.join(
globals.fsUtils.homeDirPath,
'Library',
'Application Support',
'AndroidStudio$major.$minor',
);
}
} else { } else {
return globals.fs.path.join( return globals.fs.path.join(
globals.fsUtils.homeDirPath, globals.fsUtils.homeDirPath,
......
...@@ -29,19 +29,6 @@ const Map<String, dynamic> macStudioInfoPlist = <String, dynamic>{ ...@@ -29,19 +29,6 @@ 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( final Platform linuxPlatform = FakePlatform(
operatingSystem: 'linux', operatingSystem: 'linux',
environment: <String, String>{'HOME': homeLinux}, environment: <String, String>{'HOME': homeLinux},
...@@ -109,71 +96,6 @@ void main() { ...@@ -109,71 +96,6 @@ 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', () { testUsingContext('extracts custom paths for directly downloaded Android Studio on Mac', () {
final String studioInApplicationPlistFolder = globals.fs.path.join( final String studioInApplicationPlistFolder = globals.fs.path.join(
'/', '/',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment