Replies: 1 comment 1 reply
-
I was going to point you at |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Context: The Android app I'm working on is quite big, hundreds of dependencies are provided and injected everywhere, in over 100 gradle modules; the app is bound by moderately strict legal requirements and regulations; it currently (ab)uses Koin 4.x
I'm evaluating the cost (effort, time, feasibility, etc.) of migrating to a Compile-Time DI solution. I've considered: kotlin-inject, Hilt, Dagger (w/out Hilt), and as I was about to dive deep in Anvil, I found Metro.
I'm in the Metro proof of concept phase, and I would like to know what is the "correct" approach in Metro to these issues.
Due to the dynamic (aka: runtime) nature of Koin, the current app is able to do this:
Both Main and Develop sourceSets are merged at compile time by design, but because they have different names, and because there are different
: Application()
implementations on each one, only one is really included at runtime; and that implementation only adds the corresponding modules (since they have different names anyway). Sneaky...With solutions like Dagger/Hilt this is not possible, since the sources would be merged and they would collide (multiple Provides implementations, duplicated object name, etc.). The solution offered by Hilt developers was to do something like this (YouTube Video where they were asked a similar question):
Needless to say, we do not like this approach at all for multiple reasons.
Considering the app currently has two build types:
And Three Flavors:
Using sourceSets directly is... something we'd like to tame/avoid where possible (at least try to avoid touching this as much as possible).
So... finally to the question:
isExtendable = true
) Something else?tl;dr
What is the best practice to have dependencies per build variant in Metro?
Think of:
interface Thing {}
and then
DevelopThing()
vs.ProductionThing()
.Note this is not about unit tests (that's a whole other world covered by
DependencyGraph.excludes + replace
in Metro's world).Thanks
Beta Was this translation helpful? Give feedback.
All reactions