plugins {
    id 'com.android.application'
}

android {
    namespace 'in.hridayan.xmlforge'
    compileSdk 34

    defaultConfig {
        applicationId "in.hridayan.xmlforge"
        minSdk 21
        targetSdk 34
        versionCode 2
        versionName "v1.1.0"

        vectorDrawables {
            useSupportLibrary true
        }
    }

    lint {
        baseline = file("lint-baseline.xml")
    }

    signingConfigs {
        release {
            if (System.getenv("CI") == "true") {
                storeFile file(System.getenv("KEYSTORE_PATH"))
                storePassword System.getenv("KEYSTORE_PASSWORD")
                keyAlias System.getenv("KEY_ALIAS")
                keyPassword System.getenv("KEY_PASSWORD")
            }
        }
    }

    buildTypes {
        release {
            signingConfig signingConfigs.findByName("release")
            minifyEnabled true
            shrinkResources true
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }

    applicationVariants.configureEach { variant ->
        variant.outputs.configureEach { output ->
            def buildTypeName = variant.buildType.name
            outputFileName = "XMLForge ${variant.versionName}-${buildTypeName}.apk"
        }
    }

    buildFeatures {
        buildConfig = true
        viewBinding true
    }
    
   androidResources { generateLocaleConfig true }

    dependenciesInfo {
        includeInApk = false
        includeInBundle = false
    }
}

dependencies {
    def material_version = "1.13.0-alpha10"
    def preference_version = "1.2.1"
    def lifecycle_version = "2.7.0"

    implementation "com.google.android.material:material:$material_version"
    implementation "androidx.lifecycle:lifecycle-viewmodel:$lifecycle_version"
    implementation 'javax.annotation:javax.annotation-api:1.3.2'
    implementation "androidx.preference:preference:$preference_version"
    implementation "org.apache.commons:commons-text:1.9"
}