Anyone have success with the kotlin xcode plugin? ...
# multiplatform
p
Anyone have success with the kotlin xcode plugin? I install it and load the bundle, then xcode immediately closes. It does not seem to be loaded when I reopen. There is no syntax highlighting/ breakpoints.
k
Version? Mac and xcode
“then xcode immediately closes”, this may be the “Open Project” dialog under another window and/or on a different monitor
p
mac: 10.14.6 xcode: 10.3 checked for open windows and xcode was gone from the app switcher
k
Yeah, it doesn’t show up when it’s just that window, which is part of the confusion
Run it again and that window should pop right up. It’s possible it fully shuts down I guess, but it seems to come up really fast when running again (faster than usual)
Also, I assume you have the updates from yesterday. That added 10.3 support
p
get "konan_lldb.py found in ~/.lldbinit-Xcode" when running setup.sh again
goes straight to project dialog
k
That’s fine. It’s just saying it’s there
I mean, for “latest updates”, you cloned or pulled after 10.3 added
p
pulled latest master
about an hour ago
k
OK
Project open, and kotlin does not show up colored and you can’t apply breakpoints still?
p
yes, still nothing
FWIW, I've never had any luck with the VIM plugin either
k
Kotlin files show up as regular text?
p
yeas
k
Can you screenshot that?
p
actually, It is working now - I can jump to defs. that wasn't working before
nm, spoke too soon
k
You’re try to go from Swift (presumably) to Kotlin?
p
k
That’s styled. Not well styled, but you definitely have the plugin
Click the number 29. It should add a breakpoint there
?
p
Sorry, had to step out. Still no luck. That particular line isn't hit with current code. Will keep trying
k
“Still no luck” Can you set breakpoints, or you just haven’t run any code that would hit them?
p
set tens of break points and debugger does not stop. swift code is debugging
k
How are you adding kotlin files?
Xcode needs to point at the exact files you compiled. You cannot copy them to a different folder.
p
the kotlin xcode sync plugin
k
There is an issue I thought was related to catalina but perhaps not: https://github.com/touchlab/KotlinXcodeSync/issues/6
Xcode resolving different paths than what the kotlin compiler writes
You can try adding files through xcode directly rather than the sync gradle plugin
Can you find the path in xcode for the kotlin file?
Screenshot the top/right, if you can see it
Example from the bug. Crazy paths.
p
k
Paths don’t look wrong visually. The Kotlin compiler writes out paths for the debugger, and those need to match. If you compiled the kotlin code locally, and you’re using the debug framework (not release), then I don’t know what else. It’ll be very difficult to sort out, unless open source. I looked on github, and “open-library” does not appear to be.
The “plugin” essentially wires together some lldb things, but doesn’t really “do” a lot else. If the paths don’t match for some reason, the breakpoints won’t trigger. We’d need to write some kind of script to back into the compiled code and see what the paths are, but that’s nowhere near the current priority list, unless this gets more common (but this happened yesterday with Catalina, so perhaps it’ll be more common?)
p
how can debug/release framework be specified?
k
That’s kind of between you and xcode
Depends how you wired it up, depends on your settings, etc
p
looks like there I've used a "packForXcode" task and it gets it from the "XCODE_CONFIGURATION" property, and defaults to debug
I'll check that and make sure it is debug
k
I’d clone or create another smaller project and see if breakpoints work there. You could also try the droidcon project, although don’t run
pod install
. Sorting that out. If you hit breakpoints on other projects, it’s config. If not, something else is happening, although I can’t imagine what (other than the sync plugin messing up paths)
I’m making a very simple sample app, just to check the debugger. Will publish a bit later
(tonight, probably)
Well shit. I made a simple app to debug, and it didn’t work. Changed 1.3.41 to 1.3.40 and it works.
I’ve tried some at 1.3.41 and they worked, so I don’t thinks it’s quite as simple as that, but something is happening
p
what are steps to downgrade? can you just run setup.sh from old version?
k
No, I mean Kotlin 1.3.41 isn’t putting out the same debug info as 1.3.40, at least not by default
I changed nothing about the project or xcode
Other than the Kotlin version
p
wait, working for me now! I was getting the release framework apparently
and still on 1.3.41
k
Yeah, weird. Let me recompile with 1.3.41 again. If it starts working I’m closing the laptop
p
f yeah, this is a huge help. thanks for your help, and the plugin
k
Now 1.3.41 is working for me
Anyway, good luck. Work in that droidcon talk…
👍 1
*on
p
fyi, I'm still getting intermittent success with debugging kotlin in xcode. not sure why
k
Stopping at breakpoints, or advancing doesn’t line up as expected?
p
stopping at breakpoints works sometimes, other time it doesn't. Currently have no idea why. Maybe it is my setup, but just not consistent
k
I had the same issue when I first set up a test project last week. Wasn’t working, then it suddenly was. The “plugin” doesn’t do a whole lot, so this will probably a difficult one to sort out, but I have some ideas.