Hi, I somehow have the feeling that nothing gets g...
# touchlab-tools
u
Hi, I somehow have the feeling that nothing gets generated by SKIE in my shared module. Where would I look for generated code? I’ve checked
build/skie/*
but only found general SKIE stuff in there (except for
SkieTypeAliases.swift
which contains alias for many of my shared module classes) - nothing specific to my project. 🤔
f
Hi! This is a weird behavior because if SKIE fails it usually doesn’t generate anything or crashes the compiler. So my first guess is that it doesn’t see any code for which it should generate extra Swift code. I’d start by checking if the
SkieTypeAliases.swift
contains at least one alias that points to a sealed class or an enum? (Skie generates typealias for every class it processes.) If there is none then create some dummy enum in the shared module with at least one case and try that again. For example:
enum class Foo { a, b, c }
u
Yes, enums are in the
SkieTypeAliases
.
Huh, I think I found the issue:
My shared module skie setup looks like this:
Copy code
// enable SKIE in our own module
        group("our.base.package") {
            EnumInterop.Enabled(true)
            SealedInterop.Enabled(true)
            FlowInterop.Enabled(true)
            SuspendInterop.Enabled(true)
            DefaultArgumentInterop.Enabled(false)
        }
        // ...but not dependencies
        group {
            EnumInterop.Enabled(false)
            SealedInterop.Enabled(false)
            FlowInterop.Enabled(false)
            SuspendInterop.Enabled(false)
            DefaultArgumentInterop.Enabled(false)
        }
However, it looks like our own package name isn’t properly picked up and that’s why SKIE falls back to the second group configuration. As the group parameter’s name is
targetFqNamePrefix
I assumed that you don’t need to pass the full package where all the enums reside, but only the base package and there would be an implicit
.**
inserted at the end (as it’s just a prefix).
When I switch
EnumInterop.Enabled(true)
in the general configuration it generates swift code for enums properly.
Am I understanding the group concept wrongly?
f
oh, you need to swap the two groups because the last one that matches the given declaration has the priority.
so what happened there was that you first enabled some features for your package (which didn’t do anything because that’s the default) and then disabled them everywhere which overridden your previous config. Doing it the other way around will disable it everywhere except for your package
u
ooooh, now that makes sense 😅
yes, that seems to work now! ❤️
Thanks for the help, Filip! 🙏
f
No problem 🙂
u
I just checked docs and didn’t find that piece of information there. Might make sense to add it to the group documentation.
f
Good catch! We changed the documentation quite a bit just before making SKIE open source, so this must have somehow got deleted in the process because I’m pretty sure it was there previously 😄
😅 1