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

// Google Play Services 12.0.x to 15.0.x depends on support libraries 26.1.0
def _playServicesLocationVersion = safeExtGet('playServicesLocation', '16.0.0')
def _buildToolsVersion      = safeExtGet('buildToolsVersion', '28.0.3')
def _compileSdkVersion      = safeExtGet('compileSdkVersion', 28)
def _targetSdkVersion       = safeExtGet('targetSdkVersion', 28)
def _minSdkVersion          = safeExtGet('minSdkVersion', 16)
def _supportLibVersion      = safeExtGet('supportLibVersion', '28.0.0')

buildscript {
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.2.1'
    }
}

apply plugin: 'com.android.library'

android {
    compileSdkVersion _compileSdkVersion
    buildToolsVersion _buildToolsVersion

    defaultConfig {
        minSdkVersion _minSdkVersion
        targetSdkVersion _targetSdkVersion
        versionCode 2
        versionName '1.1.0'
    }
    lintOptions {
        abortOnError false
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
}

repositories {
    mavenLocal()
    google()
    jcenter()
    maven { url "$rootDir/../node_modules/react-native/android" }
}

dependencies {
    compileOnly 'com.facebook.react:react-native:+'
    implementation "com.google.android.gms:play-services-location:${_playServicesLocationVersion}"
    implementation "com.android.support:appcompat-v7:${_supportLibVersion}"
}

task customClean(type: Delete) {
    delete rootProject.buildDir
}

clean.dependsOn customClean
