stephanenicolas / toothpick

A scope tree based Dependency Injection (DI) library for Java / Kotlin / Android.
Apache License 2.0
1.12k stars 115 forks source link

Support KSP #424

Open ddk9499 opened 3 years ago

ddk9499 commented 3 years ago

For Kotlin projects, Toothpick currently makes use of KAPT. This is generally quite slow since it requires generating Java stubs before the annotation processing step.

KSP offers an alternative to this by making it easier for annotation processors like Toothpick to more directly use Kotlin's compiler plugin infrastructure. Based on initial benchmarks, using KSP can speed up build times by as much as 2x.

L7ColWinters commented 2 years ago

I don't see any pr's about this currently. Has anyone taken a try at this yet? It's been about a year and other libraries have added ksp adaptations

afaucogney commented 2 years ago

@L7ColWinters it's smell like @outadoc is working on this : https://github.com/stephanenicolas/toothpick/pull/433

outadoc commented 2 years ago

Indeed! I've had little time to work on it so far so I can't make any guarantees on stability or compatibility, and there are KSP issues that might need fixes for all the tests to pass, but it's something, and you should be able to run it on a real project.

If anyone feels like testing and fixing stuff, contributions are welcome: https://github.com/outadoc/toothpick-compiler-ksp