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

allprojects {
    repositories {
        mavenLocal()
        mavenCentral()
        maven {
            // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
            url "$projectDir/../../react-native/android"
        }
    }
}

apply plugin: 'com.android.library'

android {
    compileSdkVersion rootProject.hasProperty('compileSdkVersion') ? rootProject.compileSdkVersion : 28
    buildToolsVersion rootProject.hasProperty('buildToolsVersion') ? rootProject.buildToolsVersion : '28.0.3'

    defaultConfig {
        minSdkVersion rootProject.hasProperty('minSdkVersion') ? rootProject.minSdkVersion : 16
        targetSdkVersion rootProject.hasProperty('targetSdkVersion') ? rootProject.targetSdkVersion : 28
    }
    buildTypes {
        debug {
            jniDebuggable true
        }
    }

    // Do not strip debug symbols from debug builds of Realm
    buildTypes {
        debug {
            packagingOptions {
                if (com.android.builder.model.Version.ANDROID_GRADLE_PLUGIN_VERSION.compareTo("4.2") >= 0) {
                    jniLibs.keepDebugSymbols += "**/librealm.so"
                } else {
                    doNotStrip "**/librealm.so"
                }
            }
        }
    }
}

def dependencyType = 'implementation'
try {
    project.getConfigurations().getByName('implementation')
} catch (UnknownConfigurationException e) {
    dependencyType = 'compile' // Pre 3.0 Android Gradle Plugin
}

project.dependencies {
    add(dependencyType, fileTree(dir: 'libs', include: ['*.jar']))
    add(dependencyType, 'com.facebook.react:react-native:+')
}
