Hi, I am investigating options for distributing ve...
# multiplatform
r
Hi, I am investigating options for distributing versions of my KMM library to my existing apps. Regarding android, a lot of articles talk about using Maven, however isn’t that open to all? Most companies create closed source code. I assume in that case a solution like Nexus/Artifactory? Or does maven support private uploads?
b
If by maven you mean maven central then no. In itself it's just a public instance of nexus. You can spin up a free jfrog artifactory instance in the cloud to store your artifacts privately
Or just install your own nexus server on raspberry pi or something
r
i work in a corporate environment so just adding servers is not easy.
b
Then go for a free artifactory cloud instance
r
I was thinking maybe i could use CI. The KMM project generates a aar file and then I can pass it to the android project and have it commited into that repo
not thought it through yet!
b
Isn't this free tier sufficient for your needs?
r
thats not really the point
b
Isn't it?
k
in the end I think if company is hosting sources it should have its own artifact repository
r
I would ahve to get approval to use thrird parties
I wonder if github has something similar
b
If you just need to transfer raw aar, any cloud storage solution will do. Even google drive is fine
r
which is why i was thinking of using CI. It can host the arr file until i download to the apps
b
But if you want to make it available as a proper maven artifact, you'll need to put some extra work in. I've seen people using github repo as maven artifactory server as well
r
“github repo as maven artifactory server” - any sources?
b
But aar file alone is not enough as you lose all your metadata (e.g. dependencies)
r
what do you mean?
isnt the aar file “fat”?
b
Not for libs, for obvious reasons
r
interesting, do you know if its possible to do something similar with gradle?
b
In short, you need to create a new repo and then declare it in your gradle as this
Copy code
repositories {
  maven("<https://rawgit.com/USERNAME/REPONAME/BRANCHNAME|https://rawgit.com/USERNAME/REPONAME/BRANCHNAME>") {
credentials (...)
}
}
Publish to it and declare it as source repo on another project
Gradle will take care of putting stuff in the right places
r
now I am thinking the better approach is to create the kmm shared module inside my existing android app
then i have to work out what to do about iOS…
b
That's the recommended approach
Move ios to android repo as well
Keep everything in the monorepo
r
thats not going to work
to much disruption
b
Alternatively, connect your kmm module to android or ios repos with git submodules
That way you can still keep three repos, but have them connected
r
that might warrant investigation - though a few years ago i used git submodules and it was a nightmore
b
Tbh, I think the easiest solution for your case would be to just create that free artifactory instance and publish your kmm stuff there
r
perhaps, but not a solution for iOS
b
You can push both, aar and pod to artifactory, both built from same kmm project
r
i’ll definately mention that as a possible solution, thanks for your help, very much appreiciated
b
That way, both consumers can be oblivious about there even being kmm module. On consumer side it would be just consuming native libs
And artifactory is just one of the options for artifact repository server. You can do the same with nexus as well.
🙌 1
b
I found gh packages very hard to work with. Using regular gh git repo as maven repo is much easier.
h
Why? It is a normal maven repo, only password protected.
b
Well it doesn't allow overriding stuff and has no staging mechanism, so if something goes wrong when publishing all mpp artefacts, you are left with either manually removing all partial artefacts or incrementing version before trying again
🙏 1
And i had occasional network errors when uploading from gh actions, which effectively invalidated my entire version, even if some artefacts did upload...