fluid-compiler

Compile Kotlin code and run Kapt annotation processing directly from Kotlin

License

License

Categories

Categories

Data
GroupId

GroupId

io.fluidsonic.compiler
ArtifactId

ArtifactId

fluid-compiler-metadata
Last Version

Last Version

0.10.2
Release Date

Release Date

Type

Type

module
Description

Description

fluid-compiler
Compile Kotlin code and run Kapt annotation processing directly from Kotlin
Project URL

Project URL

https://github.com/fluidsonic/fluid-compiler
Source Code Management

Source Code Management

https://github.com/fluidsonic/fluid-compiler

Download fluid-compiler-metadata

Dependencies

compile (1)

Group / Artifact Type Version
org.jetbrains.kotlin : kotlin-stdlib jar 1.4.0

Project Modules

There are no modules declared in this project.

fluid-compiler

Maven Central JCenter Kotlin #fluid-libraries Slack Channel

Compile Kotlin code and run Kapt annotation processing directly from Kotlin, for example to unit test your annotation processors!

Installation

build.gradle.kts:

dependencies {
    implementation("io.fluidsonic.compiler:fluid-compiler:0.10.2")
}

Example

import io.fluidsonic.compiler.*

val result = KotlinCompiler()
    .includesCurrentClasspath()
    .jvmTarget(KotlinJvmTarget.v1_8)
    .processors(MyAnnotationProcessor())
    .sources("sources", "more-sources/Example.kt")
    .compile()

// result.exitCode contains the exit code of the compiler
// result.messages contains all messages printed during compilation and annotation processing
// result.generatedFiles contains all files generated by annotation processors

Additional configuration

    .destination("output")
    .kotlinHome("/path/to/kotlin/home")
    .moduleName("my-module")

Manually setting compiler arguments

    .arguments {
        apiVersion = "1.2"
        languageVersion = "1.2"
        newInference = true
    }

For a complete list of all compiler arguments check out K2JVMCompilerArguments.

Manually setting Kapt options

    .kaptOptions {
        flags += KaptFlag.CORRECT_ERROR_TYPES
        mode = AptMode.STUBS_AND_APT
    }

For a complete list of all Kapt options check out KaptOptions.

License

Apache 2.0

Versions

Version
0.10.2
0.10.1