plugins {
    id 'com.android.application'
    id 'org.jetbrains.kotlin.plugin.serialization' version '2.4.0'
    id 'org.jetbrains.kotlin.plugin.compose' version '2.4.10'
    id 'com.mikepenz.aboutlibraries.plugin' version '15.0.3'
}

android {
    namespace 'net.helcel.beans'
    compileSdk = 37

    defaultConfig {
        buildConfigField("String", "APP_NAME", "\"Beans\"")
        manifestPlaceholders["APP_NAME"] = "Beans"
        applicationId 'net.helcel.beans'
        minSdk = 28
        targetSdk = 37
        versionName "1.5"
        versionCode project.hasProperty('VERSION_CODE') ? project.property('VERSION_CODE').toInteger() : 1
    }
    signingConfigs {
        register("release") {
            try {
                def keystorePropertiesFile = rootProject.file("app/keystore.properties")
                def keystoreProperties = new Properties()
                keystoreProperties.load(new FileInputStream(keystorePropertiesFile))

                keyAlias keystoreProperties['keyAlias']
                keyPassword keystoreProperties['keyPassword']
                storeFile file(keystoreProperties['storeFile'])
                storePassword keystoreProperties['storePassword']
            } catch (FileNotFoundException e) {
                println("File not found: ${e.message}")
            }
        }
    }
    buildTypes {
        debug {
            debuggable true
        }
        release {
            minifyEnabled true
            shrinkResources true
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
        signedRelease {
            minifyEnabled true
            shrinkResources true
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
            signingConfig = signingConfigs.getByName("release")
        }
    }
    compileOptions {
        coreLibraryDesugaringEnabled true

        sourceCompatibility JavaVersion.VERSION_21
        targetCompatibility JavaVersion.VERSION_21
        encoding 'utf-8'
    }

    buildFeatures {
        viewBinding true
        compose true
        buildConfig true
    }

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

    lint {
        disable 'UsingMaterialAndMaterial3Libraries'
    }

}
aboutLibraries {
    library {
        exclusionPatterns = [~"androidx.*", ~"com.google.android.*", ~"org.jetbrains.*"]
    }
}

dependencies {
    implementation 'androidx.compose.material3:material3:1.4.0'
    implementation "androidx.compose.material:material:1.11.4"
    implementation 'androidx.compose.material:material-icons-extended:1.7.8'
    implementation 'androidx.navigation:navigation-compose:2.9.8'
    coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs_nio:2.1.5'

    implementation 'org.jetbrains.kotlinx:kotlinx-serialization-json:1.11.0'

    implementation 'androidx.preference:preference-ktx:1.2.1'
    implementation 'androidx.compose.ui:ui'
    implementation "androidx.activity:activity-ktx:1.13.0"

    implementation 'androidx.compose.ui:ui-tooling-preview'
    implementation 'com.google.android.material:material:1.14.0'
    implementation 'org.jetbrains.kotlinx:kotlinx-serialization-json:1.11.0'

    implementation 'com.caverock:androidsvg-aar:1.4'
    implementation 'com.github.chrisbanes:PhotoView:2.3.0'

    implementation 'com.mikepenz:aboutlibraries:14.2.1'
    implementation 'com.mikepenz:aboutlibraries-compose-m3:15.0.3'
    implementation 'com.mikepenz:aboutlibraries-core:15.0.3'


    implementation platform('androidx.compose:compose-bom:2026.06.01')
    debugImplementation 'androidx.compose.ui:ui-tooling:1.11.4'
}

tasks.configureEach { task ->
    if (task.name.startsWith("merge") && task.name.endsWith("Assets")) {
        task.outputs.upToDateWhen { false }
    }
}