apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: 'org.jetbrains.dokka-android'
apply plugin: 'com.github.dcendents.android-maven'
apply plugin: 'com.jfrog.bintray'

buildscript {
    dependencies {
        classpath deps.buildscript.dokka
        classpath deps.buildscript.bintray
    }
}

android {
    compileSdkVersion versions.compileSdk
    buildToolsVersion versions.buildTools

    defaultConfig {
        minSdkVersion versions.minSdk
        versionCode Integer.parseInt(project.VERSION_CODE)
        versionName project.VERSION_NAME
    }

    sourceSets {
        main.java.srcDirs += 'src/main/kotlin'
        test.java.srcDirs += 'src/test/kotlin'
    }
}

dependencies {
    api deps.kotlinStdlib
    api deps.timber

    testImplementation deps.junit
    testImplementation(deps.mockitoKotlin) { exclude module: 'kotlin-stdlib' }
    testImplementation deps.assertj
    testImplementation deps.robolectric
}

task sourcesJar(type: Jar) {
    from android.sourceSets.main.java.srcDirs
    classifier = 'sources'
}

task javadocJar(type: Jar, dependsOn: dokka) {
    classifier = 'javadoc'
    from dokka.outputDirectory
}

artifacts {
    archives sourcesJar
    archives javadocJar
}

ext {
    pkgName = 'timberkt'
    pkgDesc = 'Easy Android logging with Kotlin and Timber '
    githubRepo = 'github.com/ajalt/timberkt'
    pkgLicense = 'Apache-2.0'
    pkgLicenseUrl = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
    devInfo = {
        id 'ajalt'
        name 'AJ Alt'
        url 'https://github.com/ajalt'
    }
    bintrayUser = System.getenv('BINTRAY_USER')
    bintrayKey = System.getenv('BINTRAY_API_KEY')
    mavenUserToken = System.getenv('MAVEN_USER_TOKEN')
    mavenUserPass = System.getenv('MAVEN_USER_PASS')
    deployDryRun = false
}

apply from: new File(rootDir, 'deploy.gradle')
