mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-04-19 21:11:28 +07:00
[plugin model] provide replacement for com.intellij.platform.experimental.* plugin aliases (IJPL-177155)
This introduces 'intellij.platform.backend' as a content module, and dependencies on 'intellij.platform.backend' and 'intellij.platform.frontend' can be used instead of com.intellij.platform.experimental.* plugin aliases. PluginSetBuilder automatically disabled modules which aren't compatible with the current product mode. GitOrigin-RevId: 5c0a82d256dd7abe1720a77cd94ee38efed6b6d6
This commit is contained in:
committed by
intellij-monorepo-bot
parent
6c4cd5dbe2
commit
bc59a24141
@@ -2,7 +2,9 @@
|
||||
<module type="JAVA_MODULE" version="4">
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$" />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/resources" type="java-resource" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
|
||||
2
platform/backend/resources/intellij.platform.backend.xml
Normal file
2
platform/backend/resources/intellij.platform.backend.xml
Normal file
@@ -0,0 +1,2 @@
|
||||
<idea-plugin>
|
||||
</idea-plugin>
|
||||
@@ -279,22 +279,11 @@ class IdeaPluginDescriptorImpl(
|
||||
* This is done to support running without the module-based loader (from sources and in dev mode),
|
||||
* where all modules are available, but only some of them need to be loaded.
|
||||
*
|
||||
* Module dependencies must be satisfied, module dependencies determine whether a module will be loaded.
|
||||
* If a module declares a special dependency, the dependency might be not satisfied in some produce mode,
|
||||
* and the module will not be loaded in that mode.
|
||||
* This function determines which dependencies are satisfiable by the current product mode.
|
||||
*
|
||||
* There are three product modes:
|
||||
* 1. Split frontend (JetBrains Client)
|
||||
* 2. Monolith, or regular local IDE
|
||||
* 3. Split backend (Remote Dev Host) or CWM plugin installed in monolith
|
||||
*
|
||||
* If a module needs to be loaded in some mode(-s), declare the following dependency(-ies):
|
||||
* - in 1 or 2: `com.intellij.platform.experimental.frontend`
|
||||
* - in 2 or 3: `com.intellij.platform.experimental.backend`
|
||||
* - only in 2: both `com.intellij.platform.experimental.frontend` and `com.intellij.platform.experimental.backend`
|
||||
* - in 1 or 2 or 3: no dependency needed
|
||||
* This method is left for compatibility only.
|
||||
* Now dependencies on 'intellij.platform.frontend' and 'intellij.platform.backend' should be used instead.
|
||||
* These modules are automatically disabled if they aren't relevant to the product mode, see [PluginSetBuilder.getModuleIncompatibleWithCurrentProductMode].
|
||||
*/
|
||||
@ApiStatus.Obsolete
|
||||
private fun productModeAliasesForCorePlugin(): List<PluginId> = buildList {
|
||||
if (!AppMode.isRemoteDevHost()) {
|
||||
// This alias is available in monolith and frontend.
|
||||
|
||||
@@ -92,6 +92,7 @@ class PluginSetBuilder(@JvmField val unsortedPlugins: Set<IdeaPluginDescriptorIm
|
||||
val loadingErrors = ArrayList<PluginLoadingError>()
|
||||
val enabledRequiredContentModules = HashMap<String, IdeaPluginDescriptorImpl>()
|
||||
val disabledModuleToProblematicPlugin = HashMap<String, PluginId>()
|
||||
val moduleIncompatibleWithCurrentMode = getModuleIncompatibleWithCurrentProductMode()
|
||||
|
||||
fun registerLoadingError(plugin: IdeaPluginDescriptorImpl, disabledModule: PluginContentDescriptor.ModuleItem) {
|
||||
loadingErrors.add(createCannotLoadError(
|
||||
@@ -102,6 +103,12 @@ class PluginSetBuilder(@JvmField val unsortedPlugins: Set<IdeaPluginDescriptorIm
|
||||
}
|
||||
|
||||
m@ for (module in sortedModulesWithDependencies.modules) {
|
||||
if (module.moduleName == moduleIncompatibleWithCurrentMode) {
|
||||
module.isEnabled = false
|
||||
logMessages.add("Module ${module.moduleName} is disabled because it is not compatible with the current product mode")
|
||||
continue
|
||||
}
|
||||
|
||||
if (module.isUseIdeaClassLoader && !canExtendIdeaClassLoader) {
|
||||
module.isEnabled = false
|
||||
logMessages.add("Module ${module.moduleName ?: module.pluginId} is not enabled because it uses deprecated `use-idea-classloader` attribute but PathClassLoader is disabled")
|
||||
@@ -188,6 +195,20 @@ class PluginSetBuilder(@JvmField val unsortedPlugins: Set<IdeaPluginDescriptorIm
|
||||
return loadingErrors
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a module which should be disabled because it's not relevant to the current com.intellij.platform.runtime.product.ProductMode.
|
||||
* All modules that depend on the specified module will be automatically disabled as well.
|
||||
*/
|
||||
private fun getModuleIncompatibleWithCurrentProductMode(): String? {
|
||||
return when (ProductLoadingStrategy.strategy.currentModeId) {
|
||||
/** intellij.platform.backend.split is currently available in 'monolith' mode because it's used as a backend in CodeWithMe */
|
||||
"monolith" -> "intellij.platform.frontend.split"
|
||||
"backend" -> "intellij.platform.frontend"
|
||||
"frontend" -> "intellij.platform.backend"
|
||||
else -> null
|
||||
}
|
||||
}
|
||||
|
||||
private fun markModuleAsEnabled(moduleName: String, moduleDescriptor: IdeaPluginDescriptorImpl) {
|
||||
enabledModuleV2Ids.put(moduleName, moduleDescriptor)
|
||||
for (pluginAlias in moduleDescriptor.pluginAliases) {
|
||||
|
||||
@@ -1,5 +1,2 @@
|
||||
<idea-plugin package="com.intellij.platform.frontend">
|
||||
<dependencies>
|
||||
<plugin id="com.intellij.platform.experimental.frontend"/>
|
||||
</dependencies>
|
||||
</idea-plugin>
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
<module name="intellij.libraries.ktor.client"/>
|
||||
<module name="intellij.libraries.ktor.client.cio"/>
|
||||
|
||||
<module name="intellij.platform.backend"/>
|
||||
<module name="intellij.platform.rpc.backend"/>
|
||||
<module name="intellij.platform.kernel.backend"/>
|
||||
<module name="intellij.platform.project.backend"/>
|
||||
|
||||
Reference in New Issue
Block a user