Hi. I have multiplatform project with 2 targets: a...
# multiplatform
p
Hi. I have multiplatform project with 2 targets: android and iOS. The android app and iOS app are stored in separate repos, so there are basically 3 repos. Using the remote version of shared in android or IOS is setup and work flawlessly, but I would like to change and run locally without need of remote package publish. Is it possible to setup gradle of androidApp to point to library that are from different repos? Same for iOS.
p
I recall working in one of my projects with that same setup. What problems are you having? You just need to specify in Xcode how to locate the local
shared.framework
For Android you need to add the shared gradle module in Settings.gradle using the directory where it is located.
p
Even if the directory of the shared is not in the same.root as the android app?
p
Well, I remember having it in the same root. Never tried in a different directory. But I think gradle needs the sibling projects to be under the same root/parent directory
m
Why not just publish to your local maven instance? Since you already have the setup for remote publishing, it should be easy
p
I would say publish to local is a bit faster but not ideal
m
The thing with dependencies and modules, it is always best, in the long run, to keep your setup as simple as possible
If the idea is to import shared as a module, from a different path, imitate React-Native. add a gradle tasks that copies the shared module from the original path into a subfolder, and add the subfolder as a module to the consumer
that would allow you to read shared as a module without altering your repos. The bad part is, you will need to sync the changes from time to time. You could also try using a custom path
m
FWIW, there was a discussion about this 2 days ago https://kotlinlang.slack.com/archives/C3PQML5NU/p1704274086937089
m
Copy code
project(":module1").projectDir=new File(rootDir, "features/module1")
👍 1