1 of 19

@BlrDroid

Deep Dive into KSP with Epoxy

Subhrajyoti Sen

2 of 19

Agenda

  • Meta programming
  • Intro to KSP
  • Intro to Epoxy
  • Implementations
  • Migration

3 of 19

Meta Programming

Programming technique where programs treat other programs as their input data

4 of 19

Meta Programming - Android

  • Dependency Injection - Dagger
  • Room
  • Moshi
  • Epoxy
  • Dependency Injection - Dagger-Reflect

5 of 19

Methods

  • Reflection

  • Code generation

6 of 19

Reflection

  • Slow?

  • JVM feature

  • Slow feedback

7 of 19

Code Generation

  • Longer compile time

  • Possibly larger binaries

8 of 19

Kotlin Annotation Processing Tool (kapt)

  • Modelled around Java

  • Delegates to javac and hence no multiplatform

  • Slow compile times

9 of 19

Kotlin Symbol Processing - KSP

  • Modelled around Kotlin

  • Doesn’t delegate to javac, hence Multiplatform!

  • No stub generation

10 of 19

Minor limitations of KSP

  • Cannot process expressions

  • Cannot modify code

11 of 19

Is KSP a Compiler Plugin?

12 of 19

Is KSP a Compiler Plugin?

Yes

13 of 19

Is KSP a Compiler Plugin?

Yes… and no

14 of 19

KSP has 2 parts

  • The KSP API

  • The KSP Implementation

15 of 19

How does Epoxy use KSP?

16 of 19

Incremental Processing

  • Isolating Mode

  • Aggregating Mode

17 of 19

Incremental Processing Demo

18 of 19

Testing Annotation Processors

19 of 19

Thank You

@iamsubhrajyoti