plugins {
    id 'com.android.application'
    id 'org.jetbrains.kotlin.android'
    id 'com.google.gms.google-services'
    id "io.sentry.android.gradle" version "3.1.2"
}

def getGitHash = { ->
    def stdout = new ByteArrayOutputStream()
    exec {
        commandLine 'git', 'rev-parse', '--short', 'HEAD'
        standardOutput = stdout
    }
    return stdout.toString().trim()
}

android {
    compileSdk 33

    buildToolsVersion "32.0.0"

    defaultConfig {
        applicationId "com.httpsms"
        minSdk 26
        targetSdk 33
        versionCode 1
        versionName "${getGitHash()}"

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }

    buildTypes {
        debug {
            manifestPlaceholders["sentryEnvironment"] = "development"
        }
        release {
            manifestPlaceholders["sentryEnvironment"] = "production"
            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'
    }
    namespace 'com.httpsms'
}

dependencies {
    implementation platform('com.google.firebase:firebase-bom:30.1.0')
    implementation 'com.google.firebase:firebase-analytics-ktx'
    implementation 'com.google.firebase:firebase-messaging-ktx'
    implementation 'com.squareup.okhttp3:okhttp:4.10.0'
    implementation 'com.jakewharton.timber:timber:5.0.1'
    implementation 'androidx.preference:preference:1.2.0'
    implementation 'androidx.work:work-runtime-ktx:2.7.1'
    implementation 'androidx.core:core-ktx:1.9.0'
    implementation "androidx.cardview:cardview:1.0.0"
    implementation 'com.beust:klaxon:5.5'
    implementation 'androidx.appcompat:appcompat:1.6.1'
    implementation 'org.apache.commons:commons-text:1.9'
    implementation 'com.google.android.material:material:1.8.0'
    implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
    testImplementation 'junit:junit:4.13.2'
    androidTestImplementation 'androidx.test.ext:junit:1.1.5'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
}
