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 a10e6aa commit 28f419e
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 51 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/CODECOV.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
- { name: Set up JDK, uses: actions/setup-java@v4, with: { distribution: "${{ env.JAVA_DISTRIBUTION }}", java-version: "${{ env.JAVA_VERSION }}" } }
- { name: Prepare Gradle, uses: gradle/actions/setup-gradle@d9c87d481d55275bb5441eef3fe0e46805f9ef70 } # https://github.com/gradle/actions/releases/tag/v3.5.0
- { name: Start gradle, run: ./gradlew }
- { name: Code coverage, run: ./gradlew koverXmlReportJvm }
- { name: Code coverage, run: ./gradlew koverXmlReport }
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v4.0.1
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/TEST.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
#- { outputKey: testJs, os: ubuntu-latest, testTask: "wasmBrowserTest", buildTasks: "jsNodeTest jsBrowserTest" }
- { outputKey: testJs, os: ubuntu-latest, testTask: "wasmBrowserTest", buildTasks: "jsBrowserTest jsDenoTest" }
- { outputKey: testAndroid, os: ubuntu-latest, enableAndroid: true }
- { outputKey: testJvmMacos, os: macos-latest, testTask: jvmTest }
- { outputKey: testJvmMacos, os: macos-latest, testTask: jvmTest apiCheck }
- { outputKey: testJvmLinux, os: ubuntu-latest, testTask: jvmTest, precompileTask: compileTestKotlinJvm, enableKotlinNative: true, enableSandbox: true, e2e: true }
- { outputKey: testJvmWindows, os: windows-latest, testTask: jvmTest, precompileTask: compileTestKotlinJvm }
#if: ${{ needs.changes.outputs[matrix.outputKey] == 'true' }}
Expand Down
59 changes: 39 additions & 20 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ 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" // apiDump / apiCheck
id("org.jetbrains.kotlinx.binary-compatibility-validator") version "0.16.2"
id("org.jetbrains.dokka") version "1.9.20"
`maven-publish`
signing
Expand All @@ -34,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 @@ -57,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 @@ -345,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 @@ -973,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 @@ -990,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 @@ -1111,11 +1127,14 @@ allprojects {
afterEvaluate {
tasks.withType(org.gradle.api.tasks.testing.Test::class) {
//println("TEST-TASK: $this")
jvmArgs(
"--add-opens", "java.base/java.nio=ALL-UNNAMED",
//"--add-opens", "java.base/jdk.incubator.foreign=ALL-UNNAMED",
"--add-opens", "java.base/sun.nio.ch=ALL-UNNAMED",
)
if (JDK_VERSION.majorVersion.toInt() >= 9) {
jvmArgs(
"-XX:+IgnoreUnrecognizedVMOptions",
"--add-opens", "java.base/java.nio=ALL-UNNAMED",
//"--add-opens", "java.base/jdk.incubator.foreign=ALL-UNNAMED",
"--add-opens", "java.base/sun.nio.ch=ALL-UNNAMED",
)
}
}
}
}
Expand All @@ -1136,4 +1155,4 @@ allprojects {

apiValidation {
ignoredProjects.addAll(listOf(rootProject.name))
}
}
24 changes: 0 additions & 24 deletions korlibs-image/api/jvm/korlibs-image.api
Original file line number Diff line number Diff line change
Expand Up @@ -2618,10 +2618,6 @@ public final class korlibs/image/color/RgbaArray : java/util/List, kotlin/jvm/in
public fun add-XDoMphA (II)V
public fun addAll (ILjava/util/Collection;)Z
public fun addAll (Ljava/util/Collection;)Z
public synthetic fun addFirst (Ljava/lang/Object;)V
public fun addFirst-KatOrx8 (Lkorlibs/image/color/RGBA;)V
public synthetic fun addLast (Ljava/lang/Object;)V
public fun addLast-KatOrx8 (Lkorlibs/image/color/RGBA;)V
public static final synthetic fun box-impl ([I)Lkorlibs/image/color/RgbaArray;
public fun clear ()V
public static fun constructor-impl ([I)[I
Expand Down Expand Up @@ -2663,10 +2659,6 @@ public final class korlibs/image/color/RgbaArray : java/util/List, kotlin/jvm/in
public synthetic fun remove (I)Ljava/lang/Object;
public fun remove (Ljava/lang/Object;)Z
public fun removeAll (Ljava/util/Collection;)Z
public synthetic fun removeFirst ()Ljava/lang/Object;
public fun removeFirst-PozHwmI ()Lkorlibs/image/color/RGBA;
public synthetic fun removeLast ()Ljava/lang/Object;
public fun removeLast-PozHwmI ()Lkorlibs/image/color/RGBA;
public fun replaceAll (Ljava/util/function/UnaryOperator;)V
public fun retainAll (Ljava/util/Collection;)Z
public synthetic fun set (ILjava/lang/Object;)Ljava/lang/Object;
Expand Down Expand Up @@ -6807,10 +6799,6 @@ public final class korlibs/image/text/RichTextData : java/util/List, korlibs/dat
public fun add (Lkorlibs/image/text/RichTextData$Line;)Z
public fun addAll (ILjava/util/Collection;)Z
public fun addAll (Ljava/util/Collection;)Z
public synthetic fun addFirst (Ljava/lang/Object;)V
public fun addFirst (Lkorlibs/image/text/RichTextData$Line;)V
public synthetic fun addLast (Ljava/lang/Object;)V
public fun addLast (Lkorlibs/image/text/RichTextData$Line;)V
public fun clear ()V
public final fun component1 ()Ljava/util/List;
public final fun component2 ()Lkorlibs/image/text/RichTextData$Style;
Expand Down Expand Up @@ -6848,10 +6836,6 @@ public final class korlibs/image/text/RichTextData : java/util/List, korlibs/dat
public fun remove (I)Lkorlibs/image/text/RichTextData$Line;
public fun remove (Ljava/lang/Object;)Z
public fun removeAll (Ljava/util/Collection;)Z
public synthetic fun removeFirst ()Ljava/lang/Object;
public fun removeFirst ()Lkorlibs/image/text/RichTextData$Line;
public synthetic fun removeLast ()Ljava/lang/Object;
public fun removeLast ()Lkorlibs/image/text/RichTextData$Line;
public fun replaceAll (Ljava/util/function/UnaryOperator;)V
public fun retainAll (Ljava/util/Collection;)Z
public synthetic fun set (ILjava/lang/Object;)Ljava/lang/Object;
Expand Down Expand Up @@ -6982,10 +6966,6 @@ public final class korlibs/image/text/RichTextDataPlacements : java/util/List, k
public fun add (Lkorlibs/image/text/RichTextDataPlacements$Placement;)Z
public fun addAll (ILjava/util/Collection;)Z
public fun addAll (Ljava/util/Collection;)Z
public synthetic fun addFirst (Ljava/lang/Object;)V
public fun addFirst (Lkorlibs/image/text/RichTextDataPlacements$Placement;)V
public synthetic fun addLast (Ljava/lang/Object;)V
public fun addLast (Lkorlibs/image/text/RichTextDataPlacements$Placement;)V
public fun clear ()V
public final fun component1 ()Lkorlibs/datastructure/FastArrayList;
public final fun contains (Ljava/lang/Object;)Z
Expand All @@ -7011,10 +6991,6 @@ public final class korlibs/image/text/RichTextDataPlacements : java/util/List, k
public fun remove (I)Lkorlibs/image/text/RichTextDataPlacements$Placement;
public fun remove (Ljava/lang/Object;)Z
public fun removeAll (Ljava/util/Collection;)Z
public synthetic fun removeFirst ()Ljava/lang/Object;
public fun removeFirst ()Lkorlibs/image/text/RichTextDataPlacements$Placement;
public synthetic fun removeLast ()Ljava/lang/Object;
public fun removeLast ()Lkorlibs/image/text/RichTextDataPlacements$Placement;
public fun replaceAll (Ljava/util/function/UnaryOperator;)V
public fun retainAll (Ljava/util/Collection;)Z
public synthetic fun set (ILjava/lang/Object;)Ljava/lang/Object;
Expand Down
12 changes: 7 additions & 5 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,16 @@ pluginManagement {
//maven("https://www.jetbrains.com/intellij-repository/releases")
//maven("https://packages.jetbrains.team/maven/p/ij/intellij-dependencies")
}
}

plugins {
//id("org.jetbrains.amper.settings.plugin").version("0.2.1-dev-470")
//id("org.jetbrains.amper.settings.plugin").version("0.2.2")
//id("org.jetbrains.amper.settings.plugin").version("0.2.3-dev-473")
plugins {
id("com.google.devtools.ksp") version "2.0.0-1.0.23"
//id("org.jetbrains.amper.settings.plugin").version("0.2.1-dev-470")
//id("org.jetbrains.amper.settings.plugin").version("0.2.2")
//id("org.jetbrains.amper.settings.plugin").version("0.2.3-dev-473")
}
}


for (file in rootDir.listFiles()) {
if (file.isDirectory() && File(file, "module.yaml").exists()) {
include(":${file.name}")
Expand Down

0 comments on commit 28f419e

Please sign in to comment.