apply plugin: 'com.android.library'
apply plugin: 'net.grandcentrix.gradle.publish'

android {
    compileSdkVersion COMPILE_SDK_VERSION

    defaultConfig {
        minSdkVersion MIN_SDK_VERSION
        targetSdkVersion TARGET_SDK_VERSION
        versionCode VERSION_CODE
        versionName VERSION_NAME
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
        consumerProguardFiles 'proguard-rules.txt'
    }
    buildTypes {
        release {
            minifyEnabled false
        }
        debug {
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
    lintOptions {
        abortOnError false
    }
    packagingOptions {
        exclude 'META-INF/LICENSE'
    }
}

configurations {
    lintChecks
}

dependencies {
    compileOnly "androidx.appcompat:appcompat:$androidXAppCompatVersion"
    compileOnly "androidx.annotation:annotation:$androidXAnnotationVersion"

    testCompileOnly "androidx.annotation:annotation:$androidXAnnotationVersion"
    testImplementation "junit:junit:$junitVersion"
    testImplementation "org.mockito:mockito-core:$mockitoVersion"
    testImplementation "org.assertj:assertj-core:$assertjVersion"

    androidTestImplementation "androidx.test:runner:$androidXTestRunnerVersion"
    androidTestImplementation "org.mockito:mockito-core:$mockitoVersion"
    androidTestImplementation "org.assertj:assertj-core:$assertjVersion"

    lintChecks project(path: ":thirtyinch-lint", configuration: "lintChecks")
}

task copyLintJar(type: Copy) {
    from(configurations.lintChecks) {
        rename { String fileName -> 'lint.jar' }
    }
    into 'build/intermediates/lint/'
}

project.afterEvaluate {
    def compileLintTask = project.tasks.find { it.name == 'compileLint' }
    compileLintTask.dependsOn(copyLintJar)
}
