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> {
pathsSelectorValue = jvmProperties['idea.paths.selector'] as String;
}
}
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(
final String presetPluginsPath = pathsSelectorValue == null
? null
: 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);
}
......@@ -141,23 +127,12 @@ class AndroidStudio implements Comparable<AndroidStudio> {
final int major = version?.major;
final int minor = version?.minor;
if (globals.platform.isMacOS) {
/// 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,
......
......@@ -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(
operatingSystem: 'linux',
environment: <String, String>{'HOME': homeLinux},
......@@ -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', () {
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