Is there a way to let ksp generate tests? I want t...
# ksp
p
Is there a way to let ksp generate tests? I want to generate a test based on my main source set.
đź‘€ 1
j
it depends on the format of tests you want to generate.. if you need to parse into function body to generate tests then it is not possible, so it really depends on your use case, I can think of cases where KSP can do this, like the api tests in KSP itself can be done by KSP..
p
Just any test. I only need to inspect function signatures. If I define KSP the tests end up in my main source sets. If I define testKsp then the processor does not pick up any symbols - actually it doesn't run at all
j
I see, your requirement here is actually generating sources for another source set in another task.. IIRC there was similar ask before. might need more work on Gradle to achieve this. The first idea I have is to add the generated folder into source sets of test task, will that work?
p
No then it won't run due to duped classes
j
might need an option for gradle to not add generated folders into main source set, I am not sure if that is doable, I will take a look later.
p
That would be great 🤞
Is there any workaround you could think of? I have a pretty cool idea for a Library
j
I can’t think of a workaround at this moment. You might be able to do that with some gradle trick like writing a task to move files, but doesn’t look like a good practice to me.