-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Lots of warnings with KSP related to incremental compilation #4182
Comments
I wasn't able to reproduce this. If you can share a minimal reproducible example project I can take a deeper look. |
sure, I'll post the URL here soon, meanwhile we also mentioned the issue here as well |
Hi @bcorso @rakshitsoni02 and I work together We got some additional information from the KSP team: Does Dagger use the Room compiler-processing module to support KSP Each of the warnings we see tells us to raise a bug on Room (component 413107):
The Android application we're trying to build does not depend on Room. There is no ".room" anywhere in the source code. Dagger 2.50 doesn't fix the issue. Considering the Room compiler-processor module doesn't appear to be a supported public library, is it possible we've hit an unexpected path in the code? Beyond the pollution of build logs, we're concerned about the warning telling us our builds will be slower, since migrating from Kapt to KSP is supposed to make builds faster |
Yes, Dagger uses the XProcessing library, which is currently in Room.
Our team contributes to the XProcessing library and works closely with the Room team. We'll continue to fix bugs related to Dagger usage. The main issue is that it's still unclear how you are getting in this error since we can't reproduce it ourselves. Were you able to create a minimal reproducible example project that you can share? |
Thanks for the update @bcorso The minimal reproducible example is probably not going to happen because the application we have the problem with has been in the Play Store for more than 10 years and contains ways too much technical debt. We wouldn't know where to start. It doesn't use Room or Realm but it uses both RxJava and Coroutine Flow. It contains at least 4 different screen navigation patterns in modules that were developed over the years. We use Dagger without Hilt. It looks like migrating away from kapt will not be a low hanging fruit for us. I will post more when I have some time to better understand how Dagger/Xprocessing works and what the issue could possibly be. |
The error happens when you generate a source but don't have an originating element. However, in Dagger we always use the element that was annotated as the originating element, which is why it's unclear to me how you are hitting this. However, looking deeper in XProcessing, there is one place where it could be dropping the originating element. In particular, it looks like I'm not 100% sure that's where the originating element is being dropped, but it seems like a good place to start. On our side, I can also look into changing XProcessing so that On your side, can you share a bit more about the
|
FWIW, I've filed https://issuetracker.google.com/319297571 to XProcessing to give better error messages in this case. |
Thanks for the leads @bcorso I did a clean build of our Android application. That showed 362 KSP warnings. The number of parameters in the constructor (0 or more) doesn't seem to matter.
I'll see what else I can think of |
Hey everyone, I just ran into this problem as we upgraded to ksp. We are on dagger 2.50. In our case, we have a multi-module setup and the issue was related to how we had set up our dependencies. Let's say we have In Our
In our build.gradle:
What I noticed was that we only received the warning for files in certain modules. The issue was with our setup in Once I applied the dagger dependencies inside Hope that helps! |
Good shout @HGyllensvard |
Ironically, it likely worsened your build speed, at least in theory. In particular, while it may improve the build speed of The idea is that the more Dagger can do at the individual library level the more it can skip during incremental processing if that library isn't touched. In particular, if you remove Dagger's compiler from |
@rakshitsoni02 what's the reason you reopened this? |
in case there is any need to update the warning message related to this issue? so closing now, feel free to update the issue if needed. Thanks |
Hey @rakshitsoni02 and @bcorso. A way to reproduce this warning is with the following scenario. Consider a feature module containing its own modules for data, domain, and dagger integration. In the domain module, you define contracts, while the data module provides concrete implementations of these contracts. However, imagine that one of these implementations requires a dependency from either another module or directly from the app. In your dagger configuration, you specify the dependency modules, along with the binding of the required service. Both modules are added to your app component. During compilation, within the feature's Dagger module, Dagger successfully generates only certain dependencies. However, dependencies that Dagger cannot generate, due to their reliance on dependencies from the app, will result in the triggering of this warning. @bcorso I've attached here a simple project reproducing this. |
**w: [ksp] No dependencies reported for generated source xxx_Factory.java which willprevent incremental compilation.**
There are almost above warnings for many classes, it's after migration from kapt to KSP
Using the latest KSP, AGP & Dagger[2.49]
The text was updated successfully, but these errors were encountered: