diff options
3 files changed, 22 insertions, 14 deletions
diff --git a/buildSrc/src/main/kotlin/org/jetbrains/conventions/kotlin-jvm.gradle.kts b/buildSrc/src/main/kotlin/org/jetbrains/conventions/kotlin-jvm.gradle.kts index bd33df22..c40ce57c 100644 --- a/buildSrc/src/main/kotlin/org/jetbrains/conventions/kotlin-jvm.gradle.kts +++ b/buildSrc/src/main/kotlin/org/jetbrains/conventions/kotlin-jvm.gradle.kts @@ -1,6 +1,7 @@ package org.jetbrains.conventions import org.jetbrains.configureDokkaVersion +import org.jetbrains.kotlin.gradle.dsl.KotlinVersion import org.jetbrains.kotlin.gradle.tasks.KotlinCompile plugins { @@ -14,16 +15,18 @@ configureDokkaVersion() val language_version: String by project tasks.withType<KotlinCompile>().configureEach { - kotlinOptions { - freeCompilerArgs += listOf( - "-opt-in=kotlin.RequiresOptIn", - "-Xjsr305=strict", - "-Xskip-metadata-version-check", - // need 1.4 support, otherwise there might be problems with Gradle 6.x (it's bundling Kotlin 1.4) - "-Xsuppress-version-warnings" + compilerOptions { + freeCompilerArgs.addAll( + listOf( + "-opt-in=kotlin.RequiresOptIn", + "-Xjsr305=strict", + "-Xskip-metadata-version-check", + // need 1.4 support, otherwise there might be problems with Gradle 6.x (it's bundling Kotlin 1.4) + "-Xsuppress-version-warnings" + ) ) - allWarningsAsErrors = true - languageVersion = language_version - apiVersion = language_version + allWarningsAsErrors.set(true) + languageVersion.set(KotlinVersion.fromVersion(language_version)) + apiVersion.set(KotlinVersion.fromVersion(language_version)) } } diff --git a/examples/plugin/hide-internal-api/build.gradle.kts b/examples/plugin/hide-internal-api/build.gradle.kts index 19b270d2..ed8169ad 100644 --- a/examples/plugin/hide-internal-api/build.gradle.kts +++ b/examples/plugin/hide-internal-api/build.gradle.kts @@ -1,3 +1,4 @@ +import org.jetbrains.kotlin.gradle.dsl.JvmTarget import org.jetbrains.kotlin.gradle.tasks.KotlinCompile import java.net.URI @@ -30,8 +31,8 @@ dependencies { val dokkaOutputDir = "$buildDir/dokka" tasks { - withType<KotlinCompile> { - kotlinOptions.jvmTarget = "1.8" + withType<KotlinCompile>().configureEach { + compilerOptions.jvmTarget.set(JvmTarget.JVM_1_8) } dokkaHtml { outputDirectory.set(file(dokkaOutputDir)) diff --git a/mkdocs/src/doc/docs/developer_guide/plugin-development/introduction.md b/mkdocs/src/doc/docs/developer_guide/plugin-development/introduction.md index 6a487a5e..ad980e49 100644 --- a/mkdocs/src/doc/docs/developer_guide/plugin-development/introduction.md +++ b/mkdocs/src/doc/docs/developer_guide/plugin-development/introduction.md @@ -25,6 +25,10 @@ It has pre-configured dependencies, publishing and signing of your artifacts. At a bare minimum, Dokka requires `Kotlin Gradle Plugin` and `dokka-core` dependencies: ```kotlin +import org.jetbrains.kotlin.gradle.dsl.JvmTarget +import org.jetbrains.kotlin.gradle.tasks.KotlinCompile + + plugins { kotlin("jvm") version "<kotlin_version>" } @@ -33,8 +37,8 @@ dependencies { compileOnly("org.jetbrains.dokka:dokka-core:<dokka_version>") } -tasks.withType<KotlinCompile> { - kotlinOptions.jvmTarget = "1.8" +tasks.withType<KotlinCompile>().configureEach { + compilerOptions.jvmTarget.set(JvmTarget.JVM_1_8) } ``` |