Skip to content

Commit c611999

Browse files
authored
build: Clean up the K2 build config (#135)
- Set LV `KotlinVersion.KOTLIN_2_1`: this means we're effectively compiling with K2 - Set `JvmTarget.JVM_1_8`: no real reason to bump it to 11 imo, but in case let me know the rationale - Enabled all the native targets by using `kotlin.native.enableKlibsCrossCompilation`
1 parent 0d8025b commit c611999

File tree

2 files changed

+47
-19
lines changed

2 files changed

+47
-19
lines changed

build.gradle.kts

+32-13
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
1-
@file:OptIn(ExperimentalKotlinGradlePluginApi::class)
2-
31
import io.github.petertrr.configurePublishing
42
import io.github.petertrr.ext.booleanProperty
5-
import io.gitlab.arturbosch.detekt.Detekt
6-
import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi
73
import org.jetbrains.kotlin.gradle.ExperimentalWasmDsl
84
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
95
import org.jetbrains.kotlin.gradle.dsl.KotlinVersion
@@ -26,16 +22,16 @@ kotlin {
2622
explicitApi()
2723

2824
compilerOptions {
29-
apiVersion = KotlinVersion.KOTLIN_1_9
30-
languageVersion = KotlinVersion.KOTLIN_1_9
25+
apiVersion = KotlinVersion.KOTLIN_2_1
26+
languageVersion = KotlinVersion.KOTLIN_2_1
3127
}
3228

3329
jvm {
3430
compilations.configureEach {
3531
compileTaskProvider.configure {
3632
compilerOptions {
3733
// Minimum bytecode level is 52
38-
jvmTarget = JvmTarget.JVM_11
34+
jvmTarget = JvmTarget.JVM_1_8
3935

4036
// Output interfaces with default methods
4137
freeCompilerArgs.addAll(
@@ -81,11 +77,36 @@ kotlin {
8177
nodejs()
8278
}
8379

80+
// Tier 1
81+
macosX64()
82+
macosArm64()
83+
iosSimulatorArm64()
84+
iosX64()
85+
iosArm64()
86+
87+
// Tier 2
8488
linuxX64()
8589
linuxArm64()
90+
watchosSimulatorArm64()
91+
watchosX64()
92+
watchosArm32()
93+
watchosArm64()
94+
tvosSimulatorArm64()
95+
tvosX64()
96+
tvosArm64()
97+
98+
// Tier 3
8699
mingwX64()
87-
macosX64()
88-
macosArm64()
100+
androidNativeArm32()
101+
androidNativeArm64()
102+
androidNativeX86()
103+
androidNativeX64()
104+
watchosDeviceArm64()
105+
106+
// Deprecated.
107+
// Should follow the same route as official Kotlin libraries
108+
@Suppress("DEPRECATION")
109+
linuxArm32Hfp()
89110

90111
sourceSets {
91112
commonTest {
@@ -105,9 +126,7 @@ detekt {
105126
}
106127

107128
tasks {
108-
withType<Detekt> {
109-
named("check") {
110-
dependsOn(this@withType)
111-
}
129+
check {
130+
dependsOn(detekt)
112131
}
113132
}

gradle.properties

+15-6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
1-
kotlin.code.style=official
2-
org.gradle.jvmargs=-Xmx2g -XX:MaxMetaspaceSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
3-
org.gradle.caching=true
4-
# https://kotlinlang.org/docs/whatsnew19.html#preview-of-gradle-configuration-cache
5-
org.gradle.configuration-cache=false
6-
org.gradle.parallel=true
1+
#########################
2+
# Gradle settings
3+
#########################
4+
org.gradle.jvmargs = -Xmx2g -XX:MaxMetaspaceSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
5+
org.gradle.parallel = true
6+
org.gradle.caching = true
7+
org.gradle.configuration-cache = false
8+
9+
#########################
10+
# Kotlin settings
11+
#########################
12+
kotlin.code.style = official
13+
14+
# Kotlin/Native
15+
kotlin.native.enableKlibsCrossCompilation = true

0 commit comments

Comments
 (0)