Skip to content

Commit

Permalink
fix gradle plugin compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
whyoleg committed Oct 23, 2023
1 parent 487c7c7 commit 2905c85
Showing 1 changed file with 21 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,34 @@

package org.jetbrains.conventions

import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

plugins {
id("org.gradle.kotlin.kotlin-dsl")
id("org.jetbrains.conventions.base-java")
kotlin("jvm")
id("org.jetbrains.conventions.publishing-gradle")
}

// org.gradle.kotlin.kotlin-dsl sets languageVersion and apiVersion to 1.8 by default starting from Gradle 8
// as we want to be compatible with previous Gradle versions, we need to set it back to 1.4
// Note: we should do it directly on tasks and not via top-level `kotlin.compilerOptions`
// because kotlin-dsl plugin declares them on task level, and so top-level config is overridden
tasks.withType<KotlinCompile>().configureEach {
compilerOptions {
languageVersion.set(dokkaBuild.kotlinLanguageLevel)
apiVersion.set(dokkaBuild.kotlinLanguageLevel)

freeCompilerArgs.addAll(
// need 1.4 support, otherwise there might be problems
// with Gradle 6.x (it's bundling Kotlin 1.4)
"-Xsuppress-version-warnings",
"-Xjsr305=strict",
"-Xskip-metadata-version-check",
)
}
}

// Gradle will put its own version of the stdlib in the classpath, so not pull our own we will end up with
// warnings like 'Runtime JAR files in the classpath should have the same version'
listOf(
Expand Down

0 comments on commit 2905c85

Please sign in to comment.