apply plugin: 'kotlin'
apply plugin: 'com.google.protobuf'
apply plugin: 'com.vanniktech.android.junit.jacoco'
apply plugin: 'maven'

group = Maven.GROUP

sourceSets {
    main.java.srcDirs += ['src/main/kotlin/', "$protobuf.generatedFilesBaseDir/main/javalite"]
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])

    implementation ModuleLib.KOTLIN
    implementation ModuleLib.COROUTINES_CORE
    implementation ModuleLib.PROTOBUF_LITE

    TestLib.all.forEach { testImplementation it }
}

test {
    useJUnitPlatform {
        includeEngines 'spek2'
    }
}

junitJacoco {
    jacocoVersion = '0.8.5'
    excludes = ['**/cafe/adriel/pufferdb/proto/**']
}

protobuf {
    protoc {
        artifact = ModuleLib.PROTOC
    }
    plugins {
        javalite {
            artifact = ModuleLib.PROTOC_LITE
        }
    }
    generateProtoTasks {
        all().each { task ->
            task.builtins {
                remove java
            }
            task.plugins {
                javalite { }
            }
        }
    }
}

sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
