From 366d2f2ea3a31f54c285d1ecce1b6ec745ab5301 Mon Sep 17 00:00:00 2001 From: Nikolay Chashnikov Date: Fri, 5 Jul 2024 10:24:19 +0200 Subject: [PATCH] [platform] refactoring: rename ProductMode.LOCAL_IDE to MONOLITH for consistency (RDCT-1417) GitOrigin-RevId: 145088995b32517ae536e626d8d54dfb31a25331 --- .../bootstrap/ModuleBasedProductLoadingStrategy.kt | 2 +- .../src/org/jetbrains/intellij/build/ProductProperties.kt | 2 +- .../ide/plugins/PathBasedProductLoadingStrategy.kt | 2 +- platform/runtime/product/api-dump.txt | 2 +- platform/runtime/product/src/ProductMode.java | 2 +- platform/runtime/product/src/impl/ProductModes.java | 2 +- .../testSrc/serialization/ProductModulesLoaderTest.kt | 8 ++++---- .../internal/statistic/eventLog/StatisticsEventLogger.kt | 2 +- tools/devLauncher/src/IntellijDevLauncher.kt | 2 +- 9 files changed, 12 insertions(+), 12 deletions(-) diff --git a/platform/bootstrap/src/com/intellij/platform/bootstrap/ModuleBasedProductLoadingStrategy.kt b/platform/bootstrap/src/com/intellij/platform/bootstrap/ModuleBasedProductLoadingStrategy.kt index 66f036ddbb0f..c1db5104c8ba 100644 --- a/platform/bootstrap/src/com/intellij/platform/bootstrap/ModuleBasedProductLoadingStrategy.kt +++ b/platform/bootstrap/src/com/intellij/platform/bootstrap/ModuleBasedProductLoadingStrategy.kt @@ -32,7 +32,7 @@ import kotlin.io.path.extension internal class ModuleBasedProductLoadingStrategy(internal val moduleRepository: RuntimeModuleRepository) : ProductLoadingStrategy() { private val currentMode by lazy { - val currentModeId = System.getProperty(PLATFORM_PRODUCT_MODE_PROPERTY, ProductMode.LOCAL_IDE.id) + val currentModeId = System.getProperty(PLATFORM_PRODUCT_MODE_PROPERTY, ProductMode.MONOLITH.id) val currentMode = ProductMode.entries.find { it.id == currentModeId } if (currentMode == null) { error("Unknown mode '$currentModeId' specified in '$PLATFORM_PRODUCT_MODE_PROPERTY' system property") diff --git a/platform/build-scripts/src/org/jetbrains/intellij/build/ProductProperties.kt b/platform/build-scripts/src/org/jetbrains/intellij/build/ProductProperties.kt index b2ed1b076562..066aadc08013 100644 --- a/platform/build-scripts/src/org/jetbrains/intellij/build/ProductProperties.kt +++ b/platform/build-scripts/src/org/jetbrains/intellij/build/ProductProperties.kt @@ -213,7 +213,7 @@ abstract class ProductProperties { * This property makes sense only if [rootModuleForModularLoader] is set to a non-null value. */ @ApiStatus.Experimental - var productMode: ProductMode = ProductMode.LOCAL_IDE + var productMode: ProductMode = ProductMode.MONOLITH /** * Specifies name of cross-platform ZIP archive if `[buildCrossPlatformDistribution]` is set to `true`. diff --git a/platform/core-impl/src/com/intellij/ide/plugins/PathBasedProductLoadingStrategy.kt b/platform/core-impl/src/com/intellij/ide/plugins/PathBasedProductLoadingStrategy.kt index add1f17d4555..c067393209cb 100644 --- a/platform/core-impl/src/com/intellij/ide/plugins/PathBasedProductLoadingStrategy.kt +++ b/platform/core-impl/src/com/intellij/ide/plugins/PathBasedProductLoadingStrategy.kt @@ -10,7 +10,7 @@ import java.nio.file.Path internal class PathBasedProductLoadingStrategy : ProductLoadingStrategy() { // this property returns hardcoded Strings instead of ProductMode, because currently ProductMode class isn't available in dependencies of this module override val currentModeId: String - get() = if (AppMode.isRemoteDevHost()) "backend" else "local_IDE" + get() = if (AppMode.isRemoteDevHost()) "backend" else "monolith" override fun addMainModuleGroupToClassPath(bootstrapClassLoader: ClassLoader) { } diff --git a/platform/runtime/product/api-dump.txt b/platform/runtime/product/api-dump.txt index b3078aa7b9d2..081543e50060 100644 --- a/platform/runtime/product/api-dump.txt +++ b/platform/runtime/product/api-dump.txt @@ -15,7 +15,7 @@ - java.lang.Enum - sf:BACKEND:com.intellij.platform.runtime.product.ProductMode - sf:FRONTEND:com.intellij.platform.runtime.product.ProductMode -- sf:LOCAL_IDE:com.intellij.platform.runtime.product.ProductMode +- sf:MONOLITH:com.intellij.platform.runtime.product.ProductMode - getId():java.lang.String - s:valueOf(java.lang.String):com.intellij.platform.runtime.product.ProductMode - s:values():com.intellij.platform.runtime.product.ProductMode[] diff --git a/platform/runtime/product/src/ProductMode.java b/platform/runtime/product/src/ProductMode.java index 4a77bf6f4455..249938a104f4 100644 --- a/platform/runtime/product/src/ProductMode.java +++ b/platform/runtime/product/src/ProductMode.java @@ -12,7 +12,7 @@ public enum ProductMode { /** * Indicates that this process performs all necessary tasks to provide smart features itself. This is the default mode for all IDEs. */ - LOCAL_IDE("local_IDE"), + MONOLITH("monolith"), /** * Indicates that this process doesn't perform heavy tasks like code analysis, and takes necessary information from another process. * Currently, this is used by JetBrains Client process connected to a remote development host or CodeWithMe session. diff --git a/platform/runtime/product/src/impl/ProductModes.java b/platform/runtime/product/src/impl/ProductModes.java index 2d296b9f5da9..5b918adaffc6 100644 --- a/platform/runtime/product/src/impl/ProductModes.java +++ b/platform/runtime/product/src/impl/ProductModes.java @@ -22,7 +22,7 @@ final class ProductModes { case FRONTEND: return RuntimeModuleId.module("intellij.platform.monolith"); //this module doesn't exist yet, it will be added when we need to use it - case LOCAL_IDE: return RuntimeModuleId.module("intellij.platform.frontend"); + case MONOLITH: return RuntimeModuleId.module("intellij.platform.frontend"); //currently we use the same modules in 'backend' and 'localIde' modes, in the future we may disable some UI-only modules in 'backend' mode case BACKEND: return RuntimeModuleId.module("intellij.platform.frontend"); diff --git a/platform/runtime/product/tests/testSrc/serialization/ProductModulesLoaderTest.kt b/platform/runtime/product/tests/testSrc/serialization/ProductModulesLoaderTest.kt index b784bbcccdec..dd67fa10ef26 100644 --- a/platform/runtime/product/tests/testSrc/serialization/ProductModulesLoaderTest.kt +++ b/platform/runtime/product/tests/testSrc/serialization/ProductModulesLoaderTest.kt @@ -32,7 +32,7 @@ class ProductModulesLoaderTest { ) writePluginXmlWithModules(tempDirectory.rootPath / "plugin", "plugin") val xml = generateProductModulesWithPlugin() - val productModules = ProductModulesSerialization.loadProductModules(xml, ProductMode.LOCAL_IDE, repository) + val productModules = ProductModulesSerialization.loadProductModules(xml, ProductMode.MONOLITH, repository) val mainGroupModules = productModules.mainModuleGroup.includedModules.sortedBy { it.moduleDescriptor.moduleId.stringId } assertEquals(2, mainGroupModules.size) val (root, util) = mainGroupModules @@ -64,7 +64,7 @@ class ProductModulesLoaderTest { """.trimIndent()) }.generateInTempDir().resolve(FILE_NAME) - val productModules = ProductModulesSerialization.loadProductModules(xml, ProductMode.LOCAL_IDE, repository) + val productModules = ProductModulesSerialization.loadProductModules(xml, ProductMode.MONOLITH, repository) val mainGroupModules = productModules.mainModuleGroup.includedModules.sortedBy { it.moduleDescriptor.moduleId.stringId } assertEquals(2, mainGroupModules.size) val (optional, root) = mainGroupModules @@ -86,7 +86,7 @@ class ProductModulesLoaderTest { writePluginXmlWithModules(tempDirectory.rootPath / "plugin", "plugin", "optional", "unknown") val xml = generateProductModulesWithPlugin() - val productModules = ProductModulesSerialization.loadProductModules(xml, ProductMode.LOCAL_IDE, repository) + val productModules = ProductModulesSerialization.loadProductModules(xml, ProductMode.MONOLITH, repository) val pluginModuleGroup = productModules.bundledPluginModuleGroups.single() val pluginModules = pluginModuleGroup.includedModules assertEquals(2, pluginModules.size) @@ -123,7 +123,7 @@ class ProductModulesLoaderTest { assertEquals("plugin.common", common.moduleDescriptor.moduleId.stringId) assertEquals(additionalModuleName, additional.moduleDescriptor.moduleId.stringId) } - checkGroup(ProductMode.LOCAL_IDE, "plugin.localIde") + checkGroup(ProductMode.MONOLITH, "plugin.localIde") checkGroup(ProductMode.FRONTEND, "plugin.frontend") } diff --git a/platform/statistics/src/com/intellij/internal/statistic/eventLog/StatisticsEventLogger.kt b/platform/statistics/src/com/intellij/internal/statistic/eventLog/StatisticsEventLogger.kt index fc5e14d68c71..833f377b4f9b 100644 --- a/platform/statistics/src/com/intellij/internal/statistic/eventLog/StatisticsEventLogger.kt +++ b/platform/statistics/src/com/intellij/internal/statistic/eventLog/StatisticsEventLogger.kt @@ -120,7 +120,7 @@ abstract class StatisticsEventLoggerProvider(val recorderId: String, // Use `String?` instead of boolean flag for future expansion with other IDE modes val ideMode = if(AppMode.isRemoteDevHost()) "RDH" else null val currentProductModeId = ProductLoadingStrategy.strategy.currentModeId - val productMode = if (currentProductModeId != ProductMode.LOCAL_IDE.id) { + val productMode = if (currentProductModeId != ProductMode.MONOLITH.id) { currentProductModeId } else if (detectClionNova()) { "nova" diff --git a/tools/devLauncher/src/IntellijDevLauncher.kt b/tools/devLauncher/src/IntellijDevLauncher.kt index 493ea65e478b..f9c6b244d298 100644 --- a/tools/devLauncher/src/IntellijDevLauncher.kt +++ b/tools/devLauncher/src/IntellijDevLauncher.kt @@ -56,7 +56,7 @@ fun main(args: Array) { } private fun loadProductModules(moduleRepository: RuntimeModuleRepository, projectHome: Path): ProductModules { - val currentModeId = System.getProperty(PLATFORM_PRODUCT_MODE_PROPERTY, ProductMode.LOCAL_IDE.id) + val currentModeId = System.getProperty(PLATFORM_PRODUCT_MODE_PROPERTY, ProductMode.MONOLITH.id) val currentMode = ProductMode.entries.find { it.id == currentModeId } if (currentMode == null) { reportError("Unknown mode '$currentModeId' specified in '$PLATFORM_PRODUCT_MODE_PROPERTY' system property")