// Top-level build file where you can add configuration options common to all sub-projects/modules.
Properties releaseProperties = new Properties()
File file = new File('release.properties')
if (file.canRead()) {
    releaseProperties.load(new FileInputStream(file))
}
ext {
    if (!hasProperty('RELEASE_STORE_FILE')) {
        RELEASE_STORE_FILE=releaseProperties.get('RELEASE_STORE_FILE', '~/.android/debug.keystore')
    }
    if (!hasProperty('RELEASE_KEY_ALIAS')) {
        RELEASE_KEY_ALIAS=releaseProperties.get('RELEASE_KEY_ALIAS', 'androiddebugkey')
    }
    if (!hasProperty('RELEASE_KEY_PASSWORD')) {
        RELEASE_KEY_PASSWORD=releaseProperties.get('RELEASE_KEY_PASSWORD', 'android')
    }
    if (!hasProperty('RELEASE_STORE_PASSWORD')) {
        RELEASE_STORE_PASSWORD=releaseProperties.get('RELEASE_STORE_PASSWORD', 'android')
    }

    compileApi = releaseProperties.get('COMPILE_API', 36)
    targetApi = releaseProperties.get('TARGET_API', 36)
    minApi = releaseProperties.get('MIN_API', 23)
    toolsVersion = releaseProperties.get('TOOLS_VERSION', '36.0.0')

    println '----------------- Project configuration -------------------'
    println 'RELEASE_STORE_FILE: ' + RELEASE_STORE_FILE
    println 'RELEASE_KEY_ALIAS:  ' + RELEASE_KEY_ALIAS
    println 'compile API:        ' + compileApi
    println 'target API:         ' + targetApi
    println 'min API:            ' + minApi
    println 'tools version:      ' + toolsVersion
    println '-----------------------------------------------------------'
}

buildscript {
    repositories {
        mavenCentral()
        google()
        maven {
            url 'https://maven.google.com'
        }
    }
    dependencies {
       classpath 'com.android.tools.build:gradle:8.13.0'
    }
}

allprojects {
    repositories {
        mavenCentral()
        google()
        maven {
            url 'https://maven.google.com'
        }
    }

    subprojects {
        afterEvaluate { project ->
            if (project.hasProperty('android')) {
                project.android {
                    if (namespace == null) {
                        namespace 'com.freerdp.' + project.name.toLowerCase()
                    }
                }
            }
        }
    }
}
