kotools / types

Explicit types for Kotlin Multiplatform.
https://types.kotools.org
MIT License
90 stars 6 forks source link

📝 Inlining `KotoolsTypesVersion` in API reference using KSP #596

Closed LVMVRQUXL closed 4 months ago

LVMVRQUXL commented 8 months ago

📝 Description

We would like to create an internal compiler plugin for inlining KotoolsTypesVersion in our API reference using Kotlin Symbol Processing (KSP). For each declaration using the ExperimentalSince, the Since and the DeprecatedSince annotations, we want to generate an equivalent annotation accepting a String that should be documented instead of the explicit ones from the kotools.types.internal annotation.

Here's an example of a simple type declaration:

package kotools.types.web

import kotools.types.internal.ExperimentalSince
import kotools.types.internal.KotoolsTypesVersion

@ExperimentalSince(version = KotoolsTypesVersion.V4_4_0)
public interface EmailAddress

The goal is to generate the following code:

package kotools.types.web

@MustBeDocumented
private annotation class ExperimentalSince(val version: String)

@ExperimentalSince(version = "4.4.0")
public interface EmailAddress
LVMVRQUXL commented 4 months ago

This is an idea that we will not apply to this project.