IDEA-274173 plugin.xml cannot have both dependencies and depends tags

GitOrigin-RevId: a8f6254b7b9a3dadede071524b3196500940239a
This commit is contained in:
Yann Cébron
2021-07-22 15:04:38 +00:00
committed by intellij-monorepo-bot
parent dc870efda5
commit 571fe56662
4 changed files with 18 additions and 0 deletions
@@ -257,6 +257,7 @@ inspections.plugin.xml.module.descriptor.package.does.not.match=Package ''{0}''
inspections.plugin.xml.module.descriptor.at.least.one.dependency=At least one <module> entry must be defined
inspections.plugin.xml.dependency.descriptor.at.least.one.dependency=At least one <module> or <plugin> dependency must be defined
inspections.plugin.xml.dependency.class.located.in.wrong.package=Class ''{0}'' must be located in package ''{1}''
inspections.plugin.xml.dependency.descriptor.cannot.use.depends=Cannot use <depends> in addition to <dependencies>
inspections.registration.problems.name=Component type mismatch
inspections.registration.problems.option.check.plugin.xml=Check Plugin Descriptor (plugin.xml)
@@ -253,6 +253,16 @@ public final class PluginXmlDomInspection extends DevKitPluginXmlInspectionBase
descriptor.getPlugin().isEmpty()) {
holder.createProblem(descriptor, HighlightSeverity.ERROR,
DevKitBundle.message("inspections.plugin.xml.dependency.descriptor.at.least.one.dependency"));
return;
}
final IdeaPlugin ideaPlugin = descriptor.getParentOfType(IdeaPlugin.class, false);
assert ideaPlugin != null;
for (Dependency dependency : ideaPlugin.getDepends()) {
if (dependency.getOptional().getValue() == Boolean.TRUE) continue;
highlightRedundant(dependency,
DevKitBundle.message("inspections.plugin.xml.dependency.descriptor.cannot.use.depends"),
ProblemHighlightType.GENERIC_ERROR, holder);
}
}
@@ -31,4 +31,10 @@
</extensions>
<!-- cannot mix with non-optional -->
<error descr="Cannot use <depends> in addition to <dependencies>"><depends config-file="ExtensionsDependencies-plugin.xml">com.intellij.myPlugin</depends></error>
<depends config-file="dummy-descriptor.xml" optional="true">com.intellij.myPlugin</depends>
</idea-plugin>
@@ -205,6 +205,7 @@ class PluginXmlFunctionalTest extends JavaCodeInsightFixtureTestCase {
myFixture.copyFileToProject("ExtensionsDependencies-content.subDescriptor.xml",
"/ExtensionsDependencies-content/ExtensionsDependencies-content.subDescriptor.xml")
myFixture.addFileToProject("dummy-descriptor.xml","<idea-plugin></idea-plugin>")
doHighlightingTest("ExtensionsDependencies.xml",
"ExtensionsDependencies-plugin.xml")