Skip to content

Commit

Permalink
Remove kotlin-stdlib dependency from gradle runner (#2570)
Browse files Browse the repository at this point in the history
  • Loading branch information
martinbonnin committed Jul 18, 2022
1 parent 7cbdcc9 commit b6a8e58
Showing 1 changed file with 19 additions and 5 deletions.
24 changes: 19 additions & 5 deletions runners/gradle-plugin/build.gradle.kts
Expand Up @@ -32,13 +32,27 @@ dependencies {

// Gradle will put its own version of the stdlib in the classpath, do not pull our own we will end up with
// warnings like 'Runtime JAR files in the classpath should have the same version'
configurations.api {
exclude(group = "org.jetbrains.kotlin", module = "kotlin-stdlib")
exclude(group = "org.jetbrains.kotlin", module = "kotlin-stdlib-jdk7")
exclude(group = "org.jetbrains.kotlin", module = "kotlin-stdlib-jdk8")
exclude(group = "org.jetbrains.kotlin", module = "kotlin-stdlib-common")
configurations.api.configure {
excludeGradleCommonDependencies()
}

/**
* These dependencies will be provided by Gradle, and we should prevent version conflict
* Code taken from the Kotlin Gradle plugin:
* https://github.com/JetBrains/kotlin/blob/70e15b281cb43379068facb82b8e4bcb897a3c4f/buildSrc/src/main/kotlin/GradleCommon.kt#L72
*/
fun Configuration.excludeGradleCommonDependencies() {
dependencies
.withType<ModuleDependency>()
.configureEach {
exclude(group = "org.jetbrains.kotlin", module = "kotlin-stdlib")
exclude(group = "org.jetbrains.kotlin", module = "kotlin-stdlib-jdk7")
exclude(group = "org.jetbrains.kotlin", module = "kotlin-stdlib-jdk8")
exclude(group = "org.jetbrains.kotlin", module = "kotlin-stdlib-common")
exclude(group = "org.jetbrains.kotlin", module = "kotlin-reflect")
exclude(group = "org.jetbrains.kotlin", module = "kotlin-script-runtime")
}
}

val sourceJar by tasks.registering(Jar::class) {
archiveClassifier.set("sources")
Expand Down

0 comments on commit b6a8e58

Please sign in to comment.