// Generated by alef. Do not edit by hand.

import com.vanniktech.maven.publish.AndroidSingleVariantLibrary
import org.jetbrains.kotlin.gradle.dsl.JvmTarget

buildscript {
    dependencies {
        classpath("com.vanniktech:gradle-maven-publish-plugin:0.36.0")
    }
}

plugins {
    id("com.android.library") version "8.13.0"
    kotlin("android") version "2.3.21"
    id("com.vanniktech.maven.publish") version "0.36.0"
    id("org.jlleitschuh.gradle.ktlint") version "13.1.0"
    id("com.github.ben-manes.versions") version "0.52.0"
}

android {
    namespace = "dev.kreuzberg"
    compileSdk = 35

    defaultConfig {
        minSdk = 21
        consumerProguardFiles("consumer-rules.pro")
    }

    compileOptions {
        sourceCompatibility = JavaVersion.VERSION_17
        targetCompatibility = JavaVersion.VERSION_17
    }

    sourceSets {
        getByName("main") {
            jniLibs.srcDirs("src/main/jniLibs")
        }
    }
}

kotlin {
    compilerOptions {
        jvmTarget.set(JvmTarget.JVM_17)
    }
}

ktlint {
    version.set("1.8.0")
    android.set(true)
    ignoreFailures.set(false)
}

dependencies {
    implementation("org.jetbrains.kotlin:kotlin-stdlib")
    // Generated Kotlin facade uses suspend functions and Flow wrappers, both of
    // which require kotlinx-coroutines-android (transitively pulls -core).
    implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.11.0")
    // Generated sealed-class DTOs use Jackson @JsonDeserialize for polymorphic
    // serde-tagged unions; jackson-module-kotlin is required for Kotlin
    // data-class deserialization (handles nullable, default values, etc.).
    // jackson-datatype-jdk8 is required because the generated DefaultClient.kt
    // registers Jdk8Module for Optional<T> / java.util.Optional support.
    implementation("com.fasterxml.jackson.core:jackson-databind:2.21.3")
    implementation("com.fasterxml.jackson.module:jackson-module-kotlin:2.21.3")
    implementation("com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.21.3")
    testImplementation("junit:junit:4.13.2")
    androidTestImplementation("androidx.test.ext:junit:1.3.0")
    androidTestImplementation("androidx.test.espresso:espresso-core:3.7.0")
}

mavenPublishing {
    configure(AndroidSingleVariantLibrary(
        variant = "release",
        sourcesJar = com.vanniktech.maven.publish.SourcesJar.Sources(),
        javadocJar = com.vanniktech.maven.publish.JavadocJar.Empty(),
    ))

    publishToMavenCentral()
    signAllPublications()

    coordinates(
        groupId = "dev.kreuzberg",
        artifactId = "kreuzberg-android",
        version = "5.0.0-rc.3",
    )

    pom {
        name.set("kreuzberg-android")
        description.set("High-performance document intelligence library")
        url.set("https://github.com/kreuzberg-dev/kreuzberg")
        licenses {
            license {
                name.set("Elastic-2.0")
                url.set("https://www.elastic.co/licensing/elastic-license")
            }
        }
        developers {
            developer {
                name.set("Na&apos;aman Hirschfeld")
                email.set("naaman@kreuzberg.dev")
            }
        }

        scm {
            url.set("https://github.com/kreuzberg-dev/kreuzberg")
            connection.set("scm:git:git://github.com/kreuzberg-dev/kreuzberg.git")
            developerConnection.set("scm:git:ssh://git@github.com:kreuzberg-dev/kreuzberg.git")
        }
    }
}
