Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Force specific JDK, kover and binary compatibility #2

Merged
merged 5 commits into from
Aug 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 29 additions & 13 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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
36 changes: 35 additions & 1 deletion korlibs-simple/api/android/korlibs-simple.api
Original file line number Diff line number Diff line change
@@ -1,4 +1,38 @@
public final class korlibs/simple/Simple {
public final class korlibs/simple/SimpleList : java/util/List, kotlin/jvm/internal/markers/KMappedMarker {
public fun <init> ()V
public fun add (I)Z
public fun add (II)V
public synthetic fun add (ILjava/lang/Object;)V
public synthetic fun add (Ljava/lang/Object;)Z
public fun addAll (ILjava/util/Collection;)Z
public fun addAll (Ljava/util/Collection;)Z
public fun clear ()V
public fun contains (I)Z
public final fun contains (Ljava/lang/Object;)Z
public fun containsAll (Ljava/util/Collection;)Z
public fun get (I)Ljava/lang/Integer;
public synthetic fun get (I)Ljava/lang/Object;
public fun getSize ()I
public fun indexOf (I)I
public final fun indexOf (Ljava/lang/Object;)I
public fun isEmpty ()Z
public fun iterator ()Ljava/util/Iterator;
public fun lastIndexOf (I)I
public final fun lastIndexOf (Ljava/lang/Object;)I
public fun listIterator ()Ljava/util/ListIterator;
public fun listIterator (I)Ljava/util/ListIterator;
public fun remove (I)I
public synthetic fun remove (I)Ljava/lang/Object;
public fun remove (Ljava/lang/Object;)Z
public fun removeAll (Ljava/util/Collection;)Z
public fun replaceAll (Ljava/util/function/UnaryOperator;)V
public fun retainAll (Ljava/util/Collection;)Z
public fun set (II)Ljava/lang/Integer;
public synthetic fun set (ILjava/lang/Object;)Ljava/lang/Object;
public final fun size ()I
public fun sort (Ljava/util/Comparator;)V
public fun subList (II)Ljava/util/List;
public fun toArray ()[Ljava/lang/Object;
public fun toArray ([Ljava/lang/Object;)[Ljava/lang/Object;
}

36 changes: 35 additions & 1 deletion korlibs-simple/api/jvm/korlibs-simple.api
Original file line number Diff line number Diff line change
@@ -1,4 +1,38 @@
public final class korlibs/simple/Simple {
public final class korlibs/simple/SimpleList : java/util/List, kotlin/jvm/internal/markers/KMappedMarker {
public fun <init> ()V
public fun add (I)Z
public fun add (II)V
public synthetic fun add (ILjava/lang/Object;)V
public synthetic fun add (Ljava/lang/Object;)Z
public fun addAll (ILjava/util/Collection;)Z
public fun addAll (Ljava/util/Collection;)Z
public fun clear ()V
public fun contains (I)Z
public final fun contains (Ljava/lang/Object;)Z
public fun containsAll (Ljava/util/Collection;)Z
public fun get (I)Ljava/lang/Integer;
public synthetic fun get (I)Ljava/lang/Object;
public fun getSize ()I
public fun indexOf (I)I
public final fun indexOf (Ljava/lang/Object;)I
public fun isEmpty ()Z
public fun iterator ()Ljava/util/Iterator;
public fun lastIndexOf (I)I
public final fun lastIndexOf (Ljava/lang/Object;)I
public fun listIterator ()Ljava/util/ListIterator;
public fun listIterator (I)Ljava/util/ListIterator;
public fun remove (I)I
public synthetic fun remove (I)Ljava/lang/Object;
public fun remove (Ljava/lang/Object;)Z
public fun removeAll (Ljava/util/Collection;)Z
public fun replaceAll (Ljava/util/function/UnaryOperator;)V
public fun retainAll (Ljava/util/Collection;)Z
public fun set (II)Ljava/lang/Integer;
public synthetic fun set (ILjava/lang/Object;)Ljava/lang/Object;
public final fun size ()I
public fun sort (Ljava/util/Comparator;)V
public fun subList (II)Ljava/util/List;
public fun toArray ()[Ljava/lang/Object;
public fun toArray ([Ljava/lang/Object;)[Ljava/lang/Object;
}

4 changes: 0 additions & 4 deletions korlibs-simple/src/korlibs/simple/Simple.kt

This file was deleted.

18 changes: 18 additions & 0 deletions korlibs-simple/src/korlibs/simple/SimpleList.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package korlibs.simple

class SimpleList : List<Int> {
override val size: Int = 1
override fun get(index: Int): Int = 0
override fun isEmpty(): Boolean = false
override fun iterator(): Iterator<Int> = listIterator(0)
override fun listIterator(): ListIterator<Int> = listIterator(0)
override fun listIterator(index: Int): ListIterator<Int> = List(1) { 0 }.listIterator(index)
override fun subList(fromIndex: Int, toIndex: Int): List<Int> = SimpleList()
override fun lastIndexOf(element: Int): Int = if (element == 0) 0 else -1
override fun indexOf(element: Int): Int = if (element == 0) 0 else -1
override fun containsAll(elements: Collection<Int>): Boolean {
elements.toSet().forEach { if (!contains(it)) return false }
return true
}
override fun contains(element: Int): Boolean = (0 until size).any { this[it] == element }
}
10 changes: 10 additions & 0 deletions korlibs-simple/test/korlibs/simple/SimpleListTest.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package korlibs.simple

import kotlin.test.*

class SimpleListTest {
@Test
fun test() {
val list = SimpleList()
}
}
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
Loading