apply plugin: 'com.android.library'

if (!hasProperty('DISABLE_ERROR_PRONE')) {
    apply plugin: "net.ltgt.errorprone"
}

tasks.withType(JavaCompile) {
    options.fork = true
}

dependencies {
    api project(':third_party:gif_decoder')
    api project(':third_party:disklrucache')
    api project(':annotation')
    api "com.android.support:support-fragment:${ANDROID_SUPPORT_VERSION}"
    api "com.android.support:animated-vector-drawable:${ANDROID_SUPPORT_VERSION}"
    compileOnly "com.android.support:appcompat-v7:${ANDROID_SUPPORT_VERSION}"

    if (project.plugins.hasPlugin('net.ltgt.errorprone')) {
        errorprone "com.google.errorprone:error_prone_core:${ERROR_PRONE_VERSION}"
    }

    testImplementation "com.android.support:appcompat-v7:${ANDROID_SUPPORT_VERSION}"
    testImplementation project(':testutil')
    testImplementation 'com.google.guava:guava-testlib:18.0'
    testImplementation "com.google.truth:truth:${TRUTH_VERSION}"
    testImplementation "junit:junit:${JUNIT_VERSION}"
    testImplementation "org.mockito:mockito-core:${MOCKITO_VERSION}"
    testImplementation "org.robolectric:robolectric:${ROBOLECTRIC_VERSION}"
    testImplementation "com.squareup.okhttp3:mockwebserver:${MOCKWEBSERVER_VERSION}"
    testImplementation "com.android.support:support-v4:${ANDROID_SUPPORT_VERSION}"
}

android {
    compileSdkVersion COMPILE_SDK_VERSION as int

    defaultConfig {
        minSdkVersion MIN_SDK_VERSION as int
        targetSdkVersion TARGET_SDK_VERSION as int
        versionName VERSION_NAME as String
        consumerProguardFiles 'proguard-rules.txt'
    }

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_7
        targetCompatibility JavaVersion.VERSION_1_7
    }
}

check.dependsOn(':library:findbugs:findbugs')
check.dependsOn(':library:pmd:pmd')
check.dependsOn(':library:test:check')

// Used in pmd and findbugs subprojects.
@SuppressWarnings("GroovyUnusedDeclaration")
def classPathForQuality() {
    return files(
            android.bootClasspath,
            project.configurations.compile,
            project.android.libraryVariants.collect { it.javaCompile.classpath }
    )
}

apply from: "${rootProject.projectDir}/scripts/upload.gradle"
