Skip to content

Commit

Permalink
build(Gradle): Use older syntax for an enum's entries
Browse files Browse the repository at this point in the history
This avoids the need for `KotlinCompile` task configuration here.

Signed-off-by: Sebastian Schuberth <[email protected]>
  • Loading branch information
sschuberth committed Feb 20, 2024
1 parent 24c029f commit 5457ed0
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 15 deletions.
14 changes: 0 additions & 14 deletions buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@
import org.gradle.accessors.dm.LibrariesForLibs

import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.dsl.KotlinVersion
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

private val Project.libs: LibrariesForLibs
get() = extensions.getByType()
Expand Down Expand Up @@ -56,15 +54,3 @@ tasks.withType<JavaCompile>().configureEach {
sourceCompatibility = maxKotlinJvmTarget.target
targetCompatibility = maxKotlinJvmTarget.target
}

tasks.withType<KotlinCompile>().configureEach {
val customCompilerArgs = listOf(
"-opt-in=kotlin.ExperimentalStdlibApi"
)

compilerOptions {
freeCompilerArgs.addAll(customCompilerArgs)
languageVersion = KotlinVersion.KOTLIN_1_9
jvmTarget = maxKotlinJvmTarget
}
}
2 changes: 1 addition & 1 deletion buildSrc/src/main/kotlin/ort-kotlin-conventions.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ detekt {

val javaVersion = JavaVersion.current()
val maxKotlinJvmTarget = runCatching { JvmTarget.fromTarget(javaVersion.majorVersion) }
.getOrDefault(JvmTarget.entries.max())
.getOrDefault(enumValues<JvmTarget>().max())

val mergeDetektReportsTaskName = "mergeDetektReports"
val mergeDetektReports = if (rootProject.tasks.findByName(mergeDetektReportsTaskName) != null) {
Expand Down

0 comments on commit 5457ed0

Please sign in to comment.