Skip to content

Component dependencies and the gradle project dependency structure: can it be inverted? #303

Answered by evant
dimsuz asked this question in Q&A
Discussion options

You must be logged in to vote

An interface would be the suggested way to do this, yes.

// base module
interface AppComponent

// feature module
@Component abstract class LoginComponent(@Component val parent: AppComponent)

// app module
@Component abstract class AppComponentImpl : AppComponent

There's a few reasons it's done in this direction but the biggest on is it straight-forwardly maps to the generated code where LoginComponent needs to reference AppComponent in some way to grab dependencies.

It shouldn't be more tedious than any other cases where you define an interface in base for your features to use that's implemented in app?

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@dimsuz
Comment options

Answer selected by dimsuz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants