Skip to content

Don't crash compiling modules with NPM JS dependencies #725

@bnorm

Description

@bnorm

I'm getting the following build failure when trying to use kotlinx-datetime on the JS side of Zipline:

Caused by: java.lang.IllegalArgumentException: No topological ordering is possible for [./88b0986a7186d029-atomicfu-js-ir.js, ./elevated-model.js, ./elevated-worker.js, ./kotlinx-serialization-kotlinx-serialization-json-js-ir.js, ./zipline-root-zipline.js, ./kotlinx.coroutines-kotlinx-coroutines-core-js-ir.js, ./kotlin-kotlinx-atomicfu-runtime-js-ir.js, ./Kotlin-DateTime-library-kotlinx-datetime-js-ir.js, ./kotlin-kotlin-stdlib-js-ir.js, ./kotlinx-serialization-kotlinx-serialization-core-js-ir.js]
	at app.cash.zipline.loader.internal.TopologicalSortKt.topologicalSort(topologicalSort.kt:61)
	at app.cash.zipline.loader.ZiplineManifest$Companion.create(ZiplineManifest.kt:153)
	at app.cash.zipline.loader.ZiplineManifest$Companion.create$default(ZiplineManifest.kt:143)
	at app.cash.zipline.gradle.ZiplineCompiler.writeManifest(ZiplineCompiler.kt:167)
	at app.cash.zipline.gradle.ZiplineCompiler.compile(ZiplineCompiler.kt:53)
	at app.cash.zipline.gradle.ZiplineCompileTask.task(ZiplineCompileTask.kt:101)

I ran Gradle in debug mode and the problem library seems to be kotlinx-datetime. This library depends on @js-joda/core which is not in the module map when creating the manifest. So when building the topological list, the dependencies of kotlinx-datetime are never satisfied resulting in the exception.

Is this a known limitation of Zipline? That you cannot use libraries like kotlinx-datetime because of such dependencies? I can create a small reproducing project if that is needed.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions