buildscript {
    ext.safeExtGet = { prop, fallback ->
        return rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
    }

    repositories {
        google()
        jcenter()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:4.0.1'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${safeExtGet('kotlinVersion', '1.4.10')}"
    }
}

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

apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'

android {
    compileSdkVersion safeExtGet('compileSdkVersion', 29)
    buildToolsVersion safeExtGet('buildToolsVersion', '29.0.3')

    defaultConfig {
        minSdkVersion safeExtGet('minSdkVersion', 16)
        targetSdkVersion safeExtGet('targetSdkVersion', 29)
    }
}

repositories {
    google()
    jcenter()
    mavenCentral()
}

dependencies {
    implementation "org.jetbrains.kotlin:kotlin-stdlib:${safeExtGet('kotlinVersion', '1.4.10')}"
    //noinspection GradleDynamicVersion
    implementation 'com.facebook.react:react-native:+'

    implementation 'org.apache.commons:commons-text:1.9'
    // Gson
    implementation 'com.google.code.gson:gson:2.8.6'
    // Android interceptor
    implementation "com.squareup.okhttp3:okhttp:${safeExtGet('okhttpVersion', '3.14.9')}"
    implementation "com.squareup.okhttp3:okhttp-urlconnection:${safeExtGet('okhttpVersion', '3.14.9')}"
    implementation "com.squareup.okhttp3:logging-interceptor:${safeExtGet('okhttpVersion', '3.14.9')}"
}
