Unverified Commit 1e180062 authored by Nobuhiro Tabuki's avatar Nobuhiro Tabuki Committed by GitHub

[flutter_tools] Support IntelliJ 2020.1 and later on Linux and Windows (#58853)

This PR will update IntelliJ IDEA/Community validation logic for 2020.1 and later on Linux and Windows.
parent 081c47b8
......@@ -67,3 +67,4 @@ Ram Navan <hiramprasad@gmail.com>
meritozh <ah841814092@gmail.com>
Terrence Addison Tandijono(flotilla) <terrenceaddison32@gmail.com>
YeungKC <flutter@yeungkc.com>
Nobuhiro Tabuki <japanese.around30@gmail.com>
......@@ -47,8 +47,16 @@ abstract class IntelliJValidator extends DoctorValidator {
@required PlistParser plistParser,
}) {
final FileSystemUtils fileSystemUtils = FileSystemUtils(fileSystem: fileSystem, platform: platform);
if (platform.isLinux || platform.isWindows) {
return IntelliJValidatorOnLinuxAndWindows.installed(
if (platform.isWindows) {
return IntelliJValidatorOnWindows.installed(
fileSystem: fileSystem,
fileSystemUtils: fileSystemUtils,
platform: platform,
userMessages: userMessages,
);
}
if (platform.isLinux) {
return IntelliJValidatorOnLinux.installed(
fileSystem: fileSystem,
fileSystemUtils: fileSystemUtils,
userMessages: userMessages,
......@@ -124,9 +132,9 @@ abstract class IntelliJValidator extends DoctorValidator {
}
}
/// A linux and windows specific implementation of the intellij validator.
class IntelliJValidatorOnLinuxAndWindows extends IntelliJValidator {
IntelliJValidatorOnLinuxAndWindows(String title, this.version, String installPath, this.pluginsPath, {
/// A windows specific implementation of the intellij validator.
class IntelliJValidatorOnWindows extends IntelliJValidator {
IntelliJValidatorOnWindows(String title, this.version, String installPath, this.pluginsPath, {
@required FileSystem fileSystem,
@required UserMessages userMessages,
}) : super(title, installPath, fileSystem: fileSystem, userMessages: userMessages);
......@@ -140,6 +148,7 @@ class IntelliJValidatorOnLinuxAndWindows extends IntelliJValidator {
static Iterable<DoctorValidator> installed({
@required FileSystem fileSystem,
@required FileSystemUtils fileSystemUtils,
@required Platform platform,
@required UserMessages userMessages,
}) {
final List<DoctorValidator> validators = <DoctorValidator>[];
......@@ -148,7 +157,7 @@ class IntelliJValidatorOnLinuxAndWindows extends IntelliJValidator {
}
void addValidator(String title, String version, String installPath, String pluginsPath) {
final IntelliJValidatorOnLinuxAndWindows validator = IntelliJValidatorOnLinuxAndWindows(
final IntelliJValidatorOnWindows validator = IntelliJValidatorOnWindows(
title,
version,
installPath,
......@@ -158,7 +167,7 @@ class IntelliJValidatorOnLinuxAndWindows extends IntelliJValidator {
);
for (int index = 0; index < validators.length; index += 1) {
final DoctorValidator other = validators[index];
if (other is IntelliJValidatorOnLinuxAndWindows && validator.installPath == other.installPath) {
if (other is IntelliJValidatorOnWindows && validator.installPath == other.installPath) {
if (validator.version.compareTo(other.version) > 0) {
validators[index] = validator;
}
......@@ -168,6 +177,7 @@ class IntelliJValidatorOnLinuxAndWindows extends IntelliJValidator {
validators.add(validator);
}
// before IntelliJ 2019
final Directory homeDir = fileSystem.directory(fileSystemUtils.homeDirPath);
for (final Directory dir in homeDir.listSync().whereType<Directory>()) {
final String name = fileSystem.path.basename(dir.path);
......@@ -187,6 +197,152 @@ class IntelliJValidatorOnLinuxAndWindows extends IntelliJValidator {
}
});
}
// after IntelliJ 2020
final Directory cacheDir = fileSystem.directory(fileSystem.path.join(platform.environment['LOCALAPPDATA'], 'JetBrains'));
if (!cacheDir.existsSync()) {
return validators;
}
for (final Directory dir in cacheDir.listSync().whereType<Directory>()) {
final String name = fileSystem.path.basename(dir.path);
IntelliJValidator._idToTitle.forEach((String id, String title) {
if (name.startsWith(id)) {
final String version = name.substring(id.length);
String installPath;
try {
installPath = fileSystem.file(fileSystem.path.join(dir.path, '.home')).readAsStringSync();
} on FileSystemException {
// ignored
}
if (installPath != null && fileSystem.isDirectorySync(installPath)) {
String pluginsPath;
final String pluginsPathInAppData = fileSystem.path.join(
platform.environment['APPDATA'], 'JetBrains', name, 'plugins');
if (fileSystem.isDirectorySync(installPath + '.plugins')) {
// IntelliJ 2020.3
pluginsPath = installPath + '.plugins';
addValidator(title, version, installPath, pluginsPath);
} else if (fileSystem.isDirectorySync(pluginsPathInAppData)) {
// IntelliJ 2020.1 ~ 2020.2
pluginsPath = pluginsPathInAppData;
addValidator(title, version, installPath, pluginsPath);
}
}
}
});
}
return validators;
}
}
/// A linux specific implementation of the intellij validator.
class IntelliJValidatorOnLinux extends IntelliJValidator {
IntelliJValidatorOnLinux(String title, this.version, String installPath, this.pluginsPath, {
@required FileSystem fileSystem,
@required UserMessages userMessages,
}) : super(title, installPath, fileSystem: fileSystem, userMessages: userMessages);
@override
final String version;
@override
final String pluginsPath;
static Iterable<DoctorValidator> installed({
@required FileSystem fileSystem,
@required FileSystemUtils fileSystemUtils,
@required UserMessages userMessages,
}) {
final List<DoctorValidator> validators = <DoctorValidator>[];
if (fileSystemUtils.homeDirPath == null) {
return validators;
}
void addValidator(String title, String version, String installPath, String pluginsPath) {
final IntelliJValidatorOnLinux validator = IntelliJValidatorOnLinux(
title,
version,
installPath,
pluginsPath,
fileSystem: fileSystem,
userMessages: userMessages,
);
for (int index = 0; index < validators.length; index += 1) {
final DoctorValidator other = validators[index];
if (other is IntelliJValidatorOnLinux && validator.installPath == other.installPath) {
if (validator.version.compareTo(other.version) > 0) {
validators[index] = validator;
}
return;
}
}
validators.add(validator);
}
// before IntelliJ 2019
final Directory homeDir = fileSystem.directory(fileSystemUtils.homeDirPath);
for (final Directory dir in homeDir.listSync().whereType<Directory>()) {
final String name = fileSystem.path.basename(dir.path);
IntelliJValidator._idToTitle.forEach((String id, String title) {
if (name.startsWith('.$id')) {
final String version = name.substring(id.length + 1);
String installPath;
try {
installPath = fileSystem.file(fileSystem.path.join(dir.path, 'system', '.home')).readAsStringSync();
} on FileSystemException {
// ignored
}
if (installPath != null && fileSystem.isDirectorySync(installPath)) {
final String pluginsPath = fileSystem.path.join(dir.path, 'config', 'plugins');
addValidator(title, version, installPath, pluginsPath);
}
}
});
}
// after IntelliJ 2020 ~
final Directory cacheDir = fileSystem.directory(fileSystem.path.join(fileSystemUtils.homeDirPath, '.cache', 'JetBrains'));
if (!cacheDir.existsSync()) {
return validators;
}
for (final Directory dir in cacheDir.listSync().whereType<Directory>()) {
final String name = fileSystem.path.basename(dir.path);
IntelliJValidator._idToTitle.forEach((String id, String title) {
if (name.startsWith(id)) {
final String version = name.substring(id.length);
String installPath;
try {
installPath = fileSystem.file(fileSystem.path.join(dir.path, '.home')).readAsStringSync();
} on FileSystemException {
// ignored
}
if (installPath != null && fileSystem.isDirectorySync(installPath)) {
final String pluginsPathInUserHomeDir = fileSystem.path.join(
fileSystemUtils.homeDirPath,
'.local',
'share',
'JetBrains',
name);
if (installPath.contains(fileSystem.path.join('JetBrains','Toolbox','apps'))) {
// via JetBrains ToolBox app
final String pluginsPathInInstallDir = installPath + '.plugins';
if (fileSystem.isDirectorySync(pluginsPathInUserHomeDir)) {
// after 2020.2.x
final String pluginsPath = pluginsPathInUserHomeDir;
addValidator(title, version, installPath, pluginsPath);
} else if (fileSystem.isDirectorySync(pluginsPathInInstallDir)) {
// only 2020.1.X
final String pluginsPath = pluginsPathInInstallDir;
addValidator(title, version, installPath, pluginsPath);
}
} else {
// via tar.gz
final String pluginsPath = pluginsPathInUserHomeDir;
addValidator(title, version, installPath, pluginsPath);
}
}
}
});
}
return validators;
}
}
......
......@@ -20,23 +20,27 @@ final Platform macPlatform = FakePlatform(
operatingSystem: 'macos',
environment: <String, String>{'HOME': '/foo/bar'}
);
final Platform linuxPlatform = FakePlatform(
operatingSystem: 'linux',
environment: <String, String>{
'HOME': '/foo/bar'
},
);
final Platform windowsPlatform = FakePlatform(
operatingSystem: 'windows',
environment: <String, String>{
'USERPROFILE': 'C:\\Users\\foo',
'APPDATA': 'C:\\Users\\foo\\AppData\\Roaming',
'LOCALAPPDATA': 'C:\\Users\\foo\\AppData\\Local'
},
);
void main() {
testWithoutContext('Intellij validator can parse plugin manifest from plugin JAR', () async {
final FileSystem fileSystem = MemoryFileSystem.test();
// Create plugin JAR file for Flutter and Dart plugin.
final List<int> flutterPluginBytes = utf8.encode(kIntellijFlutterPluginXml);
final Archive flutterPlugins = Archive();
flutterPlugins.addFile(ArchiveFile('META-INF/plugin.xml', flutterPluginBytes.length, flutterPluginBytes));
fileSystem.file('plugins/flutter-intellij.jar')
..createSync(recursive: true)
..writeAsBytesSync(ZipEncoder().encode(flutterPlugins));
final List<int> dartPluginBytes = utf8.encode(kIntellijDartPluginXml);
final Archive dartPlugins = Archive();
dartPlugins.addFile(ArchiveFile('META-INF/plugin.xml', dartPluginBytes.length, dartPluginBytes));
fileSystem.file('plugins/Dart/lib/Dart.jar')
..createSync(recursive: true)
..writeAsBytesSync(ZipEncoder().encode(dartPlugins));
createIntellijFlutterPluginJar('plugins/flutter-intellij.jar', fileSystem);
createIntellijDartPluginJar('plugins/Dart/lib/Dart.jar', fileSystem);
final ValidationResult result = await IntelliJValidatorTestTarget('', 'path/to/intellij', fileSystem).validate();
expect(result.type, ValidationType.partial);
......@@ -50,6 +54,222 @@ void main() {
]);
});
testWithoutContext('legacy intellij(<2020) plugins check on linux', () async {
const String cachePath = '/foo/bar/.IntelliJIdea2019.10/system';
const String installPath = '/foo/bar/.local/share/JetBrains/Toolbox/apps/IDEA-U/ch-1/2019.10.1';
const String pluginPath = '/foo/bar/.IntelliJIdea2019.10/config/plugins';
final FileSystem fileSystem = MemoryFileSystem.test();
final Directory cacheDirectory = fileSystem.directory(cachePath)
..createSync(recursive: true);
cacheDirectory
.childFile('.home')
.writeAsStringSync(installPath, flush: true);
final Directory installedDirectory = fileSystem.directory(installPath);
installedDirectory.createSync(recursive: true);
// Create plugin JAR file for Flutter and Dart plugin.
createIntellijFlutterPluginJar(pluginPath + '/flutter-intellij/lib/flutter-intellij.jar', fileSystem, version: '50.0');
createIntellijDartPluginJar(pluginPath + '/Dart/lib/Dart.jar', fileSystem);
final Iterable<DoctorValidator> installed = IntelliJValidatorOnLinux.installed(
fileSystem: fileSystem,
fileSystemUtils: FileSystemUtils(fileSystem: fileSystem, platform: linuxPlatform),
userMessages: UserMessages(),
);
expect(1, installed.length);
final ValidationResult result = await installed.toList()[0].validate();
expect(ValidationType.installed, result.type);
});
testWithoutContext('intellij(2020.1) plugins check on linux (installed via JetBrains ToolBox app)', () async {
const String cachePath = '/foo/bar/.cache/JetBrains/IntelliJIdea2020.10';
const String installPath = '/foo/bar/.local/share/JetBrains/Toolbox/apps/IDEA-U/ch-1/2020.10.1';
const String pluginPath = '/foo/bar/.local/share/JetBrains/Toolbox/apps/IDEA-U/ch-1/2020.10.1.plugins';
final FileSystem fileSystem = MemoryFileSystem.test();
final Directory cacheDirectory = fileSystem.directory(cachePath)
..createSync(recursive: true);
cacheDirectory
.childFile('.home')
.writeAsStringSync(installPath, flush: true);
final Directory installedDirectory = fileSystem.directory(installPath);
installedDirectory.createSync(recursive: true);
// Create plugin JAR file for Flutter and Dart plugin.
createIntellijFlutterPluginJar(pluginPath + '/flutter-intellij/lib/flutter-intellij.jar', fileSystem, version: '50.0');
createIntellijDartPluginJar(pluginPath + '/Dart/lib/Dart.jar', fileSystem);
final Iterable<DoctorValidator> installed = IntelliJValidatorOnLinux.installed(
fileSystem: fileSystem,
fileSystemUtils: FileSystemUtils(fileSystem: fileSystem, platform: linuxPlatform),
userMessages: UserMessages(),
);
expect(1, installed.length);
final ValidationResult result = await installed.toList()[0].validate();
expect(ValidationType.installed, result.type);
});
testWithoutContext('intellij(>=2020.2) plugins check on linux (installed via JetBrains ToolBox app)', () async {
const String cachePath = '/foo/bar/.cache/JetBrains/IntelliJIdea2020.10';
const String installPath = '/foo/bar/.local/share/JetBrains/Toolbox/apps/IDEA-U/ch-1/2020.10.1';
const String pluginPath = '/foo/bar/.local/share/JetBrains/IntelliJIdea2020.10';
final FileSystem fileSystem = MemoryFileSystem.test();
final Directory cacheDirectory = fileSystem.directory(cachePath)
..createSync(recursive: true);
cacheDirectory
.childFile('.home')
.writeAsStringSync(installPath, flush: true);
final Directory installedDirectory = fileSystem.directory(installPath);
installedDirectory.createSync(recursive: true);
// Create plugin JAR file for Flutter and Dart plugin.
createIntellijFlutterPluginJar(pluginPath + '/flutter-intellij/lib/flutter-intellij.jar', fileSystem, version: '50.0');
createIntellijDartPluginJar(pluginPath + '/Dart/lib/Dart.jar', fileSystem);
final Iterable<DoctorValidator> installed = IntelliJValidatorOnLinux.installed(
fileSystem: fileSystem,
fileSystemUtils: FileSystemUtils(fileSystem: fileSystem, platform: linuxPlatform),
userMessages: UserMessages(),
);
expect(1, installed.length);
final ValidationResult result = await installed.toList()[0].validate();
expect(ValidationType.installed, result.type);
});
testWithoutContext('intellij(2020.1~) plugins check on linux (installed via tar.gz)', () async {
const String cachePath = '/foo/bar/.cache/JetBrains/IdeaIC2020.10';
const String installPath = '/foo/bar/some/dir/ideaIC-2020.10.1/idea-IC-201.0000.00';
const String pluginPath = '/foo/bar/.local/share/JetBrains/IdeaIC2020.10';
final FileSystem fileSystem = MemoryFileSystem.test();
final Directory cacheDirectory = fileSystem.directory(cachePath)
..createSync(recursive: true);
cacheDirectory
.childFile('.home')
.writeAsStringSync(installPath, flush: true);
final Directory installedDirectory = fileSystem.directory(installPath);
installedDirectory.createSync(recursive: true);
// Create plugin JAR file for Flutter and Dart plugin.
createIntellijFlutterPluginJar(pluginPath + '/flutter-intellij/lib/flutter-intellij.jar', fileSystem, version: '50.0');
createIntellijDartPluginJar(pluginPath + '/Dart/lib/Dart.jar', fileSystem);
final Iterable<DoctorValidator> installed = IntelliJValidatorOnLinux.installed(
fileSystem: fileSystem,
fileSystemUtils: FileSystemUtils(fileSystem: fileSystem, platform: linuxPlatform),
userMessages: UserMessages(),
);
expect(1, installed.length);
final ValidationResult result = await installed.toList()[0].validate();
expect(ValidationType.installed, result.type);
});
testWithoutContext('legacy intellij(<2020) plugins check on windows', () async {
const String cachePath = 'C:\\Users\\foo\\.IntelliJIdea2019.10\\system';
const String installPath = 'C:\\Program Files\\JetBrains\\IntelliJ IDEA Ultimate Edition 2019.10.1';
const String pluginPath = 'C:\\Users\\foo\\.IntelliJIdea2019.10\\config\\plugins';
final FileSystem fileSystem = MemoryFileSystem.test(style: FileSystemStyle.windows);
final Directory cacheDirectory = fileSystem.directory(cachePath)
..createSync(recursive: true);
cacheDirectory
.childFile('.home')
.writeAsStringSync(installPath, flush: true);
final Directory installedDirectory = fileSystem.directory(installPath);
installedDirectory.createSync(recursive: true);
createIntellijFlutterPluginJar(pluginPath + '/flutter-intellij/lib/flutter-intellij.jar', fileSystem, version: '50.0');
createIntellijDartPluginJar(pluginPath + '/Dart/lib/Dart.jar', fileSystem);
final Iterable<DoctorValidator> installed = IntelliJValidatorOnWindows.installed(
fileSystem: fileSystem,
fileSystemUtils: FileSystemUtils(fileSystem: fileSystem, platform: windowsPlatform),
platform: windowsPlatform,
userMessages: UserMessages(),
);
expect(1, installed.length);
final ValidationResult result = await installed.toList()[0].validate();
expect(ValidationType.installed, result.type);
});
testWithoutContext('intellij(2020.1 ~ 2020.2) plugins check on windows (installed via JetBrains ToolBox app)', () async {
const String cachePath = 'C:\\Users\\foo\\AppData\\Local\\JetBrains\\IntelliJIdea2020.10';
const String installPath = 'C:\\Users\\foo\\AppData\\Local\\JetBrains\\Toolbox\\apps\\IDEA-U\\ch-0\\201.0000.00';
const String pluginPath = 'C:\\Users\\foo\\AppData\\Roaming\\JetBrains\\IntelliJIdea2020.10\\plugins';
final FileSystem fileSystem = MemoryFileSystem.test(style: FileSystemStyle.windows);
final Directory cacheDirectory = fileSystem.directory(cachePath)
..createSync(recursive: true);
cacheDirectory
.childFile('.home')
.writeAsStringSync(installPath, flush: true);
final Directory installedDirectory = fileSystem.directory(installPath);
installedDirectory.createSync(recursive: true);
createIntellijFlutterPluginJar(pluginPath + '\\flutter-intellij\\lib\\flutter-intellij.jar', fileSystem, version: '50.0');
createIntellijDartPluginJar(pluginPath + '\\Dart\\lib\\Dart.jar', fileSystem);
final Iterable<DoctorValidator> installed = IntelliJValidatorOnWindows.installed(
fileSystem: fileSystem,
fileSystemUtils: FileSystemUtils(fileSystem: fileSystem, platform: windowsPlatform),
platform: windowsPlatform,
userMessages: UserMessages(),
);
expect(1, installed.length);
final ValidationResult result = await installed.toList()[0].validate();
expect(ValidationType.installed, result.type);
});
testWithoutContext('intellij(>=2020.3) plugins check on windows (installed via JetBrains ToolBox app and plugins)', () async {
const String cachePath = 'C:\\Users\\foo\\AppData\\Local\\JetBrains\\IntelliJIdea2020.10';
const String installPath = 'C:\\Users\\foo\\AppData\\Local\\JetBrains\\Toolbox\\apps\\IDEA-U\\ch-0\\201.0000.00';
const String pluginPath = 'C:\\Users\\foo\\AppData\\Local\\JetBrains\\Toolbox\\apps\\IDEA-U\\ch-0\\201.0000.00.plugins';
final FileSystem fileSystem = MemoryFileSystem.test(style: FileSystemStyle.windows);
final Directory cacheDirectory = fileSystem.directory(cachePath)
..createSync(recursive: true);
cacheDirectory
.childFile('.home')
.writeAsStringSync(installPath, flush: true);
final Directory installedDirectory = fileSystem.directory(installPath);
installedDirectory.createSync(recursive: true);
createIntellijFlutterPluginJar(pluginPath + '\\flutter-intellij\\lib\\flutter-intellij.jar', fileSystem, version: '50.0');
createIntellijDartPluginJar(pluginPath + '\\Dart\\lib\\Dart.jar', fileSystem);
final Iterable<DoctorValidator> installed = IntelliJValidatorOnWindows.installed(
fileSystem: fileSystem,
fileSystemUtils: FileSystemUtils(fileSystem: fileSystem, platform: windowsPlatform),
platform: windowsPlatform,
userMessages: UserMessages(),
);
expect(1, installed.length);
final ValidationResult result = await installed.toList()[0].validate();
expect(ValidationType.installed, result.type);
});
testWithoutContext('intellij(2020.1~) plugins check on windows (installed via installer)', () async {
const String cachePath = 'C:\\Users\\foo\\AppData\\Local\\JetBrains\\IdeaIC2020.10';
const String installPath = 'C:\\Program Files\\JetBrains\\IntelliJ IDEA Community Edition 2020.10.1';
const String pluginPath = 'C:\\Users\\foo\\AppData\\Roaming\\JetBrains\\IdeaIC2020.10\\plugins';
final FileSystem fileSystem = MemoryFileSystem.test(style: FileSystemStyle.windows);
final Directory cacheDirectory = fileSystem.directory(cachePath)
..createSync(recursive: true);
cacheDirectory
.childFile('.home')
.writeAsStringSync(installPath, flush: true);
final Directory installedDirectory = fileSystem.directory(installPath);
installedDirectory.createSync(recursive: true);
createIntellijFlutterPluginJar(pluginPath + '\\flutter-intellij\\lib\\flutter-intellij.jar', fileSystem, version: '50.0');
createIntellijDartPluginJar(pluginPath + '\\Dart\\lib\\Dart.jar', fileSystem);
final Iterable<DoctorValidator> installed = IntelliJValidatorOnWindows.installed(
fileSystem: fileSystem,
fileSystemUtils: FileSystemUtils(fileSystem: fileSystem, platform: windowsPlatform),
platform: windowsPlatform,
userMessages: UserMessages(),
);
expect(1, installed.length);
final ValidationResult result = await installed.toList()[0].validate();
expect(ValidationType.installed, result.type);
});
testWithoutContext('Intellij plugins path checking on mac', () async {
final FileSystem fileSystem = MemoryFileSystem.test();
final Directory pluginsDirectory = fileSystem.directory('/foo/bar/Library/Application Support/JetBrains/TestID2020.10/plugins')
......@@ -127,16 +347,18 @@ class IntelliJValidatorTestTarget extends IntelliJValidator {
String get version => 'test.test.test';
}
/// A helper to create a Intellij Flutter plugin jar.
///
/// These file contents were derived from the META-INF/plugin.xml from an Intellij Flutter
/// plugin installation.
///
/// The file is loacted in a plugin JAR, which can be located by looking at the plugin
/// The file is located in a plugin JAR, which can be located by looking at the plugin
/// path for the Intellij and Android Studio validators.
///
/// If more XML contents are needed, prefer modifying these contents over checking
/// in another JAR.
const String kIntellijFlutterPluginXml = r'''
void createIntellijFlutterPluginJar(String pluginJarPath, FileSystem fileSystem, {String version = '0.1.3'}) {
final String intellijFlutterPluginXml = '''
<idea-plugin version="2">
<id>io.flutter</id>
<name>Flutter</name>
......@@ -145,35 +367,34 @@ const String kIntellijFlutterPluginXml = r'''
<category>Custom Languages</category>
<version>0.1.3</version>
<version>$version</version>
<idea-version since-build="162.1" until-build="163.*"/>
</idea-plugin>
''';
<idea-plugin version="2">
<name>Dart</name>
<version>162.2485</version>
<idea-version since-build="162.1121" until-build="162.*"/>
final List<int> flutterPluginBytes = utf8.encode(intellijFlutterPluginXml);
final Archive flutterPlugins = Archive();
flutterPlugins.addFile(ArchiveFile('META-INF/plugin.xml', flutterPluginBytes.length, flutterPluginBytes));
fileSystem.file(pluginJarPath)
..createSync(recursive: true)
..writeAsBytesSync(ZipEncoder().encode(flutterPlugins));
<description>Support for Dart programming language</description>
<vendor>JetBrains</vendor>
<depends>com.intellij.modules.xml</depends>
<depends optional="true" config-file="dartium-debugger-support.xml">JavaScriptDebugger</depends>
<depends optional="true" config-file="dart-yaml.xml">org.jetbrains.plugins.yaml</depends>
<depends optional="true" config-file="dart-copyright.xml">com.intellij.copyright</depends>
<depends optional="true" config-file="dart-coverage.xml">com.intellij.modules.coverage</depends>
</idea-plugin>
''';
}
/// These file contents were derived from the META-INF/plugin.xml from an Intellij Dart
/// A helper to create a Intellij Dart plugin jar.
///
/// This jar contains META-INF/plugin.xml.
/// Its contents were derived from the META-INF/plugin.xml from an Intellij Dart
/// plugin installation.
///
/// The file is loacted in a plugin JAR, which can be located by looking at the plugin
/// The file is located in a plugin JAR, which can be located by looking at the plugin
/// path for the Intellij and Android Studio validators.
///
/// If more XML contents are needed, prefer modifying these contents over checking
/// in another JAR.
const String kIntellijDartPluginXml = r'''
void createIntellijDartPluginJar(String pluginJarPath, FileSystem fileSystem) {
const String intellijDartPluginXml = r'''
<idea-plugin version="2">
<name>Dart</name>
<version>162.2485</version>
......@@ -188,3 +409,11 @@ const String kIntellijDartPluginXml = r'''
<depends optional="true" config-file="dart-coverage.xml">com.intellij.modules.coverage</depends>
</idea-plugin>
''';
final List<int> dartPluginBytes = utf8.encode(intellijDartPluginXml);
final Archive dartPlugins = Archive();
dartPlugins.addFile(ArchiveFile('META-INF/plugin.xml', dartPluginBytes.length, dartPluginBytes));
fileSystem.file(pluginJarPath)
..createSync(recursive: true)
..writeAsBytesSync(ZipEncoder().encode(dartPlugins));
}
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