Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
1 of 3 tasks
nedveed opened this issue Jun 21, 2024 · 4 comments
Open
1 of 3 tasks

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

nedveed opened this issue Jun 21, 2024 · 4 comments

Comments

@nedveed
Copy link

nedveed commented Jun 21, 2024

What kind of issue is this?

  • Question. This issue tracker is not the place for questions. If you want to ask how to do
    something, or to understand why something isn't working the way you expect it to, use Stack
    Overflow. https://stackoverflow.com/questions/tagged/retrofit

  • Bug report. If you’ve found a bug, spend the time to write a failing test. Bugs with tests
    get fixed. Here’s an example: https://gist.github.com/swankjesse/6608b4713ad80988cdc9

  • Feature Request. Start by telling us what problem you’re trying to solve. Often a solution
    already exists! Don’t send pull requests to implement new features without first getting our
    support. Sometimes we leave features out on purpose to keep the project small.

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 #4011 (comment) with showing that retrofit-response-type-keeper
exists

Some story for background:

I had today problem described

My build config is

  • AGP ver "8.3.2"
  • kotlin ver "1.9.22"
  • ksp ver "1.9.22-1.0.17"
  • kotlinx.serialization ver 1.6.3
  • R8 full

Working solutions for problem are two:

  • working rule -keep, allowobfuscation, allowoptimization, allowaccessmodification @kotlinx.serialization.Serializable class *
  • usage of retrofit-response-type-keeper

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
Copy link
Member

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
Copy link
Member

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
Copy link
Author

nedveed commented Jun 25, 2024

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
Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants