I forget how to look this up, but if anybody has t...
# kotlin-native
k
I forget how to look this up, but if anybody has the Xcode 11 beta, to use the Xcode debug we’ll need the Xcode UUID. I’m not installing Xcode 11 beta just yet, but if we can find that UUID I can add to debugger. See towards bottom: https://github.com/touchlab/xcode-kotlin/blob/master/Kotlin.ideplugin/Contents/Info.plist
t
Xcode 11:
07BAA045-2DD3-489F-B232-D1D4F8B92D2D
I was already wondering why this plugin stopped working in the latest Xcode
k
Awesome, thanks! Will update later today, but you can just add to the list and it should work
t
Xcode 11 now detects the plugin, but it doesn’t have code highlighting and breakpoints don’t work either. I used your Kotlin Xcode Sync to add the Kotlin files. So I am not able to get it working correctly, but it could be that I did something wrong somewhere.
k
Assume you restarted Xcode? I'll install beta and try to fix, but won't be able to till I get home. Sunday-ish
👍 1
t
Yes, I restarted Xcode after running the setup script and the Xcode sync
k
Don't know. It's possible Xcode is disabling outside code stylers and source files, but I'm guessing it's more likely they've changed config file fomats
*formats
t
@kpgalligan is there a chance you could have a look at Xcode 11? I would really appreciate it because the plugin is really helpful!
k
Trying to install on my “other” laptop now. Worried about Xcode beta on the main machine, but will see how it goes. Are you also on macos beta?
t
Yes, I'm on beta 4 on my Mac mini. I'm developing my app completely in the new SwiftUI (and Kotlin :) ), so I really need the beta. Sometimes I get some crashes in Android Studio, but for the rest I haven't experienced very bad issues on the Mac beta.
There is a bug in Android Studio which will cause it to crash when typing. (Some issues with the fonts or so). There is a workaround mentioned here using custom VM options: https://youtrack.jetbrains.com/issue/JBR-1639 Apart from that I have not run into other major issues yet
k
Ugh. A fair amount of fixing needed. I got the plugin to load, and debugging “works” as in you can add breakpoints, but the code style isn’t happening (it’s all just plain text) and lldb needs python3, so some source changes needed
Progress
OK. Debugging works. Source highlighting doesn’t. I don’t know why, but since this is all undocumented I think the smart move is to wait until Xcode 11 comes out of Beta.
k
Is this possible in the Xcode 10.3? The line by line debugging with Kotlin.
Wow, how do I do that?
k
Xcode 10.3? Sure. That also does source coloring.
👍 1
@Thomas For the record, “A fair amount of fixing needed” turned out to be not so much. The lldb python script needed exactly 1 line changed, and the error message pointed right to it and the problem. Adding the xcode version to the config file enabled breakpoints. Coloring I spent a while digging around and experimenting, but as that’s the least problematic of the features, I’m guessing Xcode is now just looking in a different place, or resolves them in a different way. Since there are many coloring plugins (Rust, Lua, GraphQL, etc) I’m thinking of being lazy and letting somebody else sort that out.
t
@kpgalligan That’s great to hear, thank you. I updated the plugin on my Mac. It looks like Xcode detected the plugin. I added the Kotlin source sets using the KotlinXcodeSync plugin, but for some reason the breakpoints don’t seem to work. I am not sure what I did wrong. The DroidconKotlin sample also doesn’t pause at a breakpoint.
p
For XCode 10.3 (10G8) I opened a pull request. There was a missing key in Info.plist
k
@Paul Idstein Thanks. Guess I’m running a version ahead and behind (11b4 and 10.2.x). @Thomas is that with 11 or 10.3?
t
@kpgalligan with Xcode 11 beta 4
k
@Thomas “It looks like Xcode detected the plugin” by this you mean it asked if you wanted to load the Bundle? “but for some reason the breakpoints don’t seem to work” & “The DroidconKotlin sample also doesn’t pause at a breakpoint.” You can set new breakpoints, but the execution doesn’t stop at them? I’d manually check that things are installed where you expect. The “new” version uses
~/.lldbinit-Xcode
instead of
~/.lldbinit
. You may want to get rid of
~/.lldbinit
or at least the line in there loading the lldb file. I don’t think that would cause anything to break, but check.
Are you on latest Droidcon? It’s 1.3.41. That screenshot I sent is from Droidcon on a breakpoint. I am not on Catalina. A member of my team is and I can pull him aside later to see if his is working.
t
@kpgalligan I just removed all the files of the plugin (including both lldbinit files). I reinstalled the plugin using setup.sh and opened Xcode and clicked load bundle. Then I set a breakpoint in somewhere in the Droidcon code but it just doesn’t do anything. It does not stop at that line. I am on the latest commit of the DroidconKotlin master branch.
I got this and clicked load bundle. So the plugin is installed correctly.
Here’s an example. See the red circles with the log. The breakpoints didn’t do anything, unfortunately.
Just restarted the Mac but unfortunately that didn’t help
k
OK. Will get my dev to try it on Catalina and get back to you
👍 1
t
Thanks, really appreciate your help!
k
@Thomas Dev says “works for him”. not coloring but debugging
Tell me about these paths
The Kotlin compiler writes out debug info for the absolute path you compile against. If the source moves, or (possibly?) if you open Xcode with a different virtual path, it might have a different debug path, and the breakpoint won’t “see” anything happen
For example, I still build the Sqliter library locally. If I’m using that as a dependency in a project, I can add the original Sqliter source to Xcode and debug it. The published library has debug info for my local machine. It’s an issue I’ve broached with the team. Will likely be addressed in the future (somehow).
Yeah, here’s what mine looks like
If you’re building somewhere else, and if that “somewhere else” has a different local path, and this is some kind of drive share, that probably won’t work.
t
I have no idea why those paths are so different. I don’t have any special setup, just using a Mac mini. I cloned the DroidconKotlin project into
/Users/thomas/GitHub/DroidconKotlin
. Then I ran the
xcodeSync
task from Android Studio:
Copy code
17:04:06: Executing task 'xcodeSync'...

Executing tasks: [xcodeSync] in project /System/Volumes/Data/Users/thomas/GitHub/DroidconKotlin/sessionize/lib


> Configure project :sessionize:app
Kotlin Multiplatform Projects are an experimental feature.

> Task :sessionize:lib:xcodeSync

BUILD SUCCESSFUL in 1s
1 actionable task: 1 executed
17:04:08: Task execution finished 'xcodeSync'.
I don’t know why it shows
/System/Volumes/Data/
.
k
Apparently Catalina does different things with drives: /System/Volumes/Data/
Not that the “Low Disk Space Bug” is relevant, but the drive changes are
OK. Need to think about this. I’m guessing the full paths are added with xcodeSync, but Xcode sees them as different paths and makes that huge relative reference. Ugh.
This will be difficult to sort out without Catalina, so it’ll be a while
I think for now you can just add the kotlin files manually in Xcode. However, when you do that, Xcode will either want to treat them as resources or source files, which means it’ll either try to copy them into the app bundle, or try to compile them (It can’t and will give a warning). You’ll need to go in and manually remove them from “Copy Bundle Resources” or “Copile Sources” after adding them to the project
message has been deleted
t
OK, thanks for your help. I’ll try to add the Kotlin files manually and see what that does.