plugins {
    id 'software.amazon.lib.jvm'
    alias(libs.plugins.ksp)
}

test {
    useJUnitPlatform()

    maxHeapSize = "2g"
}

dependencies {
    implementation project(':compiler-utils')
    implementation project(':runtime')
    implementation libs.ksp.api

    implementation libs.kotlin.poet
    implementation libs.kotlin.poet.ksp

    implementation libs.auto.service.annotations
    ksp libs.auto.service.ksp

    // Gives us access to annotations.
    implementation libs.kotlin.inject.runtime

    testImplementation(testFixtures(project(':compiler-utils')))
    testImplementation project(':runtime-optional')
    testImplementation libs.assertk
    testImplementation libs.kotlin.compile.testing.core
    testImplementation libs.kotlin.compile.testing.ksp
    testImplementation libs.kotlin.reflect

    testImplementation platform(libs.junit.jupiter.bom)
    testImplementation libs.junit.jupiter.core
    testRuntimeOnly libs.junit.jupiter.launcher

    // Added so that the SymbolProcessor is picked up in tests.
    testImplementation libs.kotlin.inject.ksp

    // Bump transitive dependency.
    testImplementation libs.kotlin.compiler.embeddable
    testImplementation libs.ksp
    testImplementation libs.ksp.embeddable
}

tasks.named("test").configure {
    def useKsp2 = providers.gradleProperty('ksp.useKSP2')
    doFirst {
        logger.lifecycle("Using ksp2 = ${useKsp2.get()}")
    }
}
