kcron-common icon indicating copy to clipboard operation
kcron-common copied to clipboard

Cron.parseAndBuild does not properly resolve for JS and Native

Open mgroth0 opened this issue 2 years ago • 10 comments

It resolves properly for android and jvm

But on JS and Native, it says it "requires dependency" on the core module.

mgroth0 avatar Mar 18 '24 21:03 mgroth0

Depending directly on the core module fixes this. But I imagine this is unintended?

mgroth0 avatar Mar 18 '24 21:03 mgroth0

Thank you for highlighting a problem. Do you use the last version 0.10.5 in both cases?

Scogun avatar Mar 19 '24 06:03 Scogun

So, I tested the library for mingwX64:

plugins {
    kotlin("multiplatform") version "1.9.23"
}

repositories {
    mavenCentral()
}

kotlin {
    mingwX64 {
        binaries.executable()
    }
    sourceSets {
        val mingwX64Main by getting {
            dependencies {
                implementation("com.ucasoft.kcron:kcron-common:0.10.5")
            }
        }
    }
}
import com.ucasoft.kcron.Cron

fun main() {
    println(Cron.parseAndBuild("* 12 ? * *").expression)
}

Works as expected. You don't need core module here. Could you confirm or clarify?

Scogun avatar Mar 19 '24 10:03 Scogun

I am using kotlin version 2.0.0-Beta4 with JS and macosarm64. Maybe the issue only happens in those contexts?

mgroth0 avatar Mar 19 '24 14:03 mgroth0

I reproduced it like this:

plugins {
    kotlin("multiplatform") version("2.0.0-Beta4")
}

kotlin {
    jvm()
    macosArm64()
    js {
        browser()
    }
}

repositories {
    mavenCentral()
}

dependencies {
    val dep = "com.ucasoft.kcron:kcron-common:0.10.5"
    add("commonMainImplementation",dep)
}

JS Module

import com.ucasoft.kcron.Cron

fun main() {
    println(Cron.parseAndBuild("* 12 ? * *").expression)
}

mgroth0 avatar Mar 19 '24 15:03 mgroth0

Cannot access class 'com.ucasoft.kcron.core.builders.Builder'. Check your module classpath for missing or conflicting dependencies.

mgroth0 avatar Mar 19 '24 15:03 mgroth0

Yes, I can confirm that with Kotlin 2.0.0-Beta4 version there is the issue. Looks like it has problem with dependencies resolving. I will create a ticket on JetBrains board. Thank you!

Scogun avatar Mar 19 '24 15:03 Scogun

Here is a link on JetBrains board: KT-66707 Dependency library cannot be resolved

Scogun avatar Mar 19 '24 15:03 Scogun

Great, thank you again for creating the YouTrack issue!

mgroth0 avatar Mar 19 '24 16:03 mgroth0

Hello @mgroth0! I just released new version of Kcron - 0.13.2 The issue is fixed via workaround, so I don't close the issue until KT-66707 is not closed.

Scogun avatar May 15 '24 12:05 Scogun