buildscript {
    // Buildscript is evaluated before everything else so we can't use safeExtGet
    def kotlinVersion = rootProject.ext.has('kotlinVersion') ? rootProject.ext.get('kotlinVersion') : '1.3.40'

    repositories {
        jcenter()
        google()
    }

    dependencies {
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
    }
}

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

apply plugin: 'com.android.library'

android {
    compileSdkVersion safeExtGet('compileSdkVersion', 28)
    buildToolsVersion safeExtGet('buildToolsVersion', '28.0.3')

    defaultConfig {
        minSdkVersion safeExtGet('minSdkVersion', 16)
        targetSdkVersion safeExtGet('targetSdkVersion', 28)
        versionCode 1
        versionName "1.0"

        consumerProguardFiles 'proguard-rules.pro'

        ndk {
            abiFilters 'armeabi', 'armeabi-v7a', 'arm64-v8a'
        }

        manifestPlaceholders = [
            MTA_APPKEY: '',
            MTA_CHANNEL: ''
        ]
    }
    lintOptions {
        abortOnError false
    }
}

dependencies {
    implementation "com.facebook.react:react-native:${safeExtGet('reactNativeVersion', '+')}"
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:${safeExtGet('kotlinVersion', '1.3.40')}"
    implementation 'com.github.herokotlin:Permission:0.0.5'
    implementation 'com.qq.mta:mta:3.4.7-Release'
    implementation 'com.tencent.mid:mid:4.0.7-Release'
}

apply plugin: 'kotlin-android'