https://kotlinlang.org logo
Title
t

trevjones

05/20/2022, 10:44 PM
Would it be possible to generate code from one source set into another via a KSP processor? Example being:
@Parcelize data class Foo(val bar: String): Parcelable
would generate something like
@EnforceImpl abstract class FooRoundTripParceling {...}
into the androidTest source set. Then I could have a different processor watching for annotations to pair the impl with a generated template. I assume generating some sort of resource file and doing a processor or gradle task that operates on the generated resources would be the only way to do something like this.
I suspect cross source set behavior would require direct ksp+gradle support for cache/incremental correctness at which point a resource -> later gradle task implementation would prob be the right path to POC this automated compliance concept on
j

Jiaxiang

05/23/2022, 5:12 PM
haven’t tried this idea before, let me know if you get any working solutions to this, I think your suspect is reasonable.
👍 1