Skip to content

Commit

Permalink
Migrate to build logic to Kotlin 2.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
alllex committed Dec 3, 2024
1 parent e4c1e84 commit aaac754
Show file tree
Hide file tree
Showing 5 changed files with 479 additions and 783 deletions.
4 changes: 2 additions & 2 deletions buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ plugins {
}

dependencies {
val kotlinVer = "1.8.22"
val kotlinVer = "2.1.0"
implementation(platform(kotlin("bom", kotlinVer)))
implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVer")
implementation("org.jetbrains.kotlin:kotlin-allopen:$kotlinVer")
implementation("org.jetbrains.kotlinx:kotlinx-benchmark-plugin:0.4.8")
implementation("org.jetbrains.dokka:dokka-gradle-plugin:1.9.0")
implementation("org.jetbrains.dokka:dokka-gradle-plugin:1.9.20")
}
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
package buildsrc.conventions

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

plugins {
kotlin("jvm")
}

tasks.withType<KotlinCompile>().configureEach {
kotlinOptions.languageVersion = "1.7"
kotlinOptions.apiVersion = "1.7"
kotlin {
compilerOptions {
languageVersion = KotlinVersion.KOTLIN_1_7
apiVersion = KotlinVersion.KOTLIN_1_7
}
}

tasks.withType<Test>().configureEach {
tasks.test {
useJUnitPlatform()
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package buildsrc.conventions

import org.jetbrains.kotlin.gradle.targets.jvm.KotlinJvmTarget
import org.jetbrains.kotlin.gradle.dsl.KotlinVersion

/** Base configuration for all Kotlin/Multiplatform projects */

Expand All @@ -11,12 +12,10 @@ plugins {
kotlin {
jvmToolchain(8)

targets.configureEach {
compilations.configureEach {
kotlinOptions {
apiVersion = "1.7"
languageVersion = "1.7"
}
kotlin {
compilerOptions {
languageVersion = KotlinVersion.KOTLIN_1_7
apiVersion = KotlinVersion.KOTLIN_1_7
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,49 +20,7 @@ kotlin {

macosX64()
macosArm64()
ios() // shortcut for iosArm64, iosX64

// Native targets all extend commonMain and commonTest.
//
// Some targets (ios, tvos, watchos) are shortcuts provided by the Kotlin DSL, that
// provide additional targets, except for 'simulators' which must be defined manually.
// https://kotlinlang.org/docs/multiplatform-share-on-platforms.html#use-target-shortcuts
//
// common
// └── native
// ├── linuxX64
// ├── mingwX64
// ├── macosX64
// ├── macosArm64
// └── ios (shortcut)
// ├── iosArm64
// └── iosX64

@Suppress("UNUSED_VARIABLE")
sourceSets {
val commonMain by getting
val commonTest by getting

val nativeMain by creating { dependsOn(commonMain) }
val nativeTest by creating { dependsOn(commonTest) }

// Linux
val linuxX64Main by getting { dependsOn(nativeMain) }
val linuxX64Test by getting { dependsOn(nativeTest) }

// Windows - MinGW
val mingwX64Main by getting { dependsOn(nativeMain) }
val mingwX64Test by getting { dependsOn(nativeTest) }

// Apple - macOS
val macosArm64Main by getting { dependsOn(nativeMain) }
val macosArm64Test by getting { dependsOn(nativeTest) }

val macosX64Main by getting { dependsOn(nativeMain) }
val macosX64Test by getting { dependsOn(nativeTest) }

// Apple - iOS
val iosMain by getting { dependsOn(nativeMain) }
val iosTest by getting { dependsOn(nativeTest) }
}
iosX64()
iosArm64()
}
Loading

0 comments on commit aaac754

Please sign in to comment.