plugins {
    id "com.android.application"
    id "kotlin-android"
}

static def countCommits() {
    def text = 'git rev-list --count HEAD'.execute().text.trim()
    return text == '' ? 0 : text.toInteger()
}

android {
    compileSdkVersion 30

    defaultConfig {
        applicationId "altermarkive.guardian"
        minSdkVersion 16
        targetSdkVersion 30
        versionCode countCommits()
        versionName "0.0.0"
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro"
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
    kotlinOptions {
        jvmTarget = "1.8"
    }
    buildFeatures {
        viewBinding true
    }
}

dependencies {
    implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
    implementation "androidx.core:core-ktx:1.6.0"
    implementation "androidx.appcompat:appcompat:1.3.1"
    implementation "androidx.constraintlayout:constraintlayout:2.1.0"
    implementation "androidx.vectordrawable:vectordrawable:1.1.0"
    implementation "androidx.lifecycle:lifecycle-livedata-ktx:2.3.1"
    implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.3.1"
    implementation "androidx.navigation:navigation-fragment-ktx:2.3.5"
    implementation "androidx.navigation:navigation-ui-ktx:2.3.5"
    implementation "androidx.preference:preference-ktx:1.1.1"
    implementation "com.google.android.material:material:1.4.0"
    implementation group: 'com.github.ipfs', name: 'java-ipfs-http-client', version: 'v1.3.3'
}