plugins {
    id("com.android.application")
//    id("com.google.gms.google-services")
    id("kotlinx-serialization")
}



android {
    ndkVersion "19.2.5345600"

    compileOptions {
        sourceCompatibility = JavaVersion.VERSION_17
        targetCompatibility = JavaVersion.VERSION_17
    }
    compileSdkVersion 34
    defaultConfig {
        applicationId 'io.geph.android'
        minSdkVersion 21
        targetSdkVersion 34
        versionCode 11082
        versionName '4.99.32'
        testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
        ndk {
            abiFilters 'armeabi-v7a', 'arm64-v8a'
        }
    }


    buildTypes {
        releaseAPK {
            minifyEnabled false
            shrinkResources false
            debuggable false
        }

        releasePlay {
            minifyEnabled false
            shrinkResources false
            debuggable false
        }

        debug {
            debuggable true
        }
    }
    externalNativeBuild {
        ndkBuild {
            path 'jni/Android.mk'
        }
    }
    productFlavors {
    }
    namespace 'io.geph.android'
    lint {
        abortOnError false
        checkReleaseBuilds false
    }
    buildFeatures {
        buildConfig true
    }
}

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation 'androidx.appcompat:appcompat:1.5.1'
    implementation 'com.google.android.material:material:1.7.0'
    implementation 'androidx.recyclerview:recyclerview:1.2.1'
    implementation 'com.squareup.retrofit2:retrofit:2.2.0'
    implementation 'com.squareup.retrofit2:converter-gson:2.2.0'
    implementation 'com.google.code.gson:gson:2.8.6'
    implementation 'com.android.volley:volley:1.1.0'
    implementation 'androidx.legacy:legacy-support-v4:1.0.0'
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    implementation files('jna-5.9.0.aar')
    implementation 'org.apache.commons:commons-text:1.9'
    implementation "androidx.webkit:webkit:1.5.0"
    implementation(platform("com.google.firebase:firebase-bom:32.7.1"))
    implementation "com.google.firebase:firebase-analytics"
    implementation "org.jetbrains.kotlinx:kotlinx-serialization-json:1.6.0"
}

task preBuildScript(type: Exec) {
    commandLine "bash", "PREBUILD.sh"
    workingDir rootProject.projectDir
}

task copyGephBinaries(type: Copy) {
    description = 'Copying geph binaries from the prebuild directory'
    from '../prebuild/'
    into 'src/main/jniLibs'
}

preBuild.dependsOn copyGephBinaries
copyGephBinaries.dependsOn preBuildScript

afterEvaluate {
    android.applicationVariants.all { variant ->
        variant.javaCompiler.dependsOn(copyGephBinaries)
    }
}

apply plugin: 'kotlin-android'

