zjupure / GlideWebpDecoder

A Glide WebpDecoder Intergration Library for decoding and displaying webp images
Apache License 2.0
740 stars 91 forks source link

Support for KSP #105

Open RicardoJiang opened 1 year ago

RicardoJiang commented 1 year ago

Glide 4.14.2 already supports ksp, could you please add support for KSP too? it's faster than kapt, thank you very much

AndroidDeveloperLB commented 1 year ago

Can you please also explain what changes will we need to perform? Or maybe it's possible already, at least partially? The IDE claims this for the Glide part:

This library supports using KSP instead of kapt, which greatly improves performance. Learn more: https://developer.android.com/studio/build/migrate-to-ksp

Maybe possible at least partially, then? I tried now, and I got errors while trying to do it. Not sure if it's because I did something wrong, or because it's not possible yet if I use Glide together with this repository...

zjupure commented 1 year ago

PR is welcome. I has no more time to migrate kapt to KSP, it is low priority.

ArtRoman commented 10 months ago

I'm using this library with KSP, all is working good. Just make sure to have a class that extends AppGlideModule and marked with @GlideModule attribute. So auto-generated ksp module GeneratedAppGlideModuleImpl has WebpGlideLibraryModule registered in it:

  public override fun registerComponents(
    context: Context,
    glide: Glide,
    registry: Registry,
  ): Unit {
    WebpGlideLibraryModule().registerComponents(context, glide, registry)  <— Here
    appGlideModule.registerComponents(context, glide, registry)
  }

build.gradle:

    implementation "com.github.bumptech.glide:glide:4.16.0"
    implementation "com.github.zjupure:webpdecoder:2.3.4.15.1"
    //kapt "com.github.bumptech.glide:compiler:4.16.0"
    ksp "com.github.bumptech.glide:ksp:4.16.0"
AndroidDeveloperLB commented 10 months ago

@ArtRoman It says that you should use :

implementation "com.github.bumptech.glide:glide:${GLIDE_VERSION}"

And you have 4.15.1 instead of 4.16.0.

How come?

ArtRoman commented 10 months ago

@AndroidDeveloperLB

Llatest release of Glide is 4.16.0, but GlideWebpDecoder is not updated to this version, so I use Glide as usual with latest build, but for GlideWebpDecoder I must use old full version. They are working good together.

My build.gradle now:

def glide_version = '4.16.0'

dependencies {
    …

    // Glide for images loading
    implementation "com.github.bumptech.glide:glide:$glide_version"
    implementation "com.github.zjupure:webpdecoder:2.3.4.15.1" //TODO use $glide_version after library update
    //kapt "com.github.bumptech.glide:compiler:$glide_version"
    ksp "com.github.bumptech.glide:ksp:$glide_version"
}

You can use 4.15.1 for both libraries, KSP support was added to Glide in 4.14.0.

AndroidDeveloperLB commented 10 months ago

@ArtRoman OK thank you!

ArtRoman commented 10 months ago

@AndroidDeveloperLB you can close issue if all is OK

AndroidDeveloperLB commented 10 months ago

@ArtRoman I'm not the admin of this repository, and not the creator of this thread. But please update the repository guidelines.

ArtRoman commented 10 months ago

But please update the repository guidelines.

And I'm not connected to this repo, too 😀