apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
apply plugin: 'kotlinx-serialization'

android {
    dataBinding {
        enabled = true
    }

    packaging {
        resources.excludes.addAll(
                [
                        "META-INF/LICENSE.md",
                        "META-INF/NOTICE.md",
                        "META-INF/LICENSE-notice.md"
                ]
        )
    }

    defaultConfig {
        applicationId "de.jrpie.android.launcher"
        minSdkVersion 21
        targetSdkVersion 35
        compileSdk 35
        versionCode 40
        versionName "0.1.0"

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_17
        targetCompatibility JavaVersion.VERSION_17
    }
    kotlinOptions {
        jvmTarget = '17'
    }

    buildFeatures {
        viewBinding true
    }


    buildTypes {
        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
        debug {
            applicationIdSuffix = ".debug"
            versionNameSuffix = "-debug"
        }
    }

    flavorDimensions += "distribution"

    productFlavors {
        create("default") {
            dimension = "distribution"
            getIsDefault().set(true)
            buildConfigField "boolean", "USE_ACCESSIBILITY_SERVICE", "true"
        }
        create("accrescent") {
            dimension = "distribution"
            applicationIdSuffix = ".accrescent"
            versionNameSuffix = "+accrescent"
            buildConfigField "boolean", "USE_ACCESSIBILITY_SERVICE", "false"
        }
    }

    sourceSets {
        accrescent {
            manifest.srcFile 'src/accrescent/AndroidManifest.xml'
        }
    }

    namespace 'de.jrpie.android.launcher'
    buildFeatures {
        buildConfig true
    }

    dependenciesInfo {
        // Disables dependency metadata when building APKs.
        includeInApk = false
        // Disables dependency metadata when building Android App Bundles.
        includeInBundle = false
    }

    lintOptions {
        abortOnError false
    }

}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    implementation 'androidx.activity:activity:1.8.0'
    implementation 'androidx.appcompat:appcompat:1.7.0'
    implementation 'androidx.core:core-ktx:1.15.0'
    implementation 'androidx.constraintlayout:constraintlayout:2.2.0'
    implementation 'androidx.gridlayout:gridlayout:1.0.0'
    implementation 'androidx.palette:palette-ktx:1.0.0'
    implementation 'androidx.recyclerview:recyclerview:1.4.0'
    implementation 'androidx.preference:preference-ktx:1.2.1'
    implementation 'com.google.android.material:material:1.12.0'
    implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.7.3")
    implementation "eu.jonahbauer:android-preference-annotations:1.1.2"
    annotationProcessor "eu.jonahbauer:android-preference-annotations:1.1.2"
    annotationProcessor "com.android.databinding:compiler:$android_plugin_version"
    testImplementation 'junit:junit:4.13.2'
    androidTestImplementation 'androidx.test.ext:junit:1.2.1'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.6.1'
}