https://kotlinlang.org logo
#touchlab-tools
Title
# touchlab-tools
p

Pavel Dektev

02/01/2023, 11:48 AM
Hi everyone! I am going threw this tutorial on KMMBridge and can’t get the SPM dependency to work. I have a private Github repo. I created an .netrc file and filled it with my login and a new PAT. When I try to add a package I paste the github link into a search box and for some reason Xcode does not use the .netrc file and asks to provide a creadentials. But this also does not work. What am I doing wrong?
Screen Shot 2023-01-31 at 16.44.25.png
k

kpgalligan

02/01/2023, 12:51 PM
Sorry, had typed a reply in the other thread but never sent I guess…
My guess is the PAT doesn’t have whatever permissions Xcode needs. I think because anybody on our team doing docs had already authed Xcode, we never created a PAT for that.
That does look like Xcode is telling you that you can’t access that repo.
I get the same pop up if I use a PAT without the necessary permissions
Screen Shot 2023-02-01 at 8.01.49 AM.png,Screen Shot 2023-02-01 at 7.59.30 AM.png
In this case I left off “repo”.
I replaced the PAT with another one with those 4 permissions and it works now.
p

Pavel Dektev

02/01/2023, 1:37 PM
Thanks a lot for answering! I am not sure what you mean by
In this case I left off “repo”.
You mean when creating a PAT leave repo unchecked? Like that?
k

kpgalligan

02/01/2023, 1:50 PM
I mean, when I created the PAT that failed, I left repo unchecked. When I mad a new one that worked, I had the 4 in that screenshot (
admin:public_key
,
write:discussion
,
repo
,
user
)
So, summary, I created a new PAT with those 4 permissions, and that PAT worked.
p

Pavel Dektev

02/01/2023, 1:52 PM
I have all of these checked, but it still won’t work
k

kpgalligan

02/01/2023, 1:54 PM
Then I’m not sure what’s wrong. It’s an Xcode -> Github issue. Something is wrong with permissions on the Github side would be my guess. I’d make sure you can clone that repo with that account and PAT. Also maybe check the Github panel in Xcode to make sure it’s not trying to use SSH.
p

Pavel Dektev

02/01/2023, 1:55 PM
Thanks. I will keep trying
Maybe that I don’t have some of the rights in repo itself? I am not the owner, but a contributor
k

kpgalligan

02/01/2023, 2:03 PM
I would guess that’s potentially the issue. I don’t know what Xcode needs to do with those permissions. I’ll add that to internal discussions. I would bet everybody that’s tested with our repos is a full member of the org with write or management permissions.
p

Pavel Dektev

02/01/2023, 5:44 PM
Just keeping you posted. Getting an admin rights to the repo does not solve the problem
k

kpgalligan

02/01/2023, 6:44 PM
Well, I’m not sure what’s next. This is an Xcode/GitHub problem that you would have outside of Kotlin, so I’m not really sure what to try. I assume this is a private repo for a reason, so I can’t really try it myself and I doubt I could get access 🙂
p

Pavel Dektev

02/01/2023, 6:45 PM
Tried via SSH and I got threw the Authentication successfully. Now I have a new problem. I get 401 when trying to download the package
k

kpgalligan

02/01/2023, 7:16 PM
Well, netrc uses the PAT, so if the PAT issues aren’t resolved, that’ll still be a problem. 401 is an auth issue, so…
p

Pavel Dektev

02/01/2023, 8:14 PM
Yeah - seems like it
@kpgalligan Hi. I am sorry for bothering you with so many questions. I finally managed to import a package. But I still can’t use it. When I try to import allShared it says that there is no such module. I noticed that in tutorial it shows you the allShared package in project navigator. I have KMMBridgeKickStart there and in it all the modules folders
The Package file for KMMBridgeKickStart looks like this: // swift-tools-version:5.3 import PackageDescription let remoteKotlinUrl = “https://maven.pkg.github.com/Lightricks/Feed-Multiplatform-Client/com/lightricks/kmp/allshared-kmmbridge/0.1.3/allshared-kmmbridge-0.1.3.ziplet remoteKotlinChecksum = “***” let packageName = “KMMBridgeKickStart” let package = Package( name: packageName, platforms: [ .iOS(.v13) ], products: [ .library( name: packageName, targets: [packageName] ), ], targets: [ .binaryTarget( name: packageName, url: remoteKotlinUrl, checksum: remoteKotlinChecksum ) , ] )
And the Package file for allShared is empty
a

Anton Penkrat

02/02/2023, 4:20 PM
@Pavel Dektev Did you solved this issue?
p

Pavel Dektev

02/02/2023, 4:28 PM
Hi @Anton Penkrat. No - I didn’t
a

Anton Penkrat

02/02/2023, 5:59 PM
@Pavel Dektev I added this at the end of kotlin { } block:
p

Pavel Dektev

02/02/2023, 6:04 PM
Should I add it too? What file it is?
In build.gradle of allShared module?
a

Anton Penkrat

02/02/2023, 6:06 PM
yes
p

Pavel Dektev

02/02/2023, 6:06 PM
What it does - renames all the apple frameworks to allShared?
a

Anton Penkrat

02/02/2023, 6:07 PM
Yep. After publish - you will need to reimport SPM in XCode
p

Pavel Dektev

02/02/2023, 6:07 PM
You think naming is the cause of the problem I have?
a

Anton Penkrat

02/02/2023, 6:09 PM
Problem i think is in gradle script that generate incorrect publication result. But it is better to owners to tell
p

Pavel Dektev

02/02/2023, 6:10 PM
I will try it out. Thanks
k

kpgalligan

02/02/2023, 6:27 PM
Some quick questions. This may be a bug in recent releases, but why is the package name
*let* packageName = "KMMBridgeKickStart"
. Was the config changed for
kmmbridge
in gradle? What does that look like? The package name and publishing name should be lower case, so if it’s
allShared
with a cap
S
that will at least upset GitHub packages.
If you’re getting this by following the steps, we’ll need to retry that and fix, as it should Just Work™️
a

Anton Penkrat

02/02/2023, 6:29 PM
We got this independently on each other. Should be easy to reproduce
k

kpgalligan

02/02/2023, 6:30 PM
I mean, we run integration tests and don’t have it, so can you give me more context?
If you’re just running the blog post steps, that’s context enough. If you’re integrating into production builds, there may be confounding factors.
a

Anton Penkrat

02/02/2023, 6:32 PM
Yes. I followed blog post steps for SPM
k

kpgalligan

02/02/2023, 6:40 PM
You're changing the framework name. What was it that you're changing from?
a

Anton Penkrat

02/02/2023, 6:41 PM
Package.swift contained this: let packageName = “KMMBridgeKickStart”
k

kpgalligan

02/02/2023, 6:42 PM
Ah, ok. That's definitely a bug then.
a

Anton Penkrat

02/02/2023, 6:53 PM
@Pavel Dektev Do not forget to add this:
p

Pavel Dektev

02/02/2023, 7:21 PM
Alright. AFK right now - will try it out on Sunday
Thank you guys! It workded
Definitely a bug introduced. Adding GitHub issues…
Thanks for the heads up and help narrowing down. Fix applied to the kickstart repo and issue in KMMBridge: https://github.com/touchlab/KMMBridge/issues/205
7 Views