buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath "com.android.tools.build:gradle:2.3.3"
    }
}

apply plugin: "com.android.library"

def safeExtGet(prop, fallback) {
    rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
}

def _reactNativeVersion = safeExtGet("reactNative", "+")
def _compileSdkVersion = safeExtGet("compileSdkVersion", 26)
def _glideVersion = safeExtGet("glideVersion", "4.9.0")

android {
    compileSdkVersion _compileSdkVersion
    buildToolsVersion safeExtGet("buildToolsVersion", "26.0.3")

    sourceSets {
        main {
            java {
                if (safeExtGet("excludeAppGlideModule", false)) {
                    srcDir "src"
                    exclude "**/FastImageGlideModule.java"
                }
            }
        }
    }

    defaultConfig {
        minSdkVersion safeExtGet("minSdkVersion", 16)
        targetSdkVersion safeExtGet("targetSdkVersion", 26)
        versionCode 1
        versionName "1.0"
    }
    lintOptions {
        abortOnError false
    }
}

repositories {
    mavenCentral()
    maven {
        url "https://maven.google.com"
    }
}

dependencies {
    //noinspection GradleDynamicVersion
    implementation "com.facebook.react:react-native:${_reactNativeVersion}"
    implementation "com.android.support:support-v4:${safeExtGet("supportLibVersion", "27.1.1")}"
    implementation("com.github.bumptech.glide:glide:${_glideVersion}") {
        exclude group: "com.android.support", module: "glide"
    }
    implementation("com.github.bumptech.glide:annotations:${_glideVersion}") {
        exclude group: "com.android.support", module: "annotations"
    }
    annotationProcessor "com.github.bumptech.glide:compiler:${_glideVersion}"
    implementation("com.github.bumptech.glide:okhttp3-integration:${_glideVersion}") {
        exclude group: "com.android.support", module: "okhttp3-integration"
        exclude group: "com.android.support", module: "glide-parent"
    }
}
