// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
    repositories {
        google()
        maven { url 'https://oss.sonatype.org/content/repositories/snapshots/' }
        mavenCentral()

    }
    dependencies {
        classpath 'com.android.tools.build:gradle:7.2.2'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        google()
        mavenCentral()
        maven { url 'https://oss.sonatype.org/content/repositories/snapshots/' }
        maven { url 'http://developer.huawei.com/repo/' }
        maven { url "https://jitpack.io" }
    }
}

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

ext {
    compileSdkVersion = 32
    minSdkVersion = 21
    targetSdkVersion = 32

    ndkAbis = [
            'armeabi-v7a',
            'x86',
            'arm64-v8a',
            'x86_64'
    ]
    AppKey = ''
    BaseUrl = ''
}
def loadLocalConfig() {
    String env = System.getProperty("env", "test")
    if (env != "test") env = "online"
    println "env=$env"
    def propertiesFile = file("config/${env}.properties")
    if (!propertiesFile.exists()) {
        println "Local properties don't exist."
        return
    }
    Properties config = new Properties()
    config.load(propertiesFile.newInputStream())
    this.AppKey = config.getProperty('APP_KEY')
    this.BaseUrl = config.getProperty('BASE_URL')
}

loadLocalConfig()