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

Feature request: Support KSP #4492

Closed
davidjwiner opened this issue Feb 1, 2021 · 23 comments
Closed

Feature request: Support KSP #4492

davidjwiner opened this issue Feb 1, 2021 · 23 comments

Comments

@davidjwiner
Copy link

For Kotlin projects, Glide 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 Glide 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.

@pvegh
Copy link

pvegh commented May 4, 2021

"The reduction of build times is only applicable if there are no other processors that use KAPT."
source: https://developer.android.com/jetpack/androidx/releases/room#2.3.0-beta02

Meaning: if you have Glide in your project, KSP won't bring any benefits until Glide support is ready.

They told us to exercise social pressure. Here it is :)

@joshschriever
Copy link

More social pressure!

@sjudd
Copy link
Collaborator

sjudd commented May 19, 2021

Unfortunately the API for KSP is not compatible with the java equivalent. We're going to have to do some non-trivial abstracting, mostly of the methods here:

. The KSP team took a stab at this and was able to come up with a prototype, but wasn't able to make it production ready.

Since Glide is an open source project, anyone is welcome to contribute. The best way to apply social pressure is to of course spend your time on the improvement :)

This isn't completely straightforward, so if someone is interested, please reach out to me directly before you get too far so we can talk about it.

@sjudd
Copy link
Collaborator

sjudd commented May 20, 2021

Oh this also appears to be blocked internally due to lack of support where Glide is hosted, so we'll need more work from the KSP team before it's possible to submit anything here.

@eman1986
Copy link

Oh this also appears to be blocked internally due to lack of support where Glide is hosted,

what does that mean?

@anjalsaneen
Copy link

Any updates on this?

@ArtemKleinschmidt
Copy link

Happy new year 2022 everyone!
It's been almost a year since the last Glide update.
Any updates on the KSP support status?
It's the only dependency that blocks my project migration to KSP.

@mistletoe5215
Copy link

Happy new year 2022 everyone! It's been almost a year since the last Glide update. Any updates on the KSP support status? It's the only dependency that blocks my project migration to KSP.

me2

@Ezrael2k5
Copy link

Happy new year 2022 everyone! It's been almost a year since the last Glide update. Any updates on the KSP support status? It's the only dependency that blocks my project migration to KSP.

me2

me2

@bennyhuo
Copy link

bennyhuo commented Feb 8, 2022

Happy new year 2022 everyone! It's been almost a year since the last Glide update. Any updates on the KSP support status? It's the only dependency that blocks my project migration to KSP.

me2

me2

me2

@alvin96
Copy link

alvin96 commented Feb 15, 2022

Happy new year 2022 everyone! It's been almost a year since the last Glide update. Any updates on the KSP support status? It's the only dependency that blocks my project migration to KSP.

me2

me2

me2

me2

@fertwo
Copy link

fertwo commented Mar 10, 2022

Hi guys, any updates on this?
It's the only dependency blocking our migration to KSP too :(

@mistletoe5215
Copy link

mistletoe5215 commented Mar 17, 2022

hi all,as u know, glide-parent project is a project based on java ,i've released a version of glide ksp jar which using kotlin language and ksp to maven central repository,named io.github.mistletoe5215:glide-ksp:1.0.0,any one interested can have a try.It can satisfied my own project's needs.However ,i still have one problem:can't find classes with GlideModule annotation in library or jar/aar dependcies ,therefore,i just wrote these class qualifiedNames in ksp options's arg,hope some master can help me @sjudd ..@A@,the following is my glide-ksp project
see link

@trevorhackman
Copy link
Contributor

Glide is blocking us from migrating from KAPT to KSP too

@sjudd
Copy link
Collaborator

sjudd commented May 13, 2022

KSP apparently continues not to be available in the Google repo where Glide lives, which will complicate a migration. We could still accept contributions towards adding a second processor externally. It'll require some coordination, so please let me know if you're interested in working on it.

@techwn
Copy link

techwn commented Jun 4, 2022

I found that Kotlin seems going to abandon KAPT in new K2 compiler: https://youtrack.jetbrains.com/issue/KT-52284

Change Log here: https://github.com/JetBrains/kotlin/releases/tag/v1.7.0-RC2

@ephemient
Copy link

Please be careful what information you spread. KAPT is currently not supported in the experimental K2. It is still on the roadmap for beta. https://youtrack.jetbrains.com/issue/KT-52604/Release-K2-Beta

@neworld
Copy link

neworld commented Jun 10, 2022

Dagger2 are very close to support ksp

Very close? Please, could you share the source of this statement?

@mrmike
Copy link

mrmike commented Jun 10, 2022

Dagger2 are very close to support ksp

Very close? Please, could you share the source of this statement?

Looks like there is still quite a lot of work to do google/dagger#2349

@elomonaco
Copy link

they're at least closer than glide is, glide doesn't even seem to be trying, they just said it's not easy and asked for volunteers to help with it.

@kroussevrb
Copy link

One more vote for this

@sjudd
Copy link
Collaborator

sjudd commented Jul 14, 2022

Plan for now is to support:

  1. AppGlideModules
  2. LibraryGlideModules
  3. Excluding LibraryGlideModules from an AppGlideModule.

We will not supported Glide's generated API (Extensions, GlideApp, GlideRequests, GlideRequest). We will not support modules registered via AndroidManifests.

This will allow people to use KSP to configure Glide and register integration libraries while substantially minimizing the amount of code that needs to be duplicated in the KSP processor. Users that want to use the full generated API can continue to use the Java annotation processor.

I'm not sure how many people today use GlideApp/GlideRequests/GlideRequest without an Extension today. We did recommend people do so for a while (and may still) in our documentation. If we don't generate those in KSP, people will have some migration work to do to use KSP. It's pretty trivial because the APIs will be identical, but a large codebase may have to change a lot of callsites to switch from the generated API back to the underlying classes (Glide, RequestManager, RequestBuilder). If a lot of you do this, please let me know here. We could consider trying to generate these classes to ease the migration path while still not supporting Extensions.

copybara-service bot pushed a commit that referenced this issue Jul 14, 2022
… in that round. When we encounter an AppGlideModule, we read all previously read Index classes, extract the LibraryGlideModules they point to, and write a merged AppGlideModule that calls the developer's AppGlideModule and all of the LibraryGlideModules.

Excluding LibraryGlideModules is not supported yet. The library is still in a pre-release state.

Progress towards #4492

PiperOrigin-RevId: 460856048
copybara-service bot pushed a commit that referenced this issue Jul 14, 2022
Every round now writes a new Index containing all LibraryGlideModules in that round. When we encounter an AppGlideModule, we read all previously read Index classes, extract the LibraryGlideModules they point to, and write a merged AppGlideModule that calls the developer's AppGlideModule and all of the LibraryGlideModules.

Excluding LibraryGlideModules is not supported yet. The library is still in a pre-release state.

Progress towards #4492

PiperOrigin-RevId: 460856048
copybara-service bot pushed a commit that referenced this issue Jul 19, 2022
Every round now writes a new Index containing all LibraryGlideModules in that round. When we encounter an AppGlideModule, we read all previously read Index classes, extract the LibraryGlideModules they point to, and write a merged AppGlideModule that calls the developer's AppGlideModule and all of the LibraryGlideModules.

Excluding LibraryGlideModules is not supported yet. The library is still in a pre-release state.

Progress towards #4492

PiperOrigin-RevId: 460856048
copybara-service bot pushed a commit that referenced this issue Jul 19, 2022
Every round now writes a new Index containing all LibraryGlideModules in that round. When we encounter an AppGlideModule, we read all previously read Index classes, extract the LibraryGlideModules they point to, and write a merged AppGlideModule that calls the developer's AppGlideModule and all of the LibraryGlideModules.

Excluding LibraryGlideModules is not supported yet. The library is still in a pre-release state.

Progress towards #4492

PiperOrigin-RevId: 461946515
@sjudd sjudd closed this as completed Oct 19, 2022
@sjudd
Copy link
Collaborator

sjudd commented Oct 19, 2022

Launched in 4.14.0 (though you'll want 4.14.2+)

ZacSweers added a commit to ZacSweers/kotlin-web-site that referenced this issue Oct 22, 2022
Officially supported as of 4.14 – bumptech/glide#4492
koshachy pushed a commit to JetBrains/kotlin-web-site that referenced this issue Oct 24, 2022
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