apply plugin: 'com.android.library'
apply plugin: 'com.github.ben-manes.versions'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
apply plugin: 'de.mobilej.unmock'
apply from: "$rootDir/gradle/gradle-quality.gradle"

archivesBaseName = 'android-state'

android {
    compileSdkVersion rootProject.ext.compileSdkVersion
    buildToolsVersion rootProject.ext.buildToolsVersion

    resourcePrefix 'state_'

    useLibrary 'android.test.mock'

    defaultConfig {
        minSdkVersion rootProject.ext.minSdkVersion
        targetSdkVersion rootProject.ext.targetSdkVersion

        versionName project.VERSION_NAME
        versionCode Integer.parseInt(project.VERSION_CODE)

        consumerProguardFiles 'proguard.cfg'

        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_7
        targetCompatibility JavaVersion.VERSION_1_7
    }

    lintOptions {
        abortOnError true
    }

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

    testOptions {
        unitTests.returnDefaultValues = true
        unitTests.includeAndroidResources = true
        unitTests.all {
            testLogging {
                events 'passed', 'skipped', 'failed', 'standardOut', 'standardError'
            }
        }
    }
}

dependencies {
    implementation "androidx.fragment:fragment:1.0.0"
    lintChecks project(':library-lint')

    testImplementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion"

    testImplementation "junit:junit:$junitVersion"
    testImplementation "org.assertj:assertj-core:$assertjVersion"
    testImplementation "com.nhaarman:mockito-kotlin-kt1.1:$kotlinMockitoVersion"
    testImplementation "org.jetbrains.kotlin:kotlin-test:$kotlinVersion"
    testImplementation "org.jetbrains.kotlin:kotlin-test-junit:$kotlinVersion"

    kaptTest project(':processor')

    androidTestImplementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion"
    androidTestImplementation "androidx.annotation:annotation:1.0.0"
    androidTestImplementation "com.android.support.test:runner:$testRuleVersion"
    androidTestImplementation "com.android.support.test:rules:$testRuleVersion"
    androidTestImplementation "com.android.support.test.espresso:espresso-core:$espressoVersion"
    androidTestImplementation "com.squareup.assertj:assertj-android:$assertjAndroidVersion"

    kaptAndroidTest project(':processor')

    //noinspection GradleDependency
    unmock rootProject.ext.unmockVersion
}

apply from: "$rootDir/gradle/gradle-push.gradle"