apply plugin: 'kotlin'
apply plugin: 'kotlin-kapt'
apply plugin: 'io.johnsonlee.buildprops'

sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17

sourceSets {
    main {
        java {
            srcDirs += []
        }
        kotlin {
            srcDirs += ['src/main/kotlin', 'src/main/java']
        }
    }
    test {
        java {
            srcDirs += []
        }
        kotlin {
            srcDirs += ['src/main/kotlin', 'src/main/java']
        }
    }
}

compileKotlin {
    kotlinOptions{
        jvmTarget = JavaVersion.VERSION_17
        apiVersion = "1.5"
        freeCompilerArgs = ["-Xno-optimized-callable-references"]
    }
}

compileTestKotlin {
    kotlinOptions{
        jvmTarget = JavaVersion.VERSION_17
        apiVersion = "1.5"
        freeCompilerArgs = ["-Xno-optimized-callable-references"]
    }
}

dependencies {
    implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
    implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
    testImplementation "org.jetbrains.kotlin:kotlin-test:$kotlin_version"
    testImplementation "org.jetbrains.kotlin:kotlin-test-junit:$kotlin_version"
    testImplementation gradleTestKit()
}

project.tasks.named('packageSources') {
    dependsOn ":${project.name}:generateBuildJavaFile"
}

