Skip to content

Commit

Permalink
Migrate kotlinOptions to compilerOptions (#2883)
Browse files Browse the repository at this point in the history
  • Loading branch information
Goooler authored Mar 8, 2023
1 parent 62c9807 commit 14c05d7
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 14 deletions.
Original file line number Diff line number Diff line change
@@ -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 {
Expand All @@ -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))
}
}
5 changes: 3 additions & 2 deletions examples/plugin/hide-internal-api/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import java.net.URI

Expand Down Expand Up @@ -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))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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>"
}
Expand All @@ -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)
}
```

Expand Down

0 comments on commit 14c05d7

Please sign in to comment.