Skip to content

Add option to disable generating dagger factories for specific source sets #718

Open
@matejdro

Description

We have an use case where we want to use anvil only (with generateDaggerFactories = true) inside main source set of a module. However, inside instrumented tests, we want to run full Dagger to generate components for integration tests (kaptAndroidTest("com.google.dagger:dagger-compiler") dependency declaration).

Anvil does not seem to support this configuration:

  1. If we enable kapt inside tests, Anvil will complain that generateDaggerFactories is enabled and Dagger must not coexist and that generating dagger factories should be disabled
  2. But if we disable generating dagger factories, factories will not get generated in the main source set (that does not contain kapt)

Maybe it would be a good idea to add a per-source-set dagger factory generation toggle instead of one global toggle?

Metadata

Assignees

No one assigned

    Labels

    dagger factoryHappens when generateDaggerFactories is set to trueenhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions