All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.faendir.kotlin.autodsl.ksp.KspCodeWriter.kt Maven / Gradle / Ivy

There is a newer version: 2.4.0
Show newest version
package com.faendir.kotlin.autodsl.ksp

import com.faendir.kotlin.autodsl.CodeWriter
import com.google.devtools.ksp.processing.CodeGenerator
import com.google.devtools.ksp.processing.Dependencies
import com.google.devtools.ksp.symbol.KSClassDeclaration
import com.squareup.kotlinpoet.FileSpec

class KspCodeWriter(private val codeGenerator: CodeGenerator) : CodeWriter {
    override fun emit(source: KSClassDeclaration, fileSpec: FileSpec) =
        codeGenerator.createNewFile(Dependencies(false, source.containingFile!!), fileSpec.packageName, fileSpec.name).writer().use { fileSpec.writeTo(it) }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy