apply plugin: 'com.android.library'
buildscript {
    repositories {
        jcenter()
        google()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:3.2.1'
    }
}

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

def _glideVersion = safeExtGet("glideVersion", "4.9.0")
def _photoDraweeViewVersion = safeExtGet("photoDraweeViewVersion", "2.0.0")
android {
    compileSdkVersion rootProject.hasProperty('compileSdkVersion') ? rootProject.compileSdkVersion : DEFAULT_COMPILE_SDK_VERSION
    buildToolsVersion rootProject.hasProperty('buildToolsVersion') ? rootProject.buildToolsVersion : DEFAULT_BUILD_TOOLS_VERSION

    defaultConfig {
        minSdkVersion rootProject.hasProperty('minSdkVersion') ? rootProject.minSdkVersion : DEFAULT_MIN_SDK_VERSION
        targetSdkVersion rootProject.hasProperty('targetSdkVersion') ? rootProject.targetSdkVersion : DEFAULT_TARGET_SDK_VERSION
        versionCode 1
        versionName "1.0"
    }
    splits {
        abi {
            reset()
            enable false
            universalApk true
            include "armeabi-v7a", "x86", "arm64-v8a", "x86_64"
        }
    }
    buildTypes {
        release {
            minifyEnabled false
        }
        debug {
            minifyEnabled false
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
    lintOptions {
        abortOnError false
    }
}

allprojects {
    repositories {
        mavenLocal()
        jcenter()
        maven {
            url "https://jitpack.io"
        }
        maven {
            // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
            url "$rootDir/../node_modules/react-native/android"
        }
        google()
    }
}

dependencies {
    implementation('com.facebook.react:react-native:+')
    implementation("me.relex:photodraweeview:${_photoDraweeViewVersion}")
    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"
    }
}
