question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Provide official support for `dagger-reflect`

See original GitHub issue

When using dagger-reflect and not applying the kapt gradle plugin at all, seeing clean builds that take 54% less time for a large app build, incremental builds that take 33% less time.

Similar to how Moshi supports both code-gen and reflect versions, it would be great if the Dagger team provided official support for dagger-reflect to make sure it keeps functional parity with dagger code gen and to make dagger-reflect work with Hilt.

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:23
  • Comments:10 (2 by maintainers)

github_iconTop GitHub Comments

7reactions
vRallevcommented, Aug 28, 2020

These modules using the Dagger annotation processor build up to 66% faster now. Stub generation + Kapt are gone, javac becomes a no-op because we generate Kotlin code (the table contains 2 pure java modules, that’s why the number isn’t 0). Kotlinc takes more time.

| Stub generation | Kapt | Javac | Kotlinc | Sum :— | —: | —: | —: | —: | —: Dagger | 12.976 | 40.377 | 8.571 | 10.241 | 72.165 Anvil | 0 | 0 | 6.965 | 17.748 | 24.713

For building entire applications we measured an average saving of 16%.

3reactions
Chang-Ericcommented, Aug 25, 2020

I think this is something we can consider, but it is a large commitment to support an essentially second implementation of Dagger, so it isn’t a decision that can be made lightly. I think also complicating that is that the official advice around using it would have to be quite nuanced. For example, something like use this as you develop, maybe in some tests, but also you probably want to run your tests with regular dagger just in case there is some variation.

This is in addition to the two flavors of Dagger code generation that we already support (regular and fastInit) and it looks like there are also two modes for dagger-reflect, so this could add to potential confusion and definitely adds to maintenance difficulties.

So I think this is a good suggestion, and we will keep this issue open, but the decision will probably take some time. As @bcorso mentions above too, we may want to evaluate this against the work to be done to support KSP and see how much of a benefit this will have over that as well.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Ralf Wondratschek on Twitter: "There are some limitations, e.g. ...
Provide official support for `dagger-reflect` · Issue #2053 · google/dagger ... Anvil only supports generating code for Dagger modules, inject constructors ...
Read more >
Dagger Reflect - The circle from runtime to ... - Speaker Deck
Now we're going back to runtime with Dagger Reflect in an effort to improve local developer build speeds. This talk will cover the...
Read more >
Speeding Up Builds with Dagger Reflect
This blog post covers how we used Dagger Reflect to save developer time with minimal changes to our codebase.
Read more >
Dagger Reflect - The Circle from Runtime to Compile Time ...
Practice and apply knowledge faster in real-world scenarios with projects and interactive courses. *Available on Premium only. For teams. Give ...
Read more >
Dagger Reflect - The circle from runtime to compile ... - Droidcon
The good, the bad and the ugly of interfaces in mobile dev ... Kotlin and Swift may have introduced a lot of functional...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found