/**
 * The android convention adds the android application module
 * and applies default android configurations such as the compile
 * sdk and target sdk versions.
 *
 * Apply this convention using:
 *
 * plugins {
 *   id 'prestoplay.android-module-convention'
 * }
 */
plugins {
    id 'com.android.application'
}

group "com.castlabs.player.demo"

def demoVersion = hasProperty("ref_version")? getProperty("ref_version") : "0.0.0-dev"

android {
    compileSdkVersion getProperty("android.compileSdk").toInteger()

    compileOptions {
        sourceCompatibility getProperty("javaSourceCompatibility")
        targetCompatibility getProperty("javaTargetCompatibility")
        coreLibraryDesugaringEnabled true
    }

    defaultConfig {
        applicationId "com.castlabs.sdk.${project.name}"
        versionName = "${version}"
        minSdkVersion getProperty("android.minSdk").toInteger()
        targetSdkVersion getProperty("android.targetSdk").toInteger()
        consumerProguardFiles.add(file("proguard.txt"))

        buildConfigField "String", "VERSION_NAME", "\"${demoVersion}\""

        manifestPlaceholders = [
            castlabsLicense: "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJwYWNrYWdlTmFtZSI6ImNvbS5jYXN0bGFicy5zZGsiLCJzaGExIjoiOEQ6Q0Q6MUM6Q0Y6NzM6NEM6N0Q6OTA6NEE6N0Y6MTg6NUE6OEQ6Njg6OEU6Mjk6RjY6Rjg6MTA6NDQiLCJraWQiOjQ0OH0.TnQNz69sAxdJ7bUw_-Nd2YOL5XfeodOA3w6vFSszPV_vjUGuHfR2JzFMVCjkpXLWnOzUAkUiff3ou5zBeK64pur_fdTJqtvTdpNXat5IiqvBzJpMvcnU0uZuN5x-NkEnHbTy7pOs1VkSol2rbxwh1O7NblYN9NqV95KFET9C9NoUboENU-WgLi9uoSHkMiM_6WgsKJheNGavMjrkemQyAf7arKOOiUtP8OwqI8Xjsu52ZaZmEhLn3-UhfZkeIqoSSInQHv-falWYkKKvlks6yULeWLgyFZqXlDv9u_V_dAU1hYTb-SCKpz3GwzJKxyMxa-7PdaVgXogr0M90E8KvZA"]

        multiDexEnabled true
    }

    buildFeatures {
        buildConfig true
    }

    signingConfigs {
        debug {
            storeFile file("${project.rootDir}/keys/castlabs_development.keystore")
            storePassword "castlabs"
            keyAlias "castlabs_development"
            keyPassword "castlabs"
        }
        release {
            storeFile file("${project.rootDir}/keys/castlabs_development.keystore")
            storePassword "castlabs"
            keyAlias "castlabs_development"
            keyPassword "castlabs"
        }
    }

    buildTypes {
        debug {
            debuggable true
            minifyEnabled false
        }
        release {
            signingConfig signingConfigs.release
            debuggable false
            minifyEnabled true
        }
    }

    compileOptions {
        coreLibraryDesugaringEnabled true
    }
}

dependencies {
    coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:2.1.5'
}

dependencies {
    coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:2.1.5'
}
