diff --git a/buildSrc/src/main/kotlin/toolkit-intellij-subplugin.gradle.kts b/buildSrc/src/main/kotlin/toolkit-intellij-subplugin.gradle.kts index 3098d992d58..4d414cd0101 100644 --- a/buildSrc/src/main/kotlin/toolkit-intellij-subplugin.gradle.kts +++ b/buildSrc/src/main/kotlin/toolkit-intellij-subplugin.gradle.kts @@ -32,7 +32,8 @@ sourceSets { configurations { runtimeClasspath { - // IDE provides Kotlin + // Exclude dependencies that ship with IDE + exclude(group = "org.slf4j") exclude(group = "org.jetbrains.kotlin") exclude(group = "org.jetbrains.kotlinx") @@ -41,6 +42,23 @@ configurations { exclude(group = "com.fasterxml.jackson.dataformat", "jackson-dataformat-yaml") } + listOf( + "testRuntimeClasspath", + "integrationTestRuntimeClasspath", + ).forEach { + try { + it { + // Exclude dependencies that ship with IDE + exclude(group = "org.slf4j") + // we want kotlinx-coroutines-debug and kotlinx-coroutines-test + exclude(group = "org.jetbrains.kotlinx", "kotlinx-coroutines-core-jvm") + exclude(group = "org.jetbrains.kotlinx", "kotlinx-coroutines-core") + } + } catch (e: Exception){ + logger.info("Skipped excluding IDE deps for $it because hit $e") + } + } + configureEach { // IDE provides netty exclude("io.netty") @@ -49,12 +67,6 @@ configurations { return@configureEach } - // Exclude dependencies that ship with iDE - exclude(group = "org.slf4j") - // we want kotlinx-coroutines-debug and kotlinx-coroutines-test - exclude(group = "org.jetbrains.kotlinx", "kotlinx-coroutines-core-jvm") - exclude(group = "org.jetbrains.kotlinx", "kotlinx-coroutines-core") - resolutionStrategy.eachDependency { if (requested.group == "org.jetbrains.kotlinx" && requested.name.startsWith("kotlinx-coroutines")) { useVersion(versionCatalog.findVersion("kotlinCoroutines").get().toString()) diff --git a/buildSrc/src/main/kotlin/toolkit-kotlin-conventions.gradle.kts b/buildSrc/src/main/kotlin/toolkit-kotlin-conventions.gradle.kts index 0dabd5e83ec..fb1f0dbf15e 100644 --- a/buildSrc/src/main/kotlin/toolkit-kotlin-conventions.gradle.kts +++ b/buildSrc/src/main/kotlin/toolkit-kotlin-conventions.gradle.kts @@ -1,11 +1,11 @@ +// Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + import io.gitlab.arturbosch.detekt.Detekt import io.gitlab.arturbosch.detekt.DetektCreateBaselineTask import io.gitlab.arturbosch.detekt.DetektPlugin import org.jetbrains.kotlin.gradle.dsl.KotlinJvmProjectExtension -// Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 - plugins { id("java-library") id("toolkit-detekt") @@ -15,12 +15,6 @@ plugins { // TODO: https://github.com/gradle/gradle/issues/15383 val versionCatalog = extensions.getByType().named("libs") dependencies { - // kotlin/kotlin-coroutines might not be necessary if we're in an intellij-plugin-based module - // - The dependency on the Kotlin Standard Library (stdlib) is automatically added when using the Gradle Kotlin plugin and may conflict with the version provided with the IntelliJ Platform, see: https://jb.gg/intellij-platform-kotlin-stdlib - //- The Kotlin Coroutines library should not be added explicitly to the project as it is already provided with the IntelliJ Platform. - implementation(versionCatalog.findBundle("kotlin").get()) - implementation(versionCatalog.findLibrary("kotlin-coroutines").get()) - testFixturesApi(versionCatalog.findLibrary("kotlin-test").get()) testFixturesApi(versionCatalog.findLibrary("kotlin-coroutinesDebug").get()) { // IDE provides JNA and results in conflicts diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index a5c9bfcddea..2792dfa545a 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -17,7 +17,7 @@ junit4 = "4.13.2" junit5 = "5.11.0" # https://plugins.jetbrains.com/docs/intellij/kotlin.html#adding-kotlin-support # https://kotlinlang.org/docs/releases.html#release-details -kotlin = "2.0.0" +kotlin = "2.0.20" # set in /settings.gradle.kts kotlinCoroutines = "1.8.0" mockito = "5.12.0" @@ -97,7 +97,7 @@ kotlin-coroutines = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", kotlin-coroutinesDebug = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-debug", version.ref = "kotlinCoroutines" } kotlin-coroutinesTest = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-test", version.ref = "kotlinCoroutines" } kotlin-reflect = { module = "org.jetbrains.kotlin:kotlin-reflect", version.ref = "kotlin" } -kotlin-stdLibJdk8 = { module = "org.jetbrains.kotlin:kotlin-stdlib-jdk8", version.ref = "kotlin" } +kotlin-stdlib = { module = "org.jetbrains.kotlin:kotlin-stdlib", version.ref = "kotlin" } kotlin-test = { module = "org.jetbrains.kotlin:kotlin-test-junit", version.ref = "kotlin" } mockito-core = { module = "org.mockito:mockito-core", version.ref = "mockito" } mockito-kotlin = { module = "org.mockito.kotlin:mockito-kotlin", version.ref = "mockitoKotlin" } @@ -114,7 +114,7 @@ zjsonpatch = { module = "com.flipkart.zjsonpatch:zjsonpatch", version.ref = "zjs [bundles] jackson = ["jackson-datetime", "jackson-kotlin", "jackson-yaml", "jackson-xml"] -kotlin = ["kotlin-stdLibJdk8", "kotlin-reflect"] +kotlin = ["kotlin-stdlib", "kotlin-reflect"] mockito = ["mockito-core", "mockito-kotlin"] sshd = ["sshd-core", "sshd-scp", "sshd-sftp"] diff --git a/plugins/core/core/build.gradle.kts b/plugins/core/core/build.gradle.kts index 32464f6cb60..e7eda1fd52b 100644 --- a/plugins/core/core/build.gradle.kts +++ b/plugins/core/core/build.gradle.kts @@ -9,6 +9,10 @@ plugins { } dependencies { + // provided at runtime by IDE + compileOnly(libs.bundles.kotlin) + compileOnly(libs.kotlin.coroutines) + compileOnlyApi(project(":plugin-core:resources")) compileOnlyApi(project(":plugin-core:sdk-codegen")) diff --git a/plugins/core/resources/build.gradle.kts b/plugins/core/resources/build.gradle.kts index 19e00ac3308..16ff2cf4c97 100644 --- a/plugins/core/resources/build.gradle.kts +++ b/plugins/core/resources/build.gradle.kts @@ -17,6 +17,8 @@ sourceSets { } dependencies { + implementation(libs.bundles.kotlin) + testImplementation(libs.junit4) testRuntimeOnly(libs.junit5.jupiterVintage) } diff --git a/plugins/toolkit/jetbrains-core/build.gradle.kts b/plugins/toolkit/jetbrains-core/build.gradle.kts index 737c1781753..c2d31d65ded 100644 --- a/plugins/toolkit/jetbrains-core/build.gradle.kts +++ b/plugins/toolkit/jetbrains-core/build.gradle.kts @@ -193,8 +193,6 @@ dependencies { compileOnlyApi(project(":plugin-core:core")) compileOnlyApi(project(":plugin-core:jetbrains-community")) - // TODO: remove Q dependency when split is fully done - implementation(libs.bundles.jackson) implementation(libs.zjsonpatch) testFixturesApi(testFixtures(project(":plugin-core:jetbrains-community"))) diff --git a/plugins/toolkit/jetbrains-rider/build.gradle.kts b/plugins/toolkit/jetbrains-rider/build.gradle.kts index 4a43c1a548f..ae391bc20cb 100644 --- a/plugins/toolkit/jetbrains-rider/build.gradle.kts +++ b/plugins/toolkit/jetbrains-rider/build.gradle.kts @@ -355,14 +355,3 @@ tasks.integrationTest { tasks.withType().configureEach { dependsOn(generateModels) } - -configurations.all { - if (name.contains("detekt")) { - return@all - } - - // test runner not happy with coroutines, but not clear where it's coming from: - // java.lang.Throwable: Thread context was already set: InstalledThreadContext(snapshot=null, context=EmptyCoroutineContext). - // Most likely, you are using 'runBlocking' instead of 'runBlockingCancellable' somewhere in the asynchronous stack. - exclude("org.jetbrains.kotlinx") -}