Hello, I'm trying to create my first KSP and it's pretty much a learning project. Everything works q...
a
Hello, I'm trying to create my first KSP and it's pretty much a learning project. Everything works quite well except for this. If I use Dagger 2 or Hilt my generated classes are deleted. Then, if I change the processor class, the project generates the files again. That's probably a feature, because I noticed that the files are generated only the first time I compile the project. How can I understand what's happening? And how can I make it work with Dagger 2? Thanks in advance and sorry if my questions are too noob.
j
what do you mean by changing the processor class?
a
It's difficult to explain. Like I mentioned, it's my first try. But let's say that I change how a function is written, by fixing the indentation. Because something has changed, the processor generates the file. Same if I change the interface that I'm trying to implement with the KSP. I think that this is related with incremental build. Maybe a fix is to try multi run with a deferred function. This is a hunch and I’m lacking some knowledge here.
j
a sample project would be great for us to investigate.
a
I believe that if I cause some “dirtiness” the processor is triggered. Sure, I’ll push this ASAP tomorrow or Friday. It's 22:06 here and I’m burnout. I’ll have to work in some priorities in the next days. If my hunch is correct and my understanding of multi runs is correct, I should be able to check if the class was generated and retry if not, right?
j
no hurries 🙂 as this is running with a KAPT processor there might be other issues.
a
Hi, I’ve been trying to understand the problem, but I’ve no clue unfortunately. The repo is this https://github.com/CurtesMalteser/ksp-preferences. What I learnt so far is that the file is generated when I build the project, but it’s deleted when I try to run the app. If I keep building the project and trying to execute it, it will work after some tries. This only happens if I try to use Dagger or Hilt. But I definitely need to use it with Dagger. It might be a noob mistake and all the help is welcome. Is there any resources available where I can learn how the processor is triggered and how the code is generated? Right now I’m just following the official tutorials and not really understanding what’s happening.
Hi @Jiaxiang would you be able to help me? I’m still stuck with this. There’s another branch https://github.com/CurtesMalteser/ksp-preferences/tree/implement_proto This is the most recent one, and every time I try to use dagger or hilt, it doesn’t work. What I noticed is that dagger compiles first and is what’s throwing non existent class exception. So, my deferred logic didn’t work and I didn’t commit it.
@Jiaxiang thanks a lot. It’s solved. It was a couple newbie mistakes.