[devkit] IJPL-209914 support 'required-if-available' attribute syntax

(cherry picked from commit e0930eb490d772a9e003b2b01acc07f6b4199ec3)

GitOrigin-RevId: e5c494bde8133730e4fee38e339a63cfd93e0208
This commit is contained in:
Vadim Salavatov
2025-10-20 11:56:40 +00:00
committed by intellij-monorepo-bot
parent 1ce6325cdc
commit 09c433e16b
5 changed files with 33 additions and 1 deletions
@@ -623,6 +623,18 @@ elements:
**This option isn't implemented yet and currently behaves the same way as `optional`.**
defaultValue: |
`optional`
- attribute:
name: required-if-available
description: |
**Experimental attribute**
Specifies a condition when the loading rule should be restricted to 'required' instead of the rule given by the 'loading' attribute.
The value of the attribute may reference one of the special content modules that reflect the configuration of the IDE:
- `intellij.platform.frontend`
- `intellij.platform.backend`
- `intellij.platform.frontend.split`
[Internal doc](https://youtrack.jetbrains.com/articles/IJPL-A-1503).
- element:
name: extensions
references:
@@ -44,7 +44,7 @@
<dom.fileMetaData implementation="org.jetbrains.idea.devkit.dom.impl.PluginDescriptorDomFileDescription"
rootTagName="idea-plugin"
stubVersion="22"/>
stubVersion="23"/>
<dom.extender domClass="org.jetbrains.idea.devkit.dom.Extensions"
extenderClass="org.jetbrains.idea.devkit.dom.impl.ExtensionsDomExtender"/>
<dom.extender domClass="org.jetbrains.idea.devkit.dom.Action"
@@ -33,6 +33,10 @@ public interface ContentDescriptor extends DomElement {
@NotNull
@Stubbed
GenericAttributeValue<ModuleLoadingRule> getLoading();
@NotNull
@Stubbed
GenericAttributeValue<String> getRequiredIfAvailable();
enum ModuleLoadingRule implements NamedEnum {
REQUIRED("required"), EMBEDDED("embedded"), OPTIONAL("optional"), ON_DEMAND("on-demand");
@@ -12,6 +12,10 @@
<content>
<module name="module.name"/>
<module name="optional.module" loading="optional"/>
<module name="required.module" loading="required"/>
<module name="ondemand.module" loading="on-demand"/>
<module name="required.in.frontend" required-if-available="intellij.platform.frontend"/>
</content>
<dependencies>
@@ -46,6 +46,18 @@ public class PluginXmlDomStubsTest extends DomStubTest {
Element:content
Element:module
Attribute:name:module.name
Element:module
Attribute:name:optional.module
Attribute:loading:optional
Element:module
Attribute:name:required.module
Attribute:loading:required
Element:module
Attribute:name:ondemand.module
Attribute:loading:on-demand
Element:module
Attribute:name:required.in.frontend
Attribute:required-if-available:intellij.platform.frontend
Element:dependencies
Element:module
Attribute:name:dependencies.module