[flutter_tools] Support latest IntelliJ via Jetbrain toolbox (#57963)
This commit is contained in:
parent
356b958f66
commit
428ce0815b
@ -915,19 +915,32 @@ class IntelliJValidatorOnMac extends IntelliJValidator {
|
||||
}
|
||||
|
||||
final List<String> split = version.split('.');
|
||||
|
||||
if (split.length < 2) {
|
||||
return null;
|
||||
}
|
||||
|
||||
final String major = split[0];
|
||||
final String minor = split[1];
|
||||
_pluginsPath = globals.fs.path.join(
|
||||
globals.fsUtils.homeDirPath,
|
||||
|
||||
final String homeDirPath = globals.fsUtils.homeDirPath;
|
||||
String pluginsPath = globals.fs.path.join(
|
||||
homeDirPath,
|
||||
'Library',
|
||||
'Application Support',
|
||||
'JetBrains',
|
||||
'$id$major.$minor',
|
||||
'plugins',
|
||||
);
|
||||
// Fallback to legacy location from < 2020.
|
||||
if (!globals.fs.isDirectorySync(pluginsPath)) {
|
||||
pluginsPath = globals.fs.path.join(
|
||||
homeDirPath,
|
||||
'Library',
|
||||
'Application Support',
|
||||
'$id$major.$minor',
|
||||
);
|
||||
}
|
||||
_pluginsPath = pluginsPath;
|
||||
|
||||
return _pluginsPath;
|
||||
}
|
||||
String _pluginsPath;
|
||||
|
@ -19,6 +19,7 @@ import 'package:flutter_tools/src/commands/doctor.dart';
|
||||
import 'package:flutter_tools/src/doctor.dart';
|
||||
import 'package:flutter_tools/src/features.dart';
|
||||
import 'package:flutter_tools/src/globals.dart' as globals;
|
||||
import 'package:flutter_tools/src/ios/plist_parser.dart';
|
||||
import 'package:flutter_tools/src/proxy_validator.dart';
|
||||
import 'package:flutter_tools/src/reporting/reporting.dart';
|
||||
import 'package:flutter_tools/src/version.dart';
|
||||
@ -55,6 +56,14 @@ void main() {
|
||||
});
|
||||
|
||||
group('doctor', () {
|
||||
MockPlistParser mockPlistParser;
|
||||
MemoryFileSystem fileSystem;
|
||||
|
||||
setUp(() {
|
||||
mockPlistParser = MockPlistParser();
|
||||
fileSystem = MemoryFileSystem.test();
|
||||
});
|
||||
|
||||
testUsingContext('intellij validator', () async {
|
||||
const String installPath = '/path/to/intelliJ';
|
||||
final ValidationResult result = await IntelliJValidatorTestTarget('Test', installPath).validate();
|
||||
@ -77,14 +86,39 @@ void main() {
|
||||
}, overrides: noColorTerminalOverride);
|
||||
|
||||
testUsingContext('intellij plugins path checking on mac', () async {
|
||||
final String pathViaToolbox = globals.fs.path.join('test', 'data', 'intellij', 'mac_via_toolbox');
|
||||
final String pathNotViaToolbox = globals.fs.path.join('test', 'data', 'intellij', 'mac_not_via_toolbox');
|
||||
when(mockPlistParser.getValueFromFile(any, PlistParser.kCFBundleShortVersionStringKey)).thenReturn('2020.10');
|
||||
|
||||
final IntelliJValidatorOnMac validatorViaToolbox = IntelliJValidatorOnMac('Test', 'Test', pathViaToolbox);
|
||||
expect(validatorViaToolbox.plistFile, 'test/data/intellij/mac_via_toolbox/Contents/Info.plist');
|
||||
final Directory pluginsDirectory = fileSystem.directory('/foo/bar/Library/Application Support/JetBrains/TestID2020.10/plugins')
|
||||
..createSync(recursive: true);
|
||||
final IntelliJValidatorOnMac validator = IntelliJValidatorOnMac('Test', 'TestID', '/path/to/app');
|
||||
expect(validator.plistFile, '/path/to/app/Contents/Info.plist');
|
||||
expect(validator.pluginsPath, pluginsDirectory.path);
|
||||
}, overrides: <Type, Generator>{
|
||||
Platform: () => FakePlatform()
|
||||
..environment = <String, String>{'HOME': '/foo/bar'},
|
||||
PlistParser: () => mockPlistParser,
|
||||
FileSystem: () => fileSystem,
|
||||
ProcessManager: () => mockProcessManager,
|
||||
});
|
||||
|
||||
final IntelliJValidatorOnMac validatorNotViaToolbox = IntelliJValidatorOnMac('Test', 'Test', pathNotViaToolbox);
|
||||
expect(validatorNotViaToolbox.plistFile, 'test/data/intellij/mac_not_via_toolbox/Contents/Info.plist');
|
||||
testUsingContext('legacy intellij plugins path checking on mac', () async {
|
||||
when(mockPlistParser.getValueFromFile(any, PlistParser.kCFBundleShortVersionStringKey)).thenReturn('2020.10');
|
||||
|
||||
final IntelliJValidatorOnMac validator = IntelliJValidatorOnMac('Test', 'TestID', '/foo');
|
||||
expect(validator.pluginsPath, '/foo/bar/Library/Application Support/TestID2020.10');
|
||||
}, overrides: <Type, Generator>{
|
||||
Platform: () => FakePlatform()
|
||||
..environment = <String, String>{'HOME': '/foo/bar'},
|
||||
PlistParser: () => mockPlistParser,
|
||||
});
|
||||
|
||||
testUsingContext('intellij plugins path checking on mac with override', () async {
|
||||
when(mockPlistParser.getValueFromFile(any, 'JetBrainsToolboxApp')).thenReturn('/path/to/JetBrainsToolboxApp');
|
||||
|
||||
final IntelliJValidatorOnMac validator = IntelliJValidatorOnMac('Test', 'TestID', '/foo');
|
||||
expect(validator.pluginsPath, '/path/to/JetBrainsToolboxApp.plugins');
|
||||
}, overrides: <Type, Generator>{
|
||||
PlistParser: () => mockPlistParser,
|
||||
});
|
||||
|
||||
testUsingContext('vs code validator when both installed', () async {
|
||||
@ -1185,3 +1219,4 @@ class VsCodeValidatorTestTargets extends VsCodeValidator {
|
||||
|
||||
class MockProcessManager extends Mock implements ProcessManager {}
|
||||
class MockArtifacts extends Mock implements Artifacts {}
|
||||
class MockPlistParser extends Mock implements PlistParser {}
|
||||
|
@ -1,38 +0,0 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<!DOCTYPE plist PUBLIC '-//Apple Computer//DTD PLIST 1.0//EN' 'http://www.apple.com/DTDs/PropertyList-1.0.dtd'>
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>English</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>jetbrains-toolbox-launcher</string>
|
||||
<key>CFBundleGetInfoString</key>
|
||||
<string/>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>NSHumanReadableCopyright</key>
|
||||
<string>Copyright (c) JetBrains s.r.o.</string>
|
||||
<key>NSHighResolutionCapable</key>
|
||||
<true/>
|
||||
<key>NSUIElement</key>
|
||||
<false/>
|
||||
<key>LSUIElement</key>
|
||||
<true/>
|
||||
<key>CFBundleName</key>
|
||||
<string>IntelliJ IDEA Ultimate 2019.3.3</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>com.jetbrains.apps.activator.linkapp.pcom.jetbrains.apps.activator__ntelli_ltimate_2019_3_3</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>2019.3.3</string>
|
||||
<key>CFBundleLongVersionString</key>
|
||||
<string>2019.3.3</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>2019.3.3</string>
|
||||
<key>CFBundleIconFile</key>
|
||||
<string>icon.icns</string>
|
||||
</dict>
|
||||
</plist>
|
@ -1,40 +0,0 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<!DOCTYPE plist PUBLIC '-//Apple Computer//DTD PLIST 1.0//EN' 'http://www.apple.com/DTDs/PropertyList-1.0.dtd'>
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>English</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>jetbrains-toolbox-launcher</string>
|
||||
<key>CFBundleGetInfoString</key>
|
||||
<string/>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>NSHumanReadableCopyright</key>
|
||||
<string>Copyright (c) JetBrains s.r.o.</string>
|
||||
<key>NSHighResolutionCapable</key>
|
||||
<true/>
|
||||
<key>NSUIElement</key>
|
||||
<false/>
|
||||
<key>LSUIElement</key>
|
||||
<true/>
|
||||
<key>CFBundleName</key>
|
||||
<string>IntelliJ IDEA Ultimate 2019.3.3</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>com.jetbrains.apps.activator.linkapp.pcom.jetbrains.apps.activator__ntelli_ltimate_2019_3_3</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>2019.3.3</string>
|
||||
<key>CFBundleLongVersionString</key>
|
||||
<string>2019.3.3</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>2019.3.3</string>
|
||||
<key>CFBundleIconFile</key>
|
||||
<string>icon.icns</string>
|
||||
<key>JetBrainsToolboxApp</key>
|
||||
<string>/Users/lynn/Library/Application Support/JetBrains/Toolbox/apps/IDEA-U/ch-0/193.6494.35/IntelliJ IDEA.app</string>
|
||||
</dict>
|
||||
</plist>
|
Loading…
x
Reference in New Issue
Block a user