File keystoreProperties = rootProject.file("keystore.properties")
def props = new Properties()
if (keystoreProperties.exists()) {
    props.load(new FileInputStream(keystoreProperties))
} else {
    props['keystorefile'] = 'none'
}

buildscript {
    ext.kotlin_version = '1.9.23'
    ext.versions = [
            'androidX'          : '1.0.0',
            'firebaseAnalytics' : '21.1.0',
    ]
    ext.sharedVersions = [

            LoganSquare          : '1.3.7',
            Jackson              : '2.12.1',
            ParcelablePlease     : '1.0.2',

            ExportablePreferences: '0.9.7',
            MariotakuCommons     : '0.9.22',
            ObjectCursor         : '0.9.21',
            RestFu               : '0.9.64',
    ]

    repositories {
        google()
        jcenter()
        maven { url 'https://jitpack.io' }
    }

    dependencies {
        classpath "com.android.tools.build:gradle:8.4.1"
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${kotlin_version}"
        classpath 'com.google.gms:google-services:4.4.1'
        classpath 'com.google.firebase:perf-plugin:1.4.2'
        // Add the Crashlytics Gradle plugin
        classpath 'com.google.firebase:firebase-crashlytics-gradle:3.0.1'
        classpath 'com.github.wyjsonGo.GoRouter:GoRouter-Gradle-Plugin:2.5.1'
    }

}

project.ext {
    //app info
    applicationId = "allen.town.focus.mastodon"
    compileSdkVersion = 35 //jdk need 17 and later
    minSdkVersion = 24
    targetSdkVersion = 35
    versionCode = 1668
    versionName = "2.12.3.20250713"

    // AndroidX
    annotationVersion = "1.2.0"
    appcompatVersion = "1.4.2"
    coreVersion = "1.5.0"
    fragmentVersion = "1.3.6"
    mediaVersion = "1.4.3"
    paletteVersion = "1.0.0"
    preferenceVersion = "1.2.0"
    recyclerViewVersion = "1.2.1"
    viewPager2Version = "1.1.0-beta01"
    workManagerVersion = "2.3.4"
    googleMaterialVersion = "1.7.0-alpha02"
    lifecycle_version = "2.0.0"

    // Third-party
    commonslangVersion = "3.7"
    commonsioVersion = "2.5"
    jsoupVersion = "1.15.1"
    glideVersion = "4.13.2"
    okhttpVersion = "3.12.10"
    okioVersion = "1.17.5"
    eventbusVersion = "3.2.0"
    rxAndroidVersion = "2.1.1"
    rxJavaVersion = "2.2.2"
    iconifyVersion = "2.2.2"
    exoPlayerVersion = "2.14.2"
    audioPlayerVersion = "v2.0.0"
    lattieVersion = "5.0.3"

    // Only used for free builds. This version should be updated regularly.
    conscryptVersion = "2.5.2"

    // Google Play build
    wearableSupportVersion = "2.6.0"
    playServicesVersion = "18.0.1"

    //Tests
    awaitilityVersion = "3.1.6"
    junitVersion = "4.13"
    robolectricVersion = "4.5-alpha-1"
    robotiumSoloVersion = "5.6.3"
    espressoVersion = "3.2.0"
    runnerVersion = "1.2.0"
    rulesVersion = "1.2.0"
}

allprojects {

    repositories {
        google()
        mavenCentral()
        maven { url "https://jitpack.io" }
        maven { url 'https://oss.sonatype.org/content/repositories/snapshots/' }
        //aliyun maven for old library
        maven { url "https://maven.aliyun.com/repository/central" }
        maven { url "https://maven.aliyun.com/repository/google" }
        maven { url "https://maven.aliyun.com/repository/gradle-plugin" }
        maven { url "https://maven.aliyun.com/repository/jcenter" }
        maven { url "https://maven.aliyun.com/repository/spring" }
        maven { url "https://maven.aliyun.com/repository/spring-plugin" }
        maven { url "https://maven.aliyun.com/repository/public" }
        maven { url "https://maven.aliyun.com/repository/releases" }
        maven { url "https://maven.aliyun.com/repository/snapshots" }
        maven { url "https://maven.aliyun.com/repository/grails-core" }
        maven { url "https://maven.aliyun.com/repository/mapr-public" }
        maven { url "https://maven.aliyun.com/repository/apache-snapshots" }
        flatDir { dirs 'lib' }
    }
    tasks.withType(org.jetbrains.kotlin.gradle.tasks.AbstractKotlinCompile).configureEach {
        kotlinOptions {
            jvmTarget = "17"
        }
    }
}
