plugins {
    id("com.android.library")
    id("kotlin-android")
}

ext {
    PUBLISH_GROUP_ID = 'io.appwrite'
    PUBLISH_ARTIFACT_ID = 'sdk-for-android'
    PUBLISH_VERSION = System.getenv('SDK_VERSION')
    POM_URL = 'https://github.com/appwrite/sdk-for-android'
    POM_SCM_URL = 'https://github.com/appwrite/sdk-for-android'
    POM_ISSUE_URL = 'https://github.com/appwrite/sdk-for-android/issues'
    POM_DESCRIPTION = 'Appwrite is an open-source backend as a service server that abstract and simplify complex and repetitive development tasks behind a very simple to use REST API. Appwrite aims to help you develop your apps faster and in a more secure way. Use the Android SDK to integrate your app with the Appwrite server to easily start interacting with all of Appwrite backend APIs and tools. For full API documentation and tutorials go to [https://appwrite.io/docs](https://appwrite.io/docs)'
    POM_LICENSE_URL = 'https://opensource.org/licenses/GPL-3.0'
    POM_LICENSE_NAME = "GPL-3.0"
    POM_DEVELOPER_ID = 'appwrite'
    POM_DEVELOPER_NAME = 'Appwrite Team'
    POM_DEVELOPER_EMAIL = 'team@appwrite.io'
    GITHUB_SCM_CONNECTION = 'scm:git:git://github.com/appwrite/sdk-for-android.git'
}

version PUBLISH_VERSION

android {
    namespace PUBLISH_GROUP_ID

    compileSdkVersion(34)

    buildFeatures {
        buildConfig true
    }

    defaultConfig {
        minSdkVersion(21)
        targetSdkVersion(34)
        versionCode = 1
        versionName = "1.0"
        buildConfigField "String", "SDK_VERSION", "\"${PUBLISH_VERSION}\""
        testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
        consumerProguardFiles("consumer-rules.pro")
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles(
                getDefaultProguardFile("proguard-android-optimize.txt"),
                "proguard-rules.pro"
            )
        }
    }
    kotlinOptions {
        jvmTarget = "1.8"
    }
}

dependencies {
    implementation("org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version")
    api("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.1")
    api("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.1")

    implementation("com.squareup.okhttp3:okhttp:4.12.0")
    implementation("com.google.code.gson:gson:2.10.1")

    implementation("androidx.lifecycle:lifecycle-runtime-ktx:2.7.0")
    implementation("androidx.lifecycle:lifecycle-common-java8:2.7.0")
    implementation("androidx.appcompat:appcompat:1.6.1")
    implementation("androidx.fragment:fragment-ktx:1.6.2")
    implementation("androidx.activity:activity-ktx:1.8.2")
    implementation("androidx.browser:browser:1.7.0")
    implementation("androidx.core:core-ktx:1.12.0")

    testImplementation("junit:junit:4.13.2")
    testImplementation("androidx.test.ext:junit-ktx:1.1.5")
    testImplementation("androidx.test:core-ktx:1.5.0")
    testImplementation("org.robolectric:robolectric:4.11.1")
    testApi("org.jetbrains.kotlinx:kotlinx-coroutines-test:1.7.1")
}

apply from: "${rootProject.projectDir}/scripts/publish-module.gradle"
