mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
prefer loading a plugin from property over classpath
External plugin developers often use `plugin.path` property to load their plugin in tests, however to run actual tests with external build tools a classpath entry pointing to the compiled classes of the plugin is usually passed as well. For some plugins with a complex artifact, a valid structure is required to properly load, which is provided by the plugin dist passed with `plugin.path`. When plugin loader overrides it with the one from classpath, the plugin is loaded but from an incomplete artifact making it fail in cases such as starting JPS. GitOrigin-RevId: 64d6fc1760bcc88301c53062f894d60246bfc008
This commit is contained in:
committed by
intellij-monorepo-bot
parent
68d1930b8f
commit
21dbcdb8b9
@@ -8,6 +8,7 @@ import com.intellij.util.containers.ContainerUtil;
|
||||
import com.intellij.util.containers.ContainerUtilRt;
|
||||
import com.intellij.util.text.VersionComparatorUtil;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jetbrains.annotations.Contract;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@@ -166,6 +167,12 @@ final class PluginLoadingResult {
|
||||
}
|
||||
}
|
||||
|
||||
@Contract(pure = true)
|
||||
boolean contains(@NotNull IdeaPluginDescriptorImpl descriptor) {
|
||||
PluginId pluginId = descriptor.getPluginId();
|
||||
return (pluginId != null && plugins.containsKey(pluginId));
|
||||
}
|
||||
|
||||
private boolean isCompatible(@NotNull IdeaPluginDescriptorImpl descriptor) {
|
||||
return PluginManagerCore.isIncompatible(productBuildNumber, descriptor.getSinceBuild(), descriptor.getUntilBuild()) == null;
|
||||
}
|
||||
|
||||
@@ -1163,7 +1163,8 @@ public final class PluginManagerCore {
|
||||
PluginLoadingResult result = context.parentContext.result;
|
||||
for (Future<IdeaPluginDescriptorImpl> task : tasks) {
|
||||
IdeaPluginDescriptorImpl descriptor = task.get();
|
||||
if (descriptor != null) {
|
||||
// plugins added via property shouldn't be overridden to avoid plugin root detection issues when running external plugin tests
|
||||
if (descriptor != null && !result.contains(descriptor)) {
|
||||
descriptor.setUseCoreClassLoader();
|
||||
result.add(descriptor, context.parentContext);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user