glide's ksp compiler ,use kotlin symbol processor

Overview

glide-ksp

glide's ksp compiler ,use kotlin symbol processor

requirements

library version
kotlin >= 1.6.10
ksp 1.6.10-1.0.2

usage

  • add jitpack repository to repositories
//in root build.gradle
allprojects {
    repositories {
        google()
        jcenter()
        maven { url "https://jitpack.io" }
    }
}
  • import kotlin symbol processor plugin
    // in root build.gradle
   plugins {
    id 'com.google.devtools.ksp' version "1.6.10-1.0.2" apply false
   }
  • apply kotlin symbol processor plugin in your modules which needs glide's annotation processor
   // for example,my demo's application module uses glide's annotation processor
   plugins {
       //...
       id 'com.google.devtools.ksp'
   }
   //add ksp generated class path into sourceSets
   android {
       //...
       sourceSets {
           main {
               java.srcDirs += ['build/generated/ksp/debug/kotlin']
           }
       }
   }
   //add `glide-ksp` using ksp 
   dependencies {
       ksp "com.github.mistletoe5215:glide-ksp:0.0.1"
   }
   
  • find classes with @GlideModule/@GlideExtension in library module

use ksp options to mark the custom LibraryGlideModules; in java annotation processor/kapt these classes can be found using RoundEnvironment to find class with @GlideModule annotation; but now in ksp ,we can't find these classes with using ksp's Resolver or SymbolProcessorEnvironment.see issue in ksp therefore,i can only put these class qualifiedNames into ksp compile args to solve it(so stupid ( :(,any one can help me plz push request) they're splited by "|" separator,use key named GlideModule the custom LibraryGlideExtensions,as well,use key named GlideExtension

    //in application's build.gradle convention scope
   ksp {
       arg( "GlideModule","com.mistletoe.glide.ksp.demo.lib.ProgressLibraryGlideModule|com.bumptech.glide.integration.okhttp3.OkHttpLibraryGlideModule")
   }

check whether Glide-KSP proceed successfully

  • make sure the necessary classes are generated ,they are GeneratedAppGlideModuleImpl,GeneratedRequestManagerFactory,GlideApp,GlideOption,GlideRequest,GlideRequests

  • then,call Glide's init in Application,set break points in GeneratedAppGlideModuleImpl,run app as debug mode to see whether it will block in these break points

  • finally,see whether it keeps functioning properly,load image successfully as usual

You might also like...
Event State Processor Generator plugin is compatible with IntelliJ and Android Studio.
Event State Processor Generator plugin is compatible with IntelliJ and Android Studio.

Event State Processor Generator plugin is compatible with IntelliJ and Android Studio. It provides source code generation for the EventStateProcessor Library to increase code productivity in Flutter apps development.

Ksp-di-library - Small library for DI in KMM apps

DI-KSP Small library for DI in KMM apps. Uses KSP for processing DI annotations:

Ktorm KSP extension to help generate boilerplate code.
Ktorm KSP extension to help generate boilerplate code.

Ktorm KSP extension to help generate boilerplate code. It can automatically generate Table objects through entity classes, while making entities defined by data classes easier to use, and supports custom extension code generation logic.

Kafka Streams Processor to unwrap CØSMOS blocks into CØSMOS transactions
Kafka Streams Processor to unwrap CØSMOS blocks into CØSMOS transactions

Kafka Processor CØSMOS-Block A Kafka Streams Processor to unwrap CØSMOS blocks into CØSMOS transactions. Purpose The Kafka Processor CØSMOS-Block is b

KSP-based library that generates lists from your annotation usages

ListGen, Generate Lists From Functions That Have @Listed Annotations! Welcome to ListGen! ListGen is a KSP-based library that can generate lists (and

An annotation processor library that automatically creates Hilt's `@Binds` functions and modules.
An annotation processor library that automatically creates Hilt's `@Binds` functions and modules.

HiltBinder An annotation processor library that automatically creates Hilt's @Binds functions and modules. If you think this library is useful, please

A ksp library to automatically generate navigation functions for jetpack compose.
A ksp library to automatically generate navigation functions for jetpack compose.

Compose/Navigation/Generator ⚠️ This library is still under development and not considered stable! Content Introduction Usage Example: Single destinat

Kotlin compiler plugin that allows class delegation to be dynamic like property delegations

kotlin-dynamic-delegation Kotlin compiler plugin that allows class delegation to be dynamic like property delegations. The plugin is working in progre

Kotlin compiler plugin for converting suspend functions to platform-compatible functions

Kotlin suspend transform compiler plugin Summary Kotlin compiler plugin for generating platform-compatible functions for suspend functions. JVM class

Comments
  • Update readme

    Update readme

     //add ksp generated class path into sourceSets
       android {
           //...
           sourceSets {
               main {
                   java.srcDirs += ['build/generated/ksp']
               }
           }
    

    Is redundant, because ksp folder is already included as sources. It contains generated classes for debug and for release build, so I got errors on full build:

    e: build/generated/ksp/debug/kotlin/com/bumptech/glide/GeneratedAppGlideModuleImpl.kt: (15, 16): Redeclaration: GeneratedAppGlideModuleImpl
    e: build/generated/ksp/debug/kotlin/com/bumptech/glide/GeneratedRequestManagerFactory.kt: (12, 7): Redeclaration: GeneratedRequestManagerFactory
    

    and so on…
     

    ksp {
        arg("GlideModule", "com.bumptech.glide.integration.webp.WebpGlideLibraryModule")
    }
    

    Also, I've spent a lot of time to figure out to place this in the root section of the build.gradle (not .kts), not on dependencies block (got example in room repository)

    opened by ArtRoman 10
  • Upgrade kotlin and KSP to 1.6.21

    Upgrade kotlin and KSP to 1.6.21

    Thank you for the library!

    Current stable version of kotlin is 1.6.21, and stable version of KSP is 1.6.21-1.0.5. But I can't use id 'com.google.devtools.ksp' version "1.6.21-1.0.5" apply false with ext.kotlin_version = '1.6.21' in root build.gradle because it gives build error:

    [ksp] java.lang.IllegalArgumentException: current module's kotlin version must be at least 1.6.10
    	at com.mistletoe.glide.ksp.core.KSPGlideProcessor.process(KSPGlideProcessor.kt:28)
    

    It seems that environment.kotlinVersion.isAtLeast(1, 6, 10) check is working wrong, because "1.6.21".isAtLeast(1, 6, 10) should return true.

    Also I can't downgrade KSP to 1.6.10-1.0.2 with kotlin 1.6.21 , because it gives error ksp-1.6.10-1.0.2 is too old for kotlin-1.6.21. Please upgrade ksp or downgrade kotlin-gradle-plugin to 1.6.10.

    opened by ArtRoman 3
  • 能否自动发现自定义GlideModule

    能否自动发现自定义GlideModule

    目前使用时需要通过ksp手动传入GlideModule路径,能否读取com.bumptech.glide.annotation.compiler目录下的所有文件,从而自动发现@GlideModule注解的类

    @GlideModule注解生成的文件如下

    package com.bumptech.glide.annotation.compiler;
    
    @Index(
        modules = {
            "com.test.glide.svg.SvgModule",
            "com.test.glide.common.CommonGlideModule"
        }
    )
    public class GlideIndexer_GlideModule_com_test_glide_svg_SvgModule_com_test_glide_common_CommonGlideModule {
    }
    
    opened by RicardoJiang 0
Releases(1.0.0)
Owner
Mistletoe
work,work,ready to work
Mistletoe
🎲 Kotlin Symbol Processor to auto-generate extensive sealed classes and interfaces for Android and Kotlin.

SealedX ?? Kotlin Symbol Processor to auto-generate extensive sealed classes and interfaces for Android and Kotlin. Why SealedX? SealedX generates ext

Jaewoong Eum 236 Nov 30, 2022
Exploring Kotlin Symbol Processing - KSP. This is just an experiment.

KSP example Exploring Kotlin Symbol Processing - KSP. This is just an experiment. Project contains 2 modules Processing Example Processing module is t

Merab Tato Kutalia 12 Aug 23, 2022
Kotlin Symbol Processing (KSP) sample project

Kotlin Symbol Processing (KSP) Sample Project Sample annotation processor created with Kotlin Symbol Processing (KSP) API. The repository supplements

Pavlo Stavytskyi 33 Dec 23, 2022
Kotlin Symbol Processor library to create Mutable and Immutable variants of objects.

implier Kotlin Symbol Processor plugin to create Mutable and Immutable variants of objects. Examples @ImmutableImpl @MutableImpl public interface Samp

Vadim Yaroschuk 14 Nov 8, 2022
BindsAdapter is an Android library to help you create and maintain Adapter class easier via ksp( Kotlin Symbol Processing).

BindsAdapter BindsAdapter is an Android library to help you create and maintain Adapter class easier via ksp( Kotlin Symbol Processing). Installation

Jintin 5 Jul 30, 2022
A Kotlin Symbol Processor to list sealed object instances.

Sealed Object Instances A Kotlin Symbol Processor to list sealed object instances. Usage Let's say you have a similar structure of sealed classes (or

Simon Marquis 17 Nov 17, 2022
KSP annotation processor for Toothpick

toothpick-ksp KSP annotation processor for Toothpick. All credits go to olivierperez/ksp for the initial work on a KSP processor. Bear in mind this is

null 0 Oct 19, 2021
KSP extension for the kotlin-maven-plugin

kotlin-maven-symbol-processing Extension for the kotlin-maven-plugin to support Kotlin Symbol Processing (KSP). Usage To use this extension, add the d

Dyescape 19 Dec 18, 2022
android webview loader using ksp

KSPWebViewLoader ?? @WebViewBuilder Annotation can be automating your webview settings. (WIP) How to use @WebViewBuilder( url = "https://www.googl

sehee Jeong 8 Apr 8, 2022
A collection of code generators powered by ksp.

AutoKsp A collection of code generators powered by ksp. status: working in progress Projects AutoGradlePlugin - Generate gradle plugin properties file

shenghaiyang 0 Nov 8, 2021