Skip to content
This repository has been archived by the owner on Aug 15, 2023. It is now read-only.

Using library gradle module DependencyComponent as a dependency for Hilt ApplicationComponent #6

Open
ultraon opened this issue Aug 6, 2020 · 0 comments

Comments

@ultraon
Copy link

ultraon commented Aug 6, 2020

Hello, I tried finding a solution to connect the existing library DependencyComponent to Hilt ApplicationComponent. It looks like it is impossible at the moment.
Could you please clarify that.

Example:
we have the following gradle modules structure:

  • utils (library)
  • common (library)
  • feature1 (library, depends on common and utils)
  • feature2 (library, depends on utils)
  • app (application, assembles all modules above)
// from feature1 lib module
interface Feature1DependencyComponent {
  val feature1Api: Feature1Api
}

// from app module
@Component(
  dependencies = [Feature1DependencyComponent::class],
  modules = [AppModule1::class, AppModule2::class]
)
@Singleton
interface ApplicationComponent {
  val feature1Api: Feature1Api // to have explicit exposing
}

As you can see @Module can't be used in feature1 because it doesn't know anything about ApplicationComponent to use with @InstallIn.

Question: how to connect Feature1DependencyComponent without using @BindsInstance to Hilt ApplicationComponent?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant