Skip to content

Commit

Permalink
Fixed migration to kotlin 1.9.20 (#102)
Browse files Browse the repository at this point in the history
- removed deprecated property in gradle.properties
- refactored deprecated property in detekt plugin
- removed explicit depends on in source sets
  • Loading branch information
nulls authored Nov 7, 2023
2 parents cf09426 + cfe9484 commit 6f20edd
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 36 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import org.gradle.kotlin.dsl.withType
fun Project.configureDetekt() {
apply<DetektPlugin>()
configure<DetektExtension> {
config = rootProject.files("detekt.yml")
config.setFrom(rootProject.files("detekt.yml"))
basePath = rootDir.canonicalPath
buildUponDefaultConfig = true
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ kotlin {
}
}
}
val nativeTargets = listOf(linuxX64(), mingwX64(), macosX64())
linuxX64()
mingwX64()
macosX64()

if (hasProperty("disableRedundantTargets") && (property("disableRedundantTargets") as String?) != "false") {
// with this flag we exclude targets that are present on multiple OS to speed up build
Expand All @@ -43,55 +45,22 @@ kotlin {
}
}

/*
* Common structure for MPP libraries:
* common
* |
* nonJs
* / \
* native JVM
* / | \
* linux mingw macos
*/
sourceSets {
all {
languageSettings.optIn("kotlin.RequiresOptIn")
}
val commonMain by getting
val commonTest by getting {
dependencies {
implementation(kotlin("test-common"))
implementation(kotlin("test-annotations-common"))
}
}
val commonNonJsMain by creating {
dependsOn(commonMain)
}
val commonNonJsTest by creating {
dependsOn(commonTest)
}
val jvmMain by getting {
dependsOn(commonNonJsMain)
}
val jvmTest by getting {
dependsOn(commonNonJsTest)
dependencies {
implementation(kotlin("test-junit5"))
implementation("org.junit.jupiter:junit-jupiter-engine:5.10.1")
}
}
val nativeMain by creating {
dependsOn(commonNonJsMain)
}
val nativeTest by creating {
dependsOn(commonNonJsTest)
}
nativeTargets.forEach {
getByName("${it.name}Main").dependsOn(nativeMain)
}
nativeTargets.forEach {
getByName("${it.name}Test").dependsOn(nativeTest)
}
}
}

Expand Down
1 change: 0 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,5 @@ org.gradle.caching=true
kotlin.code.style=official
kotlin.mpp.stability.nowarn=true
kotlin.native.cacheKind.linuxX64=none
kotlin.mpp.hierarchicalStructureSupport=true
# making custom cinterop libraries available in shared source sets
kotlin.mpp.enableCInteropCommonization=true

0 comments on commit 6f20edd

Please sign in to comment.