square / retrofit

A type-safe HTTP client for Android and the JVM
https://square.github.io/retrofit/
Apache License 2.0
42.82k stars 7.28k forks source link

KSP support for retrofit-response-type-keeper #4176

Open nedveed opened 2 weeks ago

nedveed commented 2 weeks ago

What kind of issue is this?

I wish there was support for KSP annotation processor for retrofit-response-type-keeper.

Also it would be great to improve retrofit's Readme, R8 / ProGuard section and mention problem https://github.com/square/retrofit/issues/4011#issuecomment-1862037707 with showing that retrofit-response-type-keeper exists

Some story for background:

I had today problem described

My build config is

Working solutions for problem are two:

retrofit-response-type-keeper is doing great job and is working fine, but for it to work I needed to add kapt plugin when all other processors (in my case it was hilt, room) support ksp.

JakeWharton commented 2 weeks ago

I'm personally not interested in maintaining a KSP version right now. Perhaps once it moves into the Kotlin repo and KSP2 is stable we can reconsider.

JakeWharton commented 2 weeks ago

The logic is really simple. Someone can maintain a KSP version outside the Retrofit repo until KSP is stable enough to move it in.

nedveed commented 1 week ago

I see. I wasn't aware that KSP is not stable enough due to Google recommendation to migrate.

Kapt is now in maintenance mode, and we recommend migrating from kapt to KSP wherever possible. In most cases, this migration only requires changes to your project's build configuration. https://developer.android.com/build/migrate-to-ksp

In my case, in project with 15 endpoints, kapt task has ~7s while full release build has 4m30s, and it doesn't affect dev builds at all due to kaptRelease, so maybe it's not that big deal as it isn't like generating some big Dagger graph and it's reasonable to wait for KSP2.

JakeWharton commented 1 week ago

Separating your network layer into its on module will allow reducing that time to effectively 0, since it will always reuse the cached output rather than running on every change.