-
Notifications
You must be signed in to change notification settings - Fork 272
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Kotlin runtime not completely excluded #585
Comments
Quick update: Adding an explicit dependency to kotlin-reflect 1.4 as suggested by the build output makes no difference. The classpath still contains mixed versions. |
Any news on this? |
Hi @mvilliger, sorry for the silence. No news so far. Your suggestion about |
No problem. Thanks for your answer. Any better solution is of course welcome as well :) |
But maybe it is better to first provide a fix for the current solution (short term) until we can come up with some better solution for the future? |
makes sense, I'll take a look in couple days |
I couldn't recreate the warning but the change seems reasonable anyway. I've pushed it. The snapshot will be available in couple hours I think |
Thanks @zolotov I will test it the next days. Coming back to you. |
@zolotov I can confirm that the issue is fixed in version 0.8.0-SNAPSHOT. Thank you very much! And I just found #503 which might be related to this issue here and may be fixed as well? Unfortunately we hit issue #606 with the new version which seemed to work in the version 0.6.5 we used before. |
Thank you! I'll investigate #606 before publishing 0.7.3 |
Hi @zolotov, Just checked on my local machine, issue was not fixed, my steps:
Console output
|
@zolotov Thank you! |
@L2jLiga thanks for checking, I'll look into that one too |
I still experience this issue with
|
@AlexPl292 likely yes, see #612 |
I'm still having this problem
# IntelliJ Platform Artifacts Repositories
# -> https://plugins.jetbrains.com/docs/intellij/intellij-artifacts.html
pluginGroup = org.bytecamp.program_repair.astor_plugin
pluginName = IntelliJ Idea Astor Plugin
pluginVersion = 0.2.2
# See https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html
# for insight into build numbers and IntelliJ Platform versions.
pluginSinceBuild = 202
pluginUntilBuild = 212.*
# Plugin Verifier integration -> https://github.com/JetBrains/gradle-intellij-plugin#plugin-verifier-dsl
# See https://jb.gg/intellij-platform-builds-list for available build versions.
pluginVerifierIdeVersions = 2020.2.4
platformType = IC
platformVersion = 2021.2
# Bug: Using platformLocalPath does not work with java plugin https://youtrack.jetbrains.com/issue/IDEA-274934
#platformLocalPath = downloaded/ideaIC-2021.2
platformDownloadSources = true
#jreVersion =
# Opt-out flag for bundling Kotlin standard library.
# See https://plugins.jetbrains.com/docs/intellij/kotlin.html#kotlin-standard-library for details.
kotlin.stdlib.default.dependency = false
import org.jetbrains.changelog.markdownToHTML
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
fun properties(key: String) = project.findProperty(key).toString()
plugins {
// Java support
id("java")
// Kotlin support
id("org.jetbrains.kotlin.jvm") version "1.5.10"
// gradle-intellij-plugin - read more: https://github.com/JetBrains/gradle-intellij-plugin
id("org.jetbrains.intellij") version "1.1.2"
// gradle-changelog-plugin - read more: https://github.com/JetBrains/gradle-changelog-plugin
id("org.jetbrains.changelog") version "1.1.2"
}
group = properties("pluginGroup")
version = properties("pluginVersion")
//
// Configure project's dependencies
repositories {
mavenCentral()
}
dependencies {
implementation("com.google.code.gson:gson:2.8.7")
testImplementation(platform("org.junit:junit-bom:5.7.2"))
testImplementation("org.junit.jupiter:junit-jupiter:5.7.2")
}
// Configure gradle-intellij-plugin plugin.
// Read more: https://github.com/JetBrains/gradle-intellij-plugin
intellij {
pluginName.set(properties("pluginName"))
if (properties("platformVersion") != "null") {
version.set(properties("platformVersion"))
} else {
localPath.set(properties("platformLocalPath"))
}
type.set(properties("platformType"))
downloadSources.set(properties("platformDownloadSources").toBoolean())
updateSinceUntilBuild.set(true)
plugins.set(listOf("java"))
}
// Configure gradle-changelog-plugin plugin.
// Read more: https://github.com/JetBrains/gradle-changelog-plugin
changelog {
version = properties("pluginVersion")
groups = emptyList()
}
tasks {
// Set the compatibility versions to 1.8
withType<JavaCompile> {
sourceCompatibility = "1.8"
targetCompatibility = "1.8"
}
withType<KotlinCompile> {
kotlinOptions.jvmTarget = "1.8"
}
patchPluginXml {
version.set(properties("pluginVersion"))
sinceBuild.set(properties("pluginSinceBuild"))
untilBuild.set(properties("pluginUntilBuild"))
// Extract the <!-- Plugin description --> section from README.md and provide for the plugin's manifest
pluginDescription.set(
File(projectDir, "README.md").readText().lines().run {
val start = "<!-- Plugin description -->"
val end = "<!-- Plugin description end -->"
if (!containsAll(listOf(start, end))) {
throw GradleException("Plugin description section not found in README.md:\n$start ... $end")
}
subList(indexOf(start) + 1, indexOf(end))
}.joinToString("\n").run { markdownToHTML(this) }
)
// Get the latest available change notes from the changelog file
changeNotes.set(provider { changelog.getLatest().toHTML() })
}
runPluginVerifier {
ideVersions.set(properties("pluginVerifierIdeVersions").split(',').map(String::trim).filter(String::isNotEmpty))
}
runIde {
if (properties("jreVersion") != "null")
jbrVersion.set(properties("jreVersion"))
autoReloadPlugins.set(true)
}
buildSearchableOptions {
if (properties("jreVersion") != "null")
jbrVersion.set(properties("jreVersion"))
}
test {
useJUnitPlatform()
testLogging {
events("passed", "skipped", "failed")
}
}
publishPlugin {
dependsOn("patchChangelog")
token.set(System.getenv("PUBLISH_TOKEN"))
// pluginVersion is based on the SemVer (https://semver.org) and supports pre-release labels, like 2.1.7-alpha.3
// Specify pre-release label to publish the plugin in a custom Release Channel automatically. Read more:
// https://plugins.jetbrains.com/docs/intellij/deployment.html#specifying-a-release-channel
channels.set(listOf(properties("pluginVersion").split('-').getOrElse(1) { "default" }.split('.').first()))
}
}
|
We have an IntelliJ plugin written in Kotlin. Our build.gradle.kts looks like this:
When using Kotlin 1.4 with an older IntelliJ version containing Kotlin 1.3 (like above version 2020.1.2) the build complains about mixed versions:
As you can see it only complains for the kotlin-reflect jar file. The 1.3 kotlin-stdlib jars (which exist in the same location within 2020.1.2) are not part of the classpath.
As far as I can see this is because the gradle-intellij-plugin has a mechanism to exclude the Kotlin runtime if necessary (see
org.jetbrains.intellij.dependency.IdeaDependency#collectJarFiles
). It usesIdeaDependencyManager#isKotlinRuntime
to detect if a jar belongs to the Kotlin runtime. But this method checks using'kotlin-reflect' == name
while it usesname.startsWith('kotlin-stdlib')
. In my cases name was 'kotlin-reflect-1.3.70' which explains why it is not detected and therefore not excluded.Maybe this check should use
startsWith
as well? Maybe the same for the'kotlin-runtime'
check before?Or is our setup wrong?
The text was updated successfully, but these errors were encountered: