Skip to content

Commit

Permalink
Update template: codecov + kover + binary compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
soywiz committed Aug 6, 2024
1 parent edc0757 commit 343e122
Show file tree
Hide file tree
Showing 3 changed files with 1,048 additions and 13 deletions.
49 changes: 36 additions & 13 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ import java.util.concurrent.*
plugins {
kotlin("multiplatform") version "2.0.0"
id("com.android.library") version "8.2.2"
id("org.jetbrains.kotlinx.kover") version "0.8.3" apply false
id("org.jetbrains.kotlinx.binary-compatibility-validator") version "0.16.2"
id("org.jetbrains.dokka") version "1.9.20"
`maven-publish`
signing
Expand All @@ -32,7 +34,10 @@ var REAL_VERSION = System.getenv("FORCED_VERSION")

//val REAL_VERSION = System.getenv("FORCED_VERSION") ?: "999.0.0.999"

//val JVM_TARGET = JvmTarget.JVM_1_8
//val JDK_VERSION = org.gradle.api.JavaVersion.VERSION_1_8
val JVM_TARGET = JvmTarget.JVM_1_8
val JDK_VERSION = org.gradle.api.JavaVersion.VERSION_1_8
val GROUP = "com.soywiz"

kotlin {
Expand All @@ -55,7 +60,29 @@ allprojects {
project.apply(plugin = "kotlin-multiplatform")
project.apply(plugin = "android-library")

java.toolchain.languageVersion = JavaLanguageVersion.of(JDK_VERSION.majorVersion)
kotlin.jvmToolchain(JDK_VERSION.majorVersion.toInt())
afterEvaluate {
tasks.withType(Test::class) {
//this.javaLauncher.set()
this.javaLauncher.set(javaToolchains.launcherFor {
// 17 is latest at the current moment
languageVersion.set(JavaLanguageVersion.of(JDK_VERSION.majorVersion))
})
}
}

kotlin {
androidTarget {
this.compilerOptions.jvmTarget.set(JvmTarget.JVM_17)
}
}

android {
compileOptions {
sourceCompatibility = JDK_VERSION
targetCompatibility = JDK_VERSION
}
//signingConfigs {
// debug {
// […]
Expand Down Expand Up @@ -343,19 +370,6 @@ subprojects {
apply(plugin = "maven-publish")
apply(plugin = "signing")

//val JDK_VERSION = 8
//java.toolchain.languageVersion = JavaLanguageVersion.of(JDK_VERSION)
//kotlin.jvmToolchain(JDK_VERSION)
//afterEvaluate {
// tasks.withType(Test::class) {
// //this.javaLauncher.set()
// this.javaLauncher.set(javaToolchains.launcherFor {
// // 17 is latest at the current moment
// languageVersion.set(JavaLanguageVersion.of(JDK_VERSION))
// })
// }
//}

kotlin {
js {
//nodejs()
Expand Down Expand Up @@ -971,10 +985,12 @@ class MicroAmper(val project: Project) {
main = maybeCreate("${name}Main").also {
it.kotlin.srcDirIfExists("src$atName")
it.resources.srcDirIfExists("resources$atName")
it.kotlin.srcDir("build/generated/ksp/$name/${name}Main/kotlin")
},
test = maybeCreate("${name}Test").also {
it.kotlin.srcDirIfExists("test$atName")
it.resources.srcDirIfExists("testResources$atName")
it.kotlin.srcDir("build/generated/ksp/$name/${name}Test/kotlin")
}
)
}
Expand All @@ -988,6 +1004,8 @@ class MicroAmper(val project: Project) {
ssDependsOn("appleNonWatchos", "apple")
ssDependsOn("appleIosTvos", "apple")

maybeCreate("commonMain").kotlin.srcDir("build/generated/ksp/metadata/commonMain/kotlin")

for (platform in kotlinPlatforms) {
val isMacos = platform.startsWith("macos")
val isIos = platform.startsWith("ios")
Expand Down Expand Up @@ -1122,6 +1140,7 @@ allprojects {

subprojects {
plugins.apply("org.jetbrains.dokka")
plugins.apply("org.jetbrains.kotlinx.kover")
}

allprojects {
Expand All @@ -1130,3 +1149,7 @@ allprojects {
offlineMode.set(true)
}
}

apiValidation {
ignoredProjects.addAll(listOf(rootProject.name))
}
Loading

0 comments on commit 343e122

Please sign in to comment.