import static org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_1_9

plugins {
    id 'org.jetbrains.intellij' version '1.16.0'
    id 'org.jetbrains.kotlin.jvm' version '1.9.0'
}

repositories {
    mavenCentral()
}

dependencies {
    testImplementation 'org.mockito:mockito-inline:5.2.0'
}

sourceSets {
    main {
        kotlin.srcDirs 'src'
        resources.srcDirs 'resources'
    }
    test {
        kotlin.srcDirs 'test'
    }
}

kotlin {
    jvmToolchain(17)
}
compileKotlin {
    compilerOptions {
        apiVersion.set(KOTLIN_1_9)
        languageVersion.set(KOTLIN_1_9)
        // Compiler flag to allow building against pre-released versions of Kotlin
        // because IJ EAP can be built using pre-released Kotlin but it's still worth doing to check API compatibility
        freeCompilerArgs = ["-Xskip-metadata-version-check"]
    }
}

intellij {
    // To find available IDE versions see https://www.jetbrains.com/intellij-repository/releases
    // and https://www.jetbrains.com/intellij-repository/snapshots
    version = '241.14494.240' // 2024.1 which shows errors for actions without getActionUpdateThread()
    pluginName = 'Scratch'
    downloadSources = true
    sameSinceUntilBuild = false
    updateSinceUntilBuild = false
}