plugins {
    id 'kotlin'
    id 'org.jetbrains.kotlin.jvm'
}

apply from: 'maven.gradle'


sourceSets {
    main.java.srcDirs += "$buildDir/generated/sources/java-templates/java/main"
}

compileKotlin {
    dependsOn 'copyJavaTemplates'
    kotlinOptions.freeCompilerArgs = ["-Xallow-result-return-type"]
}

task copyJavaTemplates(type: Copy) {
    from 'src/main/java-templates'
    into "$buildDir/generated/sources/java-templates/java/main"
    expand('projectVersion': "$plugin_version")
    filteringCharset = 'UTF-8'
}

dependencies {
    compileOnly gradleApi()
    api 'org.codehaus.groovy:groovy-xml:3.0.13'
    compileOnly 'org.ow2.asm:asm:9.3'
    compileOnly 'com.android.tools.build:gradle:8.0.2'
    compileOnly "com.bytedance.android:aabresguard-plugin:0.1.10"
//    compileOnly 'com.tencent.mm:AndResGuard-gradle-plugin:1.2.21'

    testImplementation 'junit:junit:4.13.2'
}

sourceCompatibility = "$jdk_version"
targetCompatibility = "$jdk_version"

kotlin {
    jvmToolchain(jdk_version as int)
}