继续操作前请注册或者登录。
build.gradle 1.3 KB
plugins {
    id 'java-library'
    id 'kotlin'
    id 'kotlin-kapt'
}

java {
    sourceCompatibility = java_version
    targetCompatibility = java_version
}
// From Gradle 8 onwards, Kapt no longer automatically picks up jvmTarget
// from normal KotlinOptions. Must be manually set.
// JvmToolchain should not be used since it changes the actual JDK used.
tasks.withType(org.jetbrains.kotlin.gradle.tasks.BaseKotlinCompile).configureEach {
    kotlinOptions {
        jvmTarget = java_version
    }
}
compileKotlin {
    kotlinOptions {
        jvmTarget = java_version
    }
}

dependencies {

    compileOnly "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    // used for lint rules
    compileOnly libs.lint.api
    compileOnly libs.lint.checks
    compileOnly libs.lint.tests

    // Handle creating manifests for lint checker
    compileOnly libs.auto.service.annotations
    kapt libs.auto.service.compiler

    // test lint
    testImplementation libs.lint.lib
    testImplementation libs.lint.tests

    compileOnly "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
    // test runners
    testImplementation libs.junit
    testImplementation libs.junitJupiterApi
    testRuntimeOnly libs.junitJupiterEngine
}
test {
    environment "LINT_TEST_KOTLINC", ""
}