glide icon indicating copy to clipboard operation
glide copied to clipboard

Inconsistent Handling of @GlideModule Annotation Between KSP and KAPT

Open blipinsk opened this issue 1 year ago • 2 comments

There's a difference in the way KSP handles @GlideModule annotation in comparison to KAPT.

  • KSP: the exact class which is annotated with @GlideModule must extend AppGlideModule or LibraryGlideModule
  • KAPT: a parent class of the one annotated with @GlideModule can extend AppGlideModule or LibraryGlideModule

Glide Version: 4.16.0

Issue details / Repro steps / Use case background:

open class BaseGlideAppModule : AppGlideModule() {

    override fun registerComponents(context: Context, glide: Glide, registry: Registry) {
      // ... some common behavior (e.g. reused across build variants of an android app)
    }
}
@GlideModule
class GlideModule : BaseGlideAppModule() {

    override fun registerComponents(
        context: Context,
        glide: Glide,
        registry: Registry,
    ) {
        super.registerComponents(context, glide, registry)
        // ... registering something
    }
}

☝️ this compiles fine when using the compiler with KAPT (kapt("com.github.bumptech.glide:compiler:4.16.0")), but fails when using KSP (ksp("com.github.bumptech.glide:ksp:4.16.0")) with 👇

Stack trace / LogCat:

[ksp] @GlideModule annotated classes must implement AppGlideModule or LibraryGlideModule

blipinsk avatar May 27 '24 12:05 blipinsk

I noticed the same behavior in my app, so I'm forced to use kapt for glide but the rest of my app is using ksp :/

yoobi avatar Aug 30 '24 06:08 yoobi

为什么ksp 不生成GlideApp

akingyin1987 avatar Nov 12 '24 04:11 akingyin1987