buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'de.mobilej.unmock:UnMockPlugin:0.3.6'
    }
}

apply plugin: 'com.android.library'
apply plugin: 'de.mobilej.unmock'

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

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_7
        targetCompatibility JavaVersion.VERSION_1_7
    }

    defaultConfig {
        minSdkVersion rootProject.ext.minSdkVersion
        targetSdkVersion rootProject.ext.targetSdkVersion
        versionCode Integer.parseInt(project.VERSION_CODE)
        versionName project.VERSION_NAME
        consumerProguardFiles 'proguard-rules.txt'
    }
}

configurations {
    lintChecks
}

dependencies {
    testCompile rootProject.ext.junit
    testCompile rootProject.ext.roboelectric

    compile rootProject.ext.supportAnnotations

    lintChecks project(path: ':conductor-lint', configuration: 'lintChecks')
}

unMock {
    downloadFrom 'https://oss.sonatype.org/content/groups/public/org/robolectric/android-all/4.3_r2-robolectric-0/android-all-4.3_r2-robolectric-0.jar'

    keep "android.os.Bundle"
    keep "android.os.BaseBundle"
    keep "android.text.TextUtils"
}

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

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

ext.artifactId = 'conductor'

apply from: rootProject.file('dependencies.gradle')
apply from: rootProject.file('gradle-mvn-push.gradle')
