Hi, I am trying to integrate KMP project as a dire...
# touchlab-tools
s
Hi, I am trying to integrate KMP project as a direct source code dependency in Xcode project using xcode kotlin plugin . App builds and runs fine But Breakpoints are working only for the code in
common/src/commonMain
but not working for feature modules. feature modules are added as a dependency on common module using
Copy code
sourceSets {
        val commonMain by getting {
            dependencies {
                // feature module dependencies.
             }
        }
    }
and they are also exported while generating framework using
export()
. This is the command we are running in Xcode run script
./gradlew :common:embedAndSignAppleFrameworkForXcode
. Anything we are missing or any additional setup is needed to get breakpoints work for feature modules?
a
Are you using
implementation()
or
api()
to add your modules to your projects dependencies? On my side I've made an umbrella module just for ios, that uses
export()
and
api()
for every module that I want to use from my Swift code
s
Most of it was
api()
and some were
implementation() + api()
depending on the requirement. The issue was In sourceSets & framework dependencies, we were using published
libs
. We are migrating an existing project to use
xcode-kotlin
which was integrating KMP as a cocoapods. Since I just continued using as it was, that resulted in this error. And the dependencies were of type
release
binary so break-points weren't working, changed them to use
project()
dependencies, break points are working now. Thank you.
k
The only thing that matters is if they are built locally, or if they are built on a server and published. More precisely, the only thing that matters is if the Kotlin is built on your machine, or if it is built on a different machine (and more precisely than that, is the absolute path the same, but I digress, because it is almost certainly not). LLDB debug works with absolute source path info embedded in the binary. So, in summary,
project
dependencies work because they point to source that is built on your machine. Release builds presumably won't have debug info. So, the only thing that matters is where the Kotlin is built. If local, you should be fine, if not, you won't be. The blog post you linked to is a very special case, where KMMBridge and SKIE conspire together to rewrite some metadata that allows frameworks built on a CI server to be debugged. That's a very long explanation, that would be as efficiently delivered as looking at what the code does. Kind of, anyway. I'd need to look at what the code does exactly, then try to explain it, but you know. Only so many hours in the day 😉
👍 1
On, the absolute path is the only thing that matters if you're building a debug build. I would assume a release build isn't debuggable, or at least, not usefully. But, TBH, I forget. I haven't tried it in a long, long time.
s
understood thank you. Just curious to know - If I am using a published debug variant KMP dependency [built on CI & contains debug symbols] as a
libs
dependency, break points works in that case or not?