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

Issue building with 3.5.0 #244

Closed
DylanSale opened this issue Oct 23, 2023 · 5 comments
Closed

Issue building with 3.5.0 #244

DylanSale opened this issue Oct 23, 2023 · 5 comments

Comments

@DylanSale
Copy link

I have a fairly complex build set up so forgive me if this is a false alert, any help would be appreciated though.

I am using gradle to build. We have a common library that is kotlin multiplatform, and it is used to compile to js and jvm. Quarkus then imports that library (I'm not sure this is at all relevant).

I am using Kotlin 1.8.22 with Quarkus 3.2.1 on Gradle 8.4

Everything works fine with fmodel 3.4.0.

When upgrading the fmodel libraries to use 3.5.0, I am getting this error when building:

java.lang.IllegalStateException: FATAL ERROR: Could not find "kotlin" in [/Users/dylan/Library/Application Support/kotlin/daemon]
	at org.jetbrains.kotlin.ir.backend.js.KlibKt$resolverLogger$1.fatal(klib.kt:111)
	at org.jetbrains.kotlin.library.KotlinLibrarySearchPathResolver.resolve(SearchPathResolver.kt:171)
	at org.jetbrains.kotlin.library.SearchPathResolver.resolve$default(SearchPathResolver.kt:20)
	at org.jetbrains.kotlin.library.SearchPathResolverKt.resolve(SearchPathResolver.kt:29)
	at org.jetbrains.kotlin.library.metadata.resolver.impl.KotlinLibraryResolverImpl$resolveDependencies$2$2.invoke(KotlinLibraryResolverImpl.kt:122)
	at org.jetbrains.kotlin.library.metadata.resolver.impl.KotlinLibraryResolverImpl$resolveDependencies$2$2.invoke(KotlinLibraryResolverImpl.kt:122)
	at kotlin.sequences.TransformingSequence$iterator$1.next(Sequences.kt:210)
	at kotlin.sequences.FilteringSequence$iterator$1.calcNext(Sequences.kt:170)
	at kotlin.sequences.FilteringSequence$iterator$1.hasNext(Sequences.kt:194)
	at kotlin.sequences.TransformingSequence$iterator$1.hasNext(Sequences.kt:214)
	at kotlin.sequences.FilteringSequence$iterator$1.calcNext(Sequences.kt:169)
	at kotlin.sequences.FilteringSequence$iterator$1.hasNext(Sequences.kt:194)
	at kotlin.sequences.SequencesKt___SequencesKt.toCollection(_Sequences.kt:787)
	at kotlin.sequences.SequencesKt___SequencesKt.toMutableList(_Sequences.kt:817)
	at kotlin.sequences.SequencesKt___SequencesKt.toList(_Sequences.kt:808)
	at org.jetbrains.kotlin.library.metadata.resolver.impl.KotlinLibraryResolverImpl.resolveDependencies(KotlinLibraryResolverImpl.kt:135)
	at org.jetbrains.kotlin.library.metadata.resolver.impl.KotlinLibraryResolverImpl.resolveWithDependencies(KotlinLibraryResolverImpl.kt:44)
	at org.jetbrains.kotlin.ir.backend.js.JsLibraryResolverKt.jsResolveLibraries(JsLibraryResolver.kt:51)
	at org.jetbrains.kotlin.ir.backend.js.ModulesStructure.<init>(klib.kt:476)
	at org.jetbrains.kotlin.ir.backend.js.PrepareAnalyzedSourceModuleKt.prepareAnalyzedSourceModule(prepareAnalyzedSourceModule.kt:26)
	at org.jetbrains.kotlin.ir.backend.js.PrepareAnalyzedSourceModuleKt.prepareAnalyzedSourceModule$default(prepareAnalyzedSourceModule.kt:16)
	at org.jetbrains.kotlin.cli.js.K2JsIrCompiler.processSourceModule(K2JsIrCompiler.kt:435)
	at org.jetbrains.kotlin.cli.js.K2JsIrCompiler.doExecute(K2JsIrCompiler.kt:295)
	at org.jetbrains.kotlin.cli.js.K2JSCompiler.doExecute(K2JSCompiler.java:181)
	at org.jetbrains.kotlin.cli.js.K2JSCompiler.doExecute(K2JSCompiler.java:72)
	at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.kt:100)
	at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.kt:46)
	at org.jetbrains.kotlin.cli.common.CLITool.exec(CLITool.kt:101)
	at org.jetbrains.kotlin.daemon.CompileServiceImpl.compile(CompileServiceImpl.kt:1486)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:568)
	at java.rmi/sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:360)
	at java.rmi/sun.rmi.transport.Transport$1.run(Transport.java:200)
	at java.rmi/sun.rmi.transport.Transport$1.run(Transport.java:197)
	at java.base/java.security.AccessController.doPrivileged(AccessController.java:712)
	at java.rmi/sun.rmi.transport.Transport.serviceCall(Transport.java:196)
	at java.rmi/sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:587)
	at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:828)
	at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:705)
	at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
	at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:704)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
	at java.base/java.lang.Thread.run(Thread.java:833)

I'm wondering if there's something in the klib that is possibly causing a conflict or error?

@idugalic
Copy link
Member

Hi @DylanSale. I am investigating. It is strange :)

Dependency upgrades

I'm comparing the versions of dependencies between 3.4.0 and 3.5.0

Switching FModle to Kotlin 1.9.0 might be the potential cause of the issue. I wonder if you can try to build your project with Kotlin 1.9.0+ ?

3.4.0

[versions]
coroutines = "1.6.4"
dokka = "1.8.10"
kotest = "5.5.4"
kotest-plugin = "5.5.4"
kotlin = "1.8.10"
arrow = "1.1.5"

3.5.0

[versions]
coroutines = "1.7.2"
dokka = "1.8.20"
kotest = "5.6.2"
kotest-plugin = "5.6.2"
kotlin = "1.9.0"
arrow = "1.2.0"

Build updates

By Comparing the build.gradle.kts across these two versions I have not noticed any change that could cause this.

3.4.0:

@Suppress("DSL_SCOPE_VIOLATION") // https://youtrack.jetbrains.com/issue/KTIJ-19369
plugins {
    id(libs.plugins.kotlin.multiplatform.get().pluginId)
    id(libs.plugins.kotest.multiplatform.get().pluginId)
    id(libs.plugins.dokka.get().pluginId)
    id("maven-publish")
    id("signing")
}

kotlin {
    jvmToolchain(17)
    jvm()

    js(IR) {
        browser()
        nodejs()
    }

    linuxX64()

    mingwX64()

    macosX64()
    macosArm64()

    tvos()
    tvosSimulatorArm64()

    watchosArm32()
    watchosArm64()
    watchosX86()
    watchosX64()
    watchosSimulatorArm64()

    iosX64()
    iosArm64()
    iosArm32()
    iosSimulatorArm64()

    sourceSets {
        val commonMain by getting {
            dependencies {
                implementation(libs.coroutines.core)
            }
        }
        val commonTest by getting {
            dependencies {
                implementation(libs.kotest.frameworkEngine)
                implementation(libs.kotest.assertionsCore)
            }
        }
        val jvmTest by getting {
            dependencies {
                runtimeOnly(libs.kotest.runnerJUnit5)
            }
        }
    }

    // Dokka
    val dokkaHtml by tasks.getting(org.jetbrains.dokka.gradle.DokkaTask::class)

    val javadocJar: TaskProvider<Jar> by tasks.registering(Jar::class) {
        dependsOn(dokkaHtml)
        archiveClassifier.set("javadoc")
        from(dokkaHtml.outputDirectory)
    }

    signing {
        useInMemoryPgpKeys(
            System.getenv("GPG_PRIVATE_KEY"),
            System.getenv("GPG_PRIVATE_PASSWORD")
        )
        sign(publishing.publications)
    }

    val signingTasks = tasks.withType<Sign>()
    tasks.withType<AbstractPublishToMaven>().configureEach {
        dependsOn(signingTasks)
    }

    // Publishing
    publishing {

        repositories {
            maven {
                name = "ossrh"
                setUrl {
                    if (version.toString().endsWith("SNAPSHOT"))
                        "https://s01.oss.sonatype.org/content/repositories/snapshots"
                    else "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/"
                }
                credentials {
                    username = System.getenv("MAVEN_USERNAME")
                    password = System.getenv("MAVEN_PASSWORD")
                }
            }
        }

        publications {
            withType<MavenPublication> {
                artifact(javadocJar)
                pom {
                    name.set("fmodel-domain")
                    description.set("Fmodel provides just enough tactical Domain-Driven Design patterns, optimised for Event Sourcing and CQRS. The domain model library is fully isolated from the application layer and API-related concerns. It represents a pure declaration of the program logic.")
                    url.set("https://github.com/fraktalio/fmodel")
                    licenses {
                        license {
                            name.set("The Apache License, Version 2.0")
                            url.set("http://www.apache.org/licenses/LICENSE-2.0")
                        }
                    }
                    inceptionYear.set("2021")
                    issueManagement {
                        system.set("Github")
                        url.set("https://github.com/fraktalio/fmodel/issues")
                    }
                    developers {
                        developer {
                            id.set("idugalic")
                            name.set("Ivan Dugalic")
                            email.set("ivan.dugalic@fraktalio.com")
                        }
                    }
                    scm {
                        connection.set("scm:git:git://github.com/fraktalio/fmodel.git")
                        developerConnection.set("scm:git:git@github.com:fraktalio/fmodel.git")
                        url.set("https://github.com/fraktalio/fmodel.git")
                    }
                }
            }
        }
    }

}

3.5.0

@Suppress("DSL_SCOPE_VIOLATION") // https://youtrack.jetbrains.com/issue/KTIJ-19369
plugins {
    id(libs.plugins.kotlin.multiplatform.get().pluginId)
    id(libs.plugins.kotest.multiplatform.get().pluginId)
    id(libs.plugins.dokka.get().pluginId)
    id("maven-publish")
    id("signing")
}

kotlin {
    jvmToolchain(17)
    jvm()

    js(IR) {
        browser()
        nodejs()
    }

    linuxX64()

    mingwX64()

    macosX64()
    macosArm64()

    tvos()
    tvosSimulatorArm64()

    watchosArm32()
    watchosArm64()
    watchosX64()
    watchosSimulatorArm64()

    iosX64()
    iosArm64()
    iosSimulatorArm64()

    sourceSets {
        val commonMain by getting {
            dependencies {
                implementation(libs.coroutines.core)
            }
        }
        val commonTest by getting {
            dependencies {
                implementation(libs.kotest.frameworkEngine)
                implementation(libs.kotest.assertionsCore)
            }
        }
        val jvmTest by getting {
            dependencies {
                runtimeOnly(libs.kotest.runnerJUnit5)
            }
        }
    }

    // Dokka
    val dokkaHtml by tasks.getting(org.jetbrains.dokka.gradle.DokkaTask::class)

    val javadocJar: TaskProvider<Jar> by tasks.registering(Jar::class) {
        dependsOn(dokkaHtml)
        archiveClassifier.set("javadoc")
        from(dokkaHtml.outputDirectory)
    }

    signing {
        useInMemoryPgpKeys(
            System.getenv("GPG_PRIVATE_KEY"),
            System.getenv("GPG_PRIVATE_PASSWORD")
        )
        sign(publishing.publications)
    }

    val signingTasks = tasks.withType<Sign>()
    val testTasks = tasks.withType<AbstractTestTask>()

    tasks.withType<AbstractPublishToMaven>().configureEach {
        dependsOn(signingTasks)
    }
    signingTasks.configureEach {
        dependsOn(testTasks)
    }

    // Publishing
    publishing {

        repositories {
            maven {
                name = "ossrh"
                setUrl {
                    if (version.toString().endsWith("SNAPSHOT"))
                        "https://s01.oss.sonatype.org/content/repositories/snapshots"
                    else "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/"
                }
                credentials {
                    username = System.getenv("MAVEN_USERNAME")
                    password = System.getenv("MAVEN_PASSWORD")
                }
            }
        }

        publications {
            withType<MavenPublication> {
                artifact(javadocJar)
                pom {
                    name.set("fmodel-domain")
                    description.set("Fmodel provides just enough tactical Domain-Driven Design patterns, optimised for Event Sourcing and CQRS. The domain model library is fully isolated from the application layer and API-related concerns. It represents a pure declaration of the program logic.")
                    url.set("https://github.com/fraktalio/fmodel")
                    licenses {
                        license {
                            name.set("The Apache License, Version 2.0")
                            url.set("http://www.apache.org/licenses/LICENSE-2.0")
                        }
                    }
                    inceptionYear.set("2021")
                    issueManagement {
                        system.set("Github")
                        url.set("https://github.com/fraktalio/fmodel/issues")
                    }
                    developers {
                        developer {
                            id.set("idugalic")
                            name.set("Ivan Dugalic")
                            email.set("ivan.dugalic@fraktalio.com")
                        }
                    }
                    scm {
                        connection.set("scm:git:git://github.com/fraktalio/fmodel.git")
                        developerConnection.set("scm:git:git@github.com:fraktalio/fmodel.git")
                        url.set("https://github.com/fraktalio/fmodel.git")
                    }
                }
            }
        }
    }

}

@DylanSale
Copy link
Author

Thanks for your help. I was concerned that it was due to the kotlin version.

Unfortunately I'm using Quarkus which has pinned the kotlin version on the project. When I upgrade that then I'll test fmodel 3.5.0 again.

@idugalic
Copy link
Member

Great. Thanks! In the meantime, I will check on how to test the compatibility of Fmodel libs with different Kotlin versions.

@idugalic
Copy link
Member

Hi @DylanSale ,

Have you solved the issue?
If yes, we would like to close this issue, otherwise, I can invest more time investigating a potential cause.

@DylanSale
Copy link
Author

Hi, unfortunately not, I have moved to another employer so won't be able to test this however. Feel free to close.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants