Package-level declarations

Types

Link copied to clipboard

A simple holder class for containing originating KSFiles, which are used by KSP to inform its incremental processing.

Link copied to clipboard

A resolver for enclosing declarations' type parameters. Parent declarations can be anything with generics that child nodes declare as defined by KSType.arguments.

Functions

Link copied to clipboard
fun FunSpec.Builder.addOriginatingKSFile(ksFile: KSFile): FunSpec.Builder
fun PropertySpec.Builder.addOriginatingKSFile(ksFile: KSFile): PropertySpec.Builder
fun TypeAliasSpec.Builder.addOriginatingKSFile(ksFile: KSFile): TypeAliasSpec.Builder
fun TypeSpec.Builder.addOriginatingKSFile(ksFile: KSFile): TypeSpec.Builder

Adds the given ksFile to this builder's tags for use with originatingKSFiles.

Link copied to clipboard
fun FileSpec.kspDependencies(aggregating: Boolean, originatingKSFiles: Iterable<KSFile> = originatingKSFiles()): Dependencies

Returns a KSP Dependencies component of this FileSpec with the given originatingKSFiles, intended to be used in tandem with writeTo.

Link copied to clipboard
fun FileSpec.originatingKSFiles(): List<KSFile>

Returns the list of all files added to the contained TypeSpecs, PropertySpecs, FunSpecs, or TypeAliasSpecs contained in this spec.

fun FunSpec.originatingKSFiles(): List<KSFile>
fun PropertySpec.originatingKSFiles(): List<KSFile>
fun TypeAliasSpec.originatingKSFiles(): List<KSFile>
fun TypeSpec.originatingKSFiles(): List<KSFile>

Returns this spec's originating KSFiles for use with incremental processing.

Link copied to clipboard
fun KSAnnotation.toAnnotationSpec(omitDefaultValues: Boolean = false): AnnotationSpec

Returns an AnnotationSpec representation of this KSAnnotation instance.

Link copied to clipboard
fun KSClassDeclaration.toClassName(): ClassName

Returns the ClassName representation of this KSClassDeclaration.

fun KSType.toClassName(): ClassName

Returns the ClassName representation of this KSType IFF it's a KSClassDeclaration.

Link copied to clipboard
fun Modifier.toKModifier(): KModifier?

Returns the KModifier representation of this Modifier or null if this is a Java-only modifier (i.e. prefixed with JAVA_), which do not have obvious KModifier analogues.

fun Visibility.toKModifier(): KModifier?

Returns the KModifier representation of this visibility or null if this is JAVA_PACKAGE or LOCAL (which do not have obvious KModifier alternatives).

Link copied to clipboard
fun KSType.toTypeName(typeParamResolver: TypeParameterResolver = TypeParameterResolver.EMPTY): TypeName

Returns the TypeName representation of this KSType.

fun KSTypeArgument.toTypeName(typeParamResolver: TypeParameterResolver = TypeParameterResolver.EMPTY): TypeName

Returns a TypeName representation of this KSTypeArgument.

fun KSTypeReference.toTypeName(typeParamResolver: TypeParameterResolver = TypeParameterResolver.EMPTY): TypeName

Returns a TypeName representation of this KSTypeReference.

Link copied to clipboard
fun List<KSTypeParameter>.toTypeParameterResolver(parent: TypeParameterResolver? = null, sourceTypeHint: String = "<unknown>"): TypeParameterResolver

Returns a TypeParameterResolver for this list of KSTypeParameters for use with enclosed declarations.

Link copied to clipboard
fun KSTypeParameter.toTypeVariableName(typeParamResolver: TypeParameterResolver = TypeParameterResolver.EMPTY): TypeVariableName

Returns a TypeVariableName representation of this KSTypeParameter.

Link copied to clipboard
fun FileSpec.writeTo(codeGenerator: CodeGenerator, dependencies: Dependencies)

Writes this FileSpec to a given codeGenerator with the given dependencies.

fun FileSpec.writeTo(codeGenerator: CodeGenerator, aggregating: Boolean, originatingKSFiles: Iterable<KSFile> = originatingKSFiles())

Writes this FileSpec to a given codeGenerator with the given originatingKSFiles.