Kotlin / dukat

Converter of <any kind of declarations> to Kotlin external declarations
553 stars 44 forks source link

Runtime errors and compile time errors using Dukat #352

Open Vampire opened 4 years ago

Vampire commented 4 years ago

As the #javascript channel on the Kotlin Slack is not very active, I'm asking here in hope it is ok.

After I got my EPIPE problem (#103 / #351) solved, I'm a step further, but highly confused. Maybe you can shed some light.

Given the example project I showed in #103.

Vampire commented 4 years ago

I found that you can do

configure<NodeJsRootExtension> {
    versions.dukat.version = "0.5.7"
}

to use a newer Dukat version than the default 0.0.12, but with that, I now get

Exception in thread "main" java.lang.Exception: unknown TopLevelEntity:
        at org.jetbrains.dukat.tsmodel.factory.ConvertProtobufKt.convert(convertProtobuf.kt:463)
        at org.jetbrains.dukat.tsmodel.factory.ConvertProtobufKt.convert(convertProtobuf.kt:330)
        at org.jetbrains.dukat.tsmodel.factory.ConvertProtobufKt.convert(convertProtobuf.kt:819)
        at org.jetbrains.dukat.tsmodel.factory.ConvertProtobufKt.convert(convertProtobuf.kt:824)
        at org.jetbrains.dukat.ts.translator.JsRuntimeByteArrayTranslator.parse(JsRuntimeByteArrayTranslator.kt:17)
        at org.jetbrains.dukat.ts.translator.JsRuntimeByteArrayTranslator.translate(JsRuntimeByteArrayTranslator.kt:21)
        at org.jetbrains.dukat.ts.translator.JsRuntimeByteArrayTranslator.translate(JsRuntimeByteArrayTranslator.kt:9)
        at org.jetbrains.dukat.translatorString.TranslateModuleKt.translateModule(translateModule.kt:142)
        at org.jetbrains.dukat.cli.CliKt.translateBinaryBundle(cli.kt:56)
        at org.jetbrains.dukat.cli.CliKt.main(cli.kt:313)
vlsi commented 4 years ago

Just in case, here's a workable action written in Kotlin JS 1.4.0-rc: https://github.com/burrunan/gradle-cache-action

ivakub commented 4 years ago

https://youtrack.jetbrains.com/issue/KT-40927

Vampire commented 4 years ago

Thanks @vlsi, someone else also pointed your action to me. Actually in the meantime I was able to at least get my basic import setFailed; fun main() = setFailed("boo hoo") action to work properly with 1.3.72, Dukat 0.5.7 and a @zeit/ncc based packaging. There it was mainly the missing @JsModule annotation. But I fear I need 802 more workarounds to get all back up and working :-/

vlsi commented 4 years ago

But I fear I need 802 more workarounds to get all back up and working :-/

Great you got it working :)

The number of workarounds depends on the packages you use, and @JsModule is often misplaced (it is often missing or wrong) :(