// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
    def taskRequests = getGradle().getStartParameter().getTaskRequests().toString().toLowerCase()
    def isPlay = !taskRequests.contains("foss")

    ext {
        // TODO: target 33
        buildToolsVersion = "31.0.0"
        minSdkVersion = 23
        compileSdkVersion = 31
        targetSdkVersion = 31
        if (System.properties['os.arch'] == "aarch64") {
            // For M1 Users we need to use the NDK 24 which added support for aarch64
            ndkVersion = "24.0.8215888"
        } else {
            // Otherwise we default to the side-by-side NDK version from AGP.
            ndkVersion = "21.4.7075529"
        }
        glideVersion = "4.11.0"
        kotlin_version = "1.6.10"
        kotlinVersion = '1.6.10'
        supportLibVersion = "28.0.0"
        libre_build = !(isPlay.toBoolean())
    }

    repositories {
        mavenLocal()
        google()
        maven {
            url 'https://maven.fabric.io/public'
        }
        mavenCentral()
    }

    dependencies {
        if (isPlay) {
            classpath 'com.google.gms:google-services:4.3.8'
            classpath 'com.google.firebase:firebase-crashlytics-gradle:2.9.0'
            classpath 'com.bugsnag:bugsnag-android-gradle-plugin:7.+'
        }
        classpath("com.android.tools.build:gradle:7.3.1")
        classpath("com.facebook.react:react-native-gradle-plugin")
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    }
}

allprojects {
    repositories {
        maven {
            url "$rootDir/../node_modules/detox/Detox-android"
        }
    }
}
