Skip to content

Commit

Permalink
avoid kotlinCompile
Browse files Browse the repository at this point in the history
  • Loading branch information
ursjoss committed May 24, 2024
1 parent 8bd8798 commit f2215f6
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 44 deletions.
37 changes: 11 additions & 26 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import org.jetbrains.dokka.gradle.DokkaTask
import org.jetbrains.dokka.gradle.DokkaTaskPartial
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import java.net.URI

buildscript {
Expand All @@ -24,6 +23,10 @@ plugins {
jacoco
}

kotlin {
jvmToolchain(libs.versions.java.get().toInt())
}

jacoco {
toolVersion = libs.versions.jacoco.get()
}
Expand Down Expand Up @@ -51,6 +54,8 @@ nexusPublishing {
}
}

val kotlinSrcSet = "/src/main/kotlin"

tasks {
val deleteOutFolderTask by registering(Delete::class) {
delete("out")
Expand All @@ -72,14 +77,6 @@ tasks {
}
}

kotlin {
jvmToolchain {
languageVersion.set(JavaLanguageVersion.of(libs.versions.java.get()))
}
}

val kotlinSrcSet = "/src/main/kotlin"

subprojects.forEach { subProject ->
if (subProject.name in setOf("kris-core", "kris-io")) {
apply {
Expand All @@ -99,23 +96,16 @@ subprojects.forEach { subProject ->
}
}
}

subProject.tasks {
val kotlinVersion = libs.versions.kotlin.get()
val kotlinApiLangVersion = kotlinVersion.subSequence(0, 3).toString()
val jvmTargetVersion = libs.versions.java.get()
withType<KotlinCompile>().configureEach {
kotlinOptions {
named("compileKotlin", org.jetbrains.kotlin.gradle.tasks.KotlinCompilationTask::class.java) {
val kotlinApiLangVersion = org.jetbrains.kotlin.gradle.dsl.KotlinVersion.fromVersion(libs.versions.kotlin.get().take(3))
compilerOptions {
apiVersion = kotlinApiLangVersion
languageVersion = kotlinApiLangVersion
jvmTarget = jvmTargetVersion
freeCompilerArgs = freeCompilerArgs + listOf("-opt-in=kotlin.RequiresOptIn")
freeCompilerArgs.add("-opt-in=kotlin.RequiresOptIn")
}
}
withType<JavaCompile>().configureEach {
sourceCompatibility = jvmTargetVersion
targetCompatibility = jvmTargetVersion
}

withType<Test> {
useJUnitPlatform {
includeEngines("junit-jupiter", "kotest")
Expand All @@ -128,11 +118,6 @@ subprojects.forEach { subProject ->
}
}
}
kotlin {
jvmToolchain {
languageVersion.set(JavaLanguageVersion.of(libs.versions.java.get()))
}
}
}
}

Expand Down
6 changes: 1 addition & 5 deletions gradle-plugins/publishing/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import org.jetbrains.kotlin.gradle.tasks.KotlinJvmCompile

@Suppress("DSL_SCOPE_VIOLATION")
plugins {
`java-gradle-plugin`
Expand All @@ -8,9 +6,7 @@ plugins {
}

kotlin {
jvmToolchain {
languageVersion.set(JavaLanguageVersion.of(libs.versions.java.get()))
}
jvmToolchain(libs.versions.java.get().toInt())
}

dependencies {
Expand Down
4 changes: 1 addition & 3 deletions gradle-plugins/verification/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@ dependencies {
}

kotlin {
jvmToolchain {
languageVersion.set(JavaLanguageVersion.of(libs.versions.java.get()))
}
jvmToolchain(libs.versions.java.get().toInt())
}

detekt {
Expand Down
10 changes: 0 additions & 10 deletions subprojects/kris-guide/kris-guide.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,18 +1,8 @@
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

plugins {
`java-library`
kotlin("jvm")
}

tasks {
withType<KotlinCompile>().configureEach {
kotlinOptions {
jvmTarget = libs.versions.java.get()
}
}
}

dependencies {
testImplementation(project(":kris-io"))

Expand Down

0 comments on commit f2215f6

Please sign in to comment.