Robert Jaros
03/01/2024, 3:46 PM> Task :kilua:compileTestDevelopmentExecutableKotlinJs
w: KLIB resolver: The same 'unique_name=dev.kilua:kilua' found in more than one library: /home/rjaros/git/kilua/kilua/build/classes/kotlin/js/main, /home/rjaros/git/kilua/kilua/build/libs/kilua-js-0.0.1.klib
> Task :kilua:compileTestDevelopmentExecutableKotlinWasmJs
w: KLIB resolver: The same 'unique_name=dev.kilua:kilua' found in more than one library: /home/rjaros/git/kilua/kilua/build/classes/kotlin/wasmJs/main, /home/rjaros/git/kilua/kilua/build/libs/kilua-wasm-js-0.0.1.klib
Robert Jaros
03/05/2024, 6:56 PMRobert Jaros
03/06/2024, 7:05 AMZac Sweers
03/09/2024, 4:59 AMKtSourceModule.moduleName
reports the source set name now whereas ModuleDescriptor.name
in K1 reported the project name. Considering this name participates in name mangling, is this expected behavior?Nick
03/11/2024, 5:25 AM> Task :controls:wasmJsJar
kotlinx.coroutines.JobCancellationException: Parent job is Cancelling; job=ScopeCoroutine{Cancelling}@7415da4b
Caused by: kotlin.io.NoSuchFileException: /###/doodle/Core/doodle_repo_image_shorter.png: The source file doesn't exist.
at kotlin.io.FilesKt__UtilsKt.copyRecursively(Utils.kt:294)
at kotlin.io.FilesKt__UtilsKt.copyRecursively$default(Utils.kt:288)
at org.jetbrains.dokka.base.renderers.FileWriter$copyFromDirectory$2.invokeSuspend(FileWriter.kt:56)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
at kotlinx.coroutines.internal.LimitedDispatcher.run(LimitedDispatcher.kt:42)
at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:95)
at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:570)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:749)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:677)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:664)
kotlinx.coroutines.JobCancellationException: Parent job is Cancelling; job=ScopeCoroutine{Cancelling}@7415da4b
Caused by: kotlin.io.NoSuchFileException: /###/doodle/Core/doodle_repo_image_shorter.png: The source file doesn't exist.
at kotlin.io.FilesKt__UtilsKt.copyRecursively(Utils.kt:294)
Failed to write org.jetbrains.dokka.base.renderers.FileWriter@47422d22. Parent job is Cancelling
Failed to write org.jetbrains.dokka.base.renderers.FileWriter@47422d22. Parent job is Cancelling
Nick
03/11/2024, 5:32 AMWebAssembly.instantiateStreaming(): Compiling function #17996:"io.nacular.doodle.layout.constraints.impl.Const..." failed: call[1] expected type (ref null 3131), found local.get of type (ref null 348) @+1486748
CompileError: WebAssembly.instantiateStreaming(): Compiling function #17996:"io.nacular.doodle.layout.constraints.impl.Const..." failed: call[1] expected type (ref null 3131), found local.get of type (ref null 348) @+1486748
i've narrowed it down to a trivial case:
simple app within src/wasmJsMain
import io.nacular.doodle.application.Application
import io.nacular.doodle.application.application
import io.nacular.doodle.core.Display
import io.nacular.doodle.core.view
import io.nacular.doodle.drawing.Color.Companion.Red
import io.nacular.doodle.drawing.paint
import io.nacular.doodle.geometry.Size
import io.nacular.doodle.layout.constraints.constrain
import io.nacular.doodle.layout.constraints.fill
import org.kodein.di.instance
class TestApp(display: Display): Application {
init {
display += view {
size = Size(100)
render = {
rect(bounds.atOrigin, fill = Red.paint)
}
}
display.layout = constrain(display.first(), fill) // this line pulls in the class that fails to compile
}
override fun shutdown() {
// no-op
}
}
fun main() {
application {
TestApp(instance())
}
}
build.gradle.kts
@file:OptIn(ExperimentalWasmDsl::class)
import org.jetbrains.kotlin.gradle.targets.js.dsl.ExperimentalWasmDsl
group = "org.example"
version = "1.0-SNAPSHOT"
plugins {
kotlin("multiplatform") version "2.0.0-Beta4"
}
repositories {
mavenCentral()
maven ("<https://oss.sonatype.org/content/repositories/snapshots>") // snapshots
mavenLocal ()
}
kotlin {
wasmJs {
compilations.all {
kotlinOptions {
moduleKind = "umd"
sourceMapEmbedSources = "always"
}
}
browser {
testTask { enabled = false }
}
binaries.executable()
}
sourceSets {
val doodleVersion = "0.11.0-SNAPSHOT"
commonMain.dependencies {
implementation("io.nacular.doodle:core:$doodleVersion")
}
val wasmJsMain by getting {
dependencies {
implementation("io.nacular.doodle:browser:$doodleVersion")
}
}
}
}
Ola Adolfsson
03/12/2024, 8:45 AMZac Sweers
03/12/2024, 10:09 PMjdiaz
03/19/2024, 8:55 PMCarlos Monzon
03/22/2024, 7:09 AMOliver.O
03/25/2024, 10:56 AMcompile*Kotlin*
with: java.lang.IllegalArgumentException: Missing extension point: org.jetbrains.kotlin.diagnosticSuppressor in container {}
Will happily try again once a matching Compose compiler plugin for Beta5 is available.
EDIT: Plugin is there. Now Beta5 works nicely as well.Oliver.O
03/25/2024, 2:07 PMYang
03/27/2024, 10:51 AMKotlinCompile
totalling 30m 17.942s
-> 46m 7.145s
• KaptGenerateStubsTask
totalling 8m 32.377s
-> 23m 35.496s
• KaptWithoutKotlincTask
totalling 9m 56.293s
-> 11m 14.002s
• KspTaskJvm
totalling 6m 19.561s
-> 22m 56.832s
Looking at the individual modules / tasks the ones that are significant slower with K2 seem quite random. E.g. while some bigger module are 40% faster with K2, many tiny modules’ KotlinCompile tasks are order of magnitude slower with K2 e.g. 0.5s
> 33s
.
I’ll dig a bit more and create an issue on youtrack.dniHze
04/01/2024, 8:09 AMDmitry Stakhov
04/02/2024, 7:56 AMsealed class T {
object A: T()
object B: T()
object C: T()
}
fun foo(param: T) {
when (param) {
is A -> { fun1() }
is B, C -> { fun2() }
}
}
fun test() {
foo(mockk<T.C>())
}
the test function throws the kotlin.NoWhenBranchMatchedException
with Kotlin 2.0.0-Beta5
The fix is easy
1. remove mocking -> foo(T.C)
2. add the second is explicitly -> is B, is C -> {}
Is it expected (should we always write is for each branch in the same line) or it should be reported as bug?Dmitry Stakhov
04/02/2024, 10:37 AMimport sun.security.x509.X509CertImpl
import sun.security.x509.X509CertInfo
...
val info = X509CertInfo().apply {
set(X509CertInfo.VALIDITY, interval)
...
}
return X509CertImpl(info)
K1 works
K2 throws compilation errors:
Unresolved reference 'set'.
None of the following candidates is applicable:
constructor(p0: ByteArray!): X509CertImpl
constructor(p0: DerValue!): X509CertImpl
constructor(p0: InputStream!): X509CertImpl
Gat Tag
04/07/2024, 3:36 AMCarter
04/09/2024, 1:15 PM* What went wrong:
java.lang.ExceptionInInitializerError (no error message)
> org.jetbrains.kotlin.konan.target.KonanTarget$IOS_ARM32
Gat Tag
04/10/2024, 12:05 PMColin White
04/11/2024, 10:14 PMRC1
? I’m seeing a few in my multiplatform project after upgrading to RC1
. For instance, I can’t reference LocalWindowInfo.current.containerSize
from Compose Multiplatform. I can try to create a minimal repro and file an issue if it’s not already knownClaus Rørbech
04/12/2024, 12:20 PMIrClassReferenceImpl
and IrVarargImpl
? I cannot find builders for those and seems like constructors have been internalized in favor of factory methods from 1.9 to 2.0. This prevents my compiler plugin to run with 2.0.0-RC if it was build with 1.9.x, but runs fine with 2.0.0-RC if also compiled with 2.0.0-RC1
. These IR elements are in org.jetbrains.kotlin.ir.expressions.impl
so maybe not supposed to be constructed directly, but just cannot find other ways similarly to ex. factory methods in ExpressionHelpers.kt. Are there a better way to create `IrClassReference`s and `IrVararg`s or is it just expected to have to provide a version of the plugin compiled individually for 1.9 and 2.0?Zac Sweers
04/13/2024, 7:14 PMCLOVIS
04/13/2024, 7:49 PMkotlin {
jvm { withJava() }
sourceSets.commonMain.dependencies { … }
sourceSets.commonTest.dependencies { … }
}
and I'm getting
> Configure project :app
w: The following Kotlin source sets were configured but not added to any Kotlin compilation:
* commonMain
* commonTest
You can add a source set to a target's compilation by connecting it with the compilation's default source set using 'dependsOn'.
See <https://kotl.in/connecting-source-sets>
Did something change in the way platforms are declared? This should definitely generate a jvmMain
which depends on commonMain
.Javier
04/14/2024, 1:15 PMCarlos Monzon
04/16/2024, 9:18 AMgavvvr
04/16/2024, 1:37 PMRaise<Error>
"`context()` receiver".
It stopped working since Kotlin 2.0.0-Beta3 and does not work up to 2.0.0-RC1. What can be wrong?
Here is a detailed SO post.Zac Sweers
04/16/2024, 3:04 PMZac Sweers
04/16/2024, 5:29 PMScreen
is an expect/actual interface that, on androidMain
, extends android's Parcelable
interface
• AndroidScreen
is a regular interface in an android library project that extends Screen
• OpenUrlScreen
is an actual
class in androidMain
that implements both and leverages the @Parcelize
plugin
@Parcelize
actual data class OpenUrlScreen actual constructor(actual val url: String) : Screen, AndroidScreen
At a glance, it seems that the parcelize plugin is generating bytecode that doesn't name the parameter, and because it doesn't match what Kotlin expects from the metadata (which indicates they're a named param), it falls over. However, the original declaration is in java, so why would it matter?
public void writeToParcel(@NonNull Parcel dest, @WriteFlags int flags);
Let me know if I should file a bug for this (and where, as I know Google maintains this plugin but I'm not sure if this is bug with the compiler or parcelize)Zac Sweers
04/16/2024, 6:06 PMEugen Martynov
04/18/2024, 6:55 AMrequireNotNull
still treated as possible to return null