intellij-community
intellij-community copied to clipboard
Exclude other plugins from the Kotlin plugin build
This is a small patch that we have at Google in order to simplify building the Kotlin IDE plugin in isolation. This change allows the Kotlin build to succeed without downloading all sources (e.g. without the Android plugin).
It would be convenient to upstream this change if possible. Thanks!
This change should probably be reviewed by @nikitabobko or @erokhins
I had to rebase your patch on top of master and amend it a bit:
commit d176e6a721b4fba6615e19a6a5562e96cfa1cf47
Author: Matthew Gharrity <[email protected]>
AuthorDate: Tue Jun 7 13:23:52 2022 -0400
Commit: Nikita Bobko <[email protected]>
CommitDate: Fri Jun 10 13:12:41 2022 +0200
Exclude other plugins from the Kotlin plugin build
This makes it easier to build the Kotlin IDE plugin without
downloading all sources (e.g. without the Android plugin).
closes https://github.com/JetBrains/intellij-community/pull/2040
Co-authored-by: Nikita Bobko <[email protected]>
diff --git a/build/groovy/KotlinPluginBuildTarget.kt b/build/groovy/KotlinPluginBuildTarget.kt
index c411ec9310022..9007784cf130d 100644
--- a/build/groovy/KotlinPluginBuildTarget.kt
+++ b/build/groovy/KotlinPluginBuildTarget.kt
@@ -1,13 +1,24 @@
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
+import kotlinx.collections.immutable.toPersistentList
import org.jetbrains.intellij.build.IdeaCommunityProperties
import org.jetbrains.intellij.build.IdeaProjectLoaderUtil
import org.jetbrains.intellij.build.kotlin.KotlinPluginBuilder
+import java.nio.file.Path
object KotlinPluginBuildTarget {
@JvmStatic
fun main(args: Array<String>) {
val communityHome = IdeaProjectLoaderUtil.guessCommunityHome(javaClass)
- KotlinPluginBuilder(communityHome, communityHome, IdeaCommunityProperties(communityHome)).build()
+ val properties = KotlinIdeaProperties(communityHome, KotlinPluginBuilder.KotlinUltimateSources.WITH_COMMUNITY_MODULES)
+ KotlinPluginBuilder(communityHome, communityHome, properties).build()
+ }
+}
+
+class KotlinIdeaProperties(home: Path, ultimateSources: KotlinPluginBuilder.KotlinUltimateSources) : IdeaCommunityProperties(home) {
+ init {
+ // Only build the Kotlin plugin, nothing else.
+ productLayout.bundledPluginModules = mutableListOf()
+ productLayout.pluginLayouts = listOf(KotlinPluginBuilder.kotlinPlugin(ultimateSources)).toPersistentList()
}
}
Now "Build Kotlin Plugin" run configuration fails with:
Exception in thread "main" org.jetbrains.intellij.build.BuildScriptsLoggedError: No plugin layout specified in productProperties.productLayout.pluginLayouts for following plugin main modules: intellij.java.plugin, kotlin.resources-fir
at org.jetbrains.intellij.build.impl.logging.BuildMessagesImpl.error(BuildMessagesImpl.kt:88)
at org.jetbrains.intellij.build.impl.BuildTasksImplKt.checkPluginModules(BuildTasksImpl.kt:936)
at org.jetbrains.intellij.build.impl.BuildTasksImplKt.checkProductLayout(BuildTasksImpl.kt:802)
at org.jetbrains.intellij.build.impl.BuildTasksImplKt.checkProductProperties(BuildTasksImpl.kt:746)
at org.jetbrains.intellij.build.impl.BuildTasksImplKt.access$checkProductProperties(BuildTasksImpl.kt:1)
at org.jetbrains.intellij.build.impl.BuildTasksImpl.buildNonBundledPlugins(BuildTasksImpl.kt:83)
at org.jetbrains.intellij.build.kotlin.KotlinPluginBuilder.build(KotlinPluginBuilder.groovy:376)
at KomboArtifactsBuildTarget.main(kombo.kt:44)
@nikitabobko If you tweak IdeaCommunityProperties.pluginLauouts, you need also remove references to other plugins as it's written in the error message. Or product definition KotlinIdeaProperties is incomplete
you need also remove references to other plugins as it's written in the error message.
Do you mean that Kotlin plugin should stop depending on intellij.java.plugin and kotlin.resources-fir? Or what kind of references do you mean?
@nikitabobko I mean that constructed IDE definition 'KotlinIdeaProperties' contains references to intellij.java.plugin and kotlin.resources-fir plugins, but you've just removed their layout.
The problem was in compatiblePluginsToIgnore. Now it was cleaned up in the platform so there is no such exception anymore in the master. But now there is another problem:
Exception in thread "main" org.jetbrains.intellij.build.BuildScriptsLoggedError: No plugin layout specified in productProperties.productLayout.pluginLayouts for following plugin main modules (referenced from productProperties.productLayout.compatiblePluginsToIgnore): intellij.java.plugin, kotlin.resources-fir
at org.jetbrains.intellij.build.impl.logging.BuildMessagesImpl.error(BuildMessagesImpl.kt:88)
at org.jetbrains.intellij.build.impl.BuildTasksImplKt.checkPluginModules(BuildTasksImpl.kt:936)
at org.jetbrains.intellij.build.impl.BuildTasksImplKt.checkProductLayout(BuildTasksImpl.kt:802)
at org.jetbrains.intellij.build.impl.BuildTasksImplKt.checkProductProperties(BuildTasksImpl.kt:746)
at org.jetbrains.intellij.build.impl.BuildTasksImplKt.access$checkProductProperties(BuildTasksImpl.kt:1)
at org.jetbrains.intellij.build.impl.BuildTasksImpl.buildNonBundledPlugins(BuildTasksImpl.kt:83)
at org.jetbrains.intellij.build.kotlin.KotlinPluginBuilder.build(KotlinPluginBuilder.groovy:388)
at KotlinPluginBuildTarget.main(KotlinPluginBuildTarget.kt:14)
@gharrma I will stop investigating what goes wrong with the code. Please rebase your commit on top of master and fix all left problems
Sounds good. Apologies for the merge conflicts; I'll ping this PR once I have it rebased and fixed.
Close as outdated. Feel free to reopen the new Pull Request