[modular loader] change the name and values of the 'importance' attribute in product-modules.xml file for consistency (IJPL-128)

Now 'loading' attribute is supported for content modules in plugin.xml (see IJPL-148565), and since it has the same meaning as the 'importance' attribute in product-modules.xml files, it's better to rename 'importance' to 'loading' and change its values accordingly to avoid confusion.

GitOrigin-RevId: fa737ffc8da628560e45fdef2b97dffdcebfa3b4
This commit is contained in:
Nikolay Chashnikov
2024-09-06 16:42:08 +02:00
committed by intellij-monorepo-bot
parent e9e283d574
commit e2136051b3
3 changed files with 10 additions and 15 deletions

View File

@@ -41,14 +41,14 @@ public final class ProductModulesXmlSerializer {
if (tagName.equals("module")) {
if (reader.getAttributeCount() > 0) {
String attributeName = reader.getAttributeLocalName(0);
if (!"importance".equals(attributeName)) {
if (!"loading".equals(attributeName)) {
throw new XMLStreamException("Unexpected attribute '" + attributeName + "'");
}
String loadingRuleString = reader.getAttributeValue(0);
switch (loadingRuleString) {
case "optional": loadingRule = RuntimeModuleLoadingRule.OPTIONAL; break;
case "functional": loadingRule = RuntimeModuleLoadingRule.REQUIRED; break;
case "service": loadingRule = RuntimeModuleLoadingRule.ON_DEMAND; break;
case "required": loadingRule = RuntimeModuleLoadingRule.REQUIRED; break;
case "on-demand": loadingRule = RuntimeModuleLoadingRule.ON_DEMAND; break;
default: throw new XMLStreamException("Unknown loading rule '" + loadingRuleString + "'");
}
}

View File

@@ -57,9 +57,9 @@ class ProductModulesLoaderTest {
xml(FILE_NAME, """
<product-modules>
<main-root-modules>
<module importance="functional">root</module>
<module importance="optional">optional</module>
<module importance="optional">unknown-optional</module>
<module loading="required">root</module>
<module loading="optional">optional</module>
<module loading="optional">unknown-optional</module>
</main-root-modules>
</product-modules>
""".trimIndent())
@@ -148,7 +148,7 @@ class ProductModulesLoaderTest {
<from-module>root</from-module>
</include>
<main-root-modules>
<module importance="functional">additional</module>
<module loading="required">additional</module>
</main-root-modules>
<bundled-plugins>
<module>plugin</module>
@@ -217,7 +217,7 @@ class ProductModulesLoaderTest {
<product-modules>
<main-root-modules>
${mainModules.joinToString("\n") {
"<module importance=\"functional\">$it</module>"
"<module loading=\"required\">$it</module>"
}}
</main-root-modules>
<bundled-plugins>

View File

@@ -4,6 +4,7 @@ package org.jetbrains.idea.devkit.dom.productModules;
import com.intellij.util.xml.*;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.idea.devkit.dom.ContentDescriptor;
import org.jetbrains.idea.devkit.dom.impl.productModules.IntellijModuleConverter;
import org.jetbrains.idea.devkit.dom.impl.productModules.PluginXmlFileConverter;
import org.jetbrains.idea.devkit.dom.impl.productModules.ProductModulesXmlFileConverter;
@@ -40,7 +41,7 @@ public interface ProductModulesElement extends DomElement {
@Convert(IntellijModuleConverter.class)
interface MainRootModuleElement extends GenericDomValue<IntellijModuleSymbol> {
@Required
@NotNull GenericAttributeValue<ModuleImportanceAttributeValue> getImportance();
@NotNull GenericAttributeValue<ContentDescriptor.ModuleDescriptor.ModuleLoadingRule> getLoading();
}
interface BundledPluginElements extends DomElement {
@@ -51,10 +52,4 @@ public interface ProductModulesElement extends DomElement {
@Convert(PluginXmlFileConverter.class)
interface BundledPluginElement extends GenericDomValue<IntellijModuleSymbol> {
}
enum ModuleImportanceAttributeValue {
functional,
optional,
service
}
}