mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-03-22 15:19:59 +07:00
IJPL-973 extract intellij.platform.vcs.log.impl and intellij.platform.vcs.dvcs.impl from Core
GitOrigin-RevId: 64147c5b0cd8e648a33792e9be96d2381d9b5d39
This commit is contained in:
committed by
intellij-monorepo-bot
parent
b5e1d32bc0
commit
f980e03c93
@@ -85,9 +85,7 @@ private val PLATFORM_IMPLEMENTATION_MODULES = persistentListOf(
|
||||
"intellij.platform.webSymbols",
|
||||
"intellij.xml.dom.impl",
|
||||
|
||||
"intellij.platform.vcs.dvcs.impl",
|
||||
"intellij.platform.vcs.log.graph.impl",
|
||||
"intellij.platform.vcs.log.impl",
|
||||
"intellij.platform.vcs.dvcs",
|
||||
"intellij.smart.update",
|
||||
|
||||
"intellij.platform.collaborationTools",
|
||||
@@ -95,7 +93,10 @@ private val PLATFORM_IMPLEMENTATION_MODULES = persistentListOf(
|
||||
"intellij.platform.collaborationTools.auth",
|
||||
|
||||
"intellij.platform.markdown.utils",
|
||||
"intellij.platform.util.commonsLangV2Shim"
|
||||
"intellij.platform.util.commonsLangV2Shim",
|
||||
|
||||
// do we need it?
|
||||
"intellij.platform.sqlite",
|
||||
)
|
||||
|
||||
internal val PLATFORM_CUSTOM_PACK_MODE: Map<String, LibraryPackMode> = java.util.Map.of(
|
||||
@@ -527,28 +528,40 @@ private suspend fun getProductPluginContentModules(context: BuildContext, produc
|
||||
|
||||
readXmlAsModel(file)
|
||||
}?.let { root ->
|
||||
collectProductModules(root = root, result = result, context = context)
|
||||
collectProductModules(root = root, result = result)
|
||||
}
|
||||
|
||||
withContext(Dispatchers.IO) {
|
||||
val file = context.findFileInModuleSources("intellij.platform.resources", "META-INF/PlatformLangPlugin.xml")
|
||||
file?.let { readXmlAsModel(it) }
|
||||
}?.let {
|
||||
collectProductModules(root = it, result = result, context = context)
|
||||
collectProductModules(root = it, result = result)
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
private fun collectProductModules(root: XmlElement, result: LinkedHashSet<ModuleItem>, context: BuildContext) {
|
||||
private fun collectProductModules(root: XmlElement, result: LinkedHashSet<ModuleItem>) {
|
||||
for (module in (root.getChild("content")?.children("module") ?: emptySequence())) {
|
||||
val moduleName = module.attributes.get("name") ?: continue
|
||||
val relativeOutFile = "modules/$moduleName.jar"
|
||||
result.add(
|
||||
ModuleItem(moduleName = moduleName, relativeOutputFile = "modules/$moduleName.jar", reason = ModuleIncludeReasons.PRODUCT_MODULES),
|
||||
ModuleItem(moduleName = moduleName, relativeOutputFile = relativeOutFile, reason = ModuleIncludeReasons.PRODUCT_MODULES),
|
||||
)
|
||||
PRODUCT_MODULE_IMPL_COMPOSITION.get(moduleName)?.let {
|
||||
it.mapTo(result) { subModuleName ->
|
||||
ModuleItem(moduleName = subModuleName, relativeOutputFile = relativeOutFile, reason = ModuleIncludeReasons.PRODUCT_MODULES)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private val PRODUCT_MODULE_IMPL_COMPOSITION = java.util.Map.of(
|
||||
"intellij.platform.vcs.log.impl", listOf(
|
||||
"intellij.platform.vcs.log.graph.impl"
|
||||
)
|
||||
)
|
||||
|
||||
internal object ModuleIncludeReasons {
|
||||
const val PRODUCT_MODULES: String = "productModule"
|
||||
}
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
package com.intellij.ide.plugins
|
||||
|
||||
import com.intellij.openapi.extensions.PluginId
|
||||
import com.intellij.util.graph.DFSTBuilder
|
||||
import com.intellij.util.graph.Graph
|
||||
import org.jetbrains.annotations.ApiStatus
|
||||
@@ -47,6 +48,8 @@ open class ModuleGraphBase protected constructor(
|
||||
}
|
||||
}
|
||||
|
||||
private val VCS_ALIAS_ID = PluginId.getId("com.intellij.modules.vcs")
|
||||
|
||||
internal fun createModuleGraph(plugins: Collection<IdeaPluginDescriptorImpl>): ModuleGraphBase {
|
||||
val moduleMap = HashMap<String, IdeaPluginDescriptorImpl>(plugins.size * 2)
|
||||
val modules = ArrayList<IdeaPluginDescriptorImpl>(moduleMap.size)
|
||||
@@ -65,7 +68,7 @@ internal fun createModuleGraph(plugins: Collection<IdeaPluginDescriptorImpl>): M
|
||||
}
|
||||
|
||||
val hasAllModules = moduleMap.containsKey(PluginManagerCore.ALL_MODULES_MARKER.idString)
|
||||
val result = Collections.newSetFromMap<IdeaPluginDescriptorImpl>(IdentityHashMap())
|
||||
val result: MutableSet<IdeaPluginDescriptorImpl> = Collections.newSetFromMap(IdentityHashMap())
|
||||
val directDependencies = IdentityHashMap<IdeaPluginDescriptorImpl, List<IdeaPluginDescriptorImpl>>(modules.size)
|
||||
for (module in modules) {
|
||||
val implicitDep = if (hasAllModules) getImplicitDependency(module, moduleMap) else null
|
||||
@@ -81,11 +84,19 @@ internal fun createModuleGraph(plugins: Collection<IdeaPluginDescriptorImpl>): M
|
||||
collectDirectDependenciesInOldFormat(module, moduleMap, result)
|
||||
collectDirectDependenciesInNewFormat(module, moduleMap, result)
|
||||
|
||||
if (module.moduleName != null && module.pluginId != PluginManagerCore.CORE_ID) {
|
||||
// add main as implicit dependency
|
||||
val main = moduleMap.get(module.pluginId.idString)!!
|
||||
assert(main !== module)
|
||||
result.add(main)
|
||||
if (module.pluginId != PluginManagerCore.CORE_ID) {
|
||||
if (module.moduleName == null) {
|
||||
if (isDependsOnPluginAlias(module, VCS_ALIAS_ID)) {
|
||||
moduleMap.get("intellij.platform.vcs.dvcs.impl")?.let { result.add(it) }
|
||||
moduleMap.get("intellij.platform.vcs.log.impl")?.let { result.add(it) }
|
||||
}
|
||||
}
|
||||
else {
|
||||
// add main as implicit dependency
|
||||
val main = moduleMap.get(module.pluginId.idString)!!
|
||||
assert(main !== module)
|
||||
result.add(main)
|
||||
}
|
||||
}
|
||||
|
||||
if (!result.isEmpty()) {
|
||||
@@ -108,6 +119,11 @@ internal fun createModuleGraph(plugins: Collection<IdeaPluginDescriptorImpl>): M
|
||||
return object : ModuleGraphBase(modules = modules, directDependencies = directDependencies, directDependents = directDependents) {}
|
||||
}
|
||||
|
||||
// alias in most cases points to Core plugin, so, we cannot use computed dependencies to check
|
||||
private fun isDependsOnPluginAlias(plugin: IdeaPluginDescriptorImpl, @Suppress("SameParameterValue") aliasId: PluginId): Boolean {
|
||||
return plugin.pluginDependencies.any { it.pluginId == aliasId } || plugin.dependencies.plugins.any { it.id == aliasId }
|
||||
}
|
||||
|
||||
private fun toCoreAwareComparator(comparator: Comparator<IdeaPluginDescriptorImpl>): Comparator<IdeaPluginDescriptorImpl> {
|
||||
// there is circular reference between core and implementation-detail plugin, as not all such plugins extracted from core,
|
||||
// so, ensure that core plugin is always first (otherwise not possible to register actions - a parent group not defined)
|
||||
@@ -153,13 +169,17 @@ private fun copySorted(
|
||||
* classes without declaring explicit dependency on the Java module. This method is intended to add implicit dependency on the Java plugin
|
||||
* for such plugins to avoid breaking compatibility with them.
|
||||
*/
|
||||
private fun getImplicitDependency(descriptor: IdeaPluginDescriptorImpl,
|
||||
idMap: Map<String, IdeaPluginDescriptorImpl>): IdeaPluginDescriptorImpl? {
|
||||
private fun getImplicitDependency(
|
||||
descriptor: IdeaPluginDescriptorImpl,
|
||||
idMap: Map<String, IdeaPluginDescriptorImpl>,
|
||||
): IdeaPluginDescriptorImpl? {
|
||||
// skip our plugins as expected to be up to date whether bundled or not
|
||||
if (descriptor.isBundled ||
|
||||
descriptor.packagePrefix != null ||
|
||||
descriptor.implementationDetail ||
|
||||
descriptor.content.modules.isNotEmpty()) {
|
||||
descriptor.content.modules.isNotEmpty() ||
|
||||
descriptor.dependencies.modules.isNotEmpty() ||
|
||||
descriptor.dependencies.plugins.isNotEmpty()) {
|
||||
return null
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
<idea-plugin>
|
||||
<dependencies>
|
||||
<module name="intellij.platform.vcs.log.impl"/>
|
||||
</dependencies>
|
||||
<extensionPoints>
|
||||
<extensionPoint name="pushSupport"
|
||||
interface="com.intellij.dvcs.push.PushSupport"
|
||||
@@ -14,6 +14,9 @@
|
||||
<module name="intellij.platform.navbar.compatibility.ide"/>
|
||||
<module name="intellij.platform.navbar.compatibility.monolith"/>
|
||||
<module name="intellij.platform.settings.local"/>
|
||||
|
||||
<module name="intellij.platform.vcs.log.impl"/>
|
||||
<module name="intellij.platform.vcs.dvcs.impl"/>
|
||||
</content>
|
||||
|
||||
<xi:include href="PlatformLangComponents.xml"/>
|
||||
|
||||
@@ -7,12 +7,6 @@
|
||||
<xi:include href="/META-INF/VcsExtensions.xml"/>
|
||||
<xi:include href="/META-INF/VcsActions.xml"/>
|
||||
|
||||
<xi:include href="/META-INF/vcs-log.xml">
|
||||
<xi:fallback/>
|
||||
</xi:include>
|
||||
<xi:include href="/META-INF/dvcs.xml">
|
||||
<xi:fallback/>
|
||||
</xi:include>
|
||||
<xi:include href="/META-INF/smart-update.xml">
|
||||
<xi:fallback/>
|
||||
</xi:include>
|
||||
|
||||
@@ -327,6 +327,5 @@
|
||||
<add-to-group group-id="FileHistory.KeymapGroup"/>
|
||||
</group>
|
||||
</actions>
|
||||
|
||||
</idea-plugin>
|
||||
|
||||
Reference in New Issue
Block a user