import com.vanniktech.maven.publish.SonatypeHost

plugins {
    id 'com.android.library'
    id 'org.jetbrains.kotlin.android'
    id 'kotlin-kapt'
    id 'com.vanniktech.maven.publish' version '0.30.0'
}

android {
    compileSdk 35

    defaultConfig {
        minSdkVersion 23
        targetSdkVersion 35
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_11
        targetCompatibility JavaVersion.VERSION_11
    }

    kotlinOptions {
        jvmTarget = '11'
    }

    buildFeatures {
        dataBinding true
    }

    namespace 'io.github.glailton.expandabletextview'
}

dependencies {
    implementation 'androidx.core:core-ktx:1.3.2'
    implementation 'androidx.appcompat:appcompat:1.2.0'
    implementation 'com.google.android.material:material:1.3.0'
    testImplementation 'junit:junit:4.+'
    androidTestImplementation 'androidx.test.ext:junit:1.1.2'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
}

// Configuração do Maven Publish
mavenPublishing {
    // Publicação para Maven Central via OSSRH moderno
    publishToMavenCentral(SonatypeHost.CENTRAL_PORTAL, true) // usa https://central.sonatype.com

    signAllPublications()

    coordinates("io.github.glailton", "expandabletextview", "1.0.7")

    pom {
        name = "ExpandableTextView"
        description = "An expandable Android TextView written in Kotlin."
        inceptionYear = "2024"
        url = "https://github.com/glailton/ExpandableTextView"

        licenses {
            license {
                name = "MIT License"
                url = "https://opensource.org/licenses/MIT"
            }
        }

        developers {
            developer {
                id = "glailton"
                name = "Glailton Costa"
                email = "glailton.rc@gmail.com"
            }
        }

        scm {
            connection = "scm:git:https://github.com/glailton/ExpandableTextView.git"
            developerConnection = "scm:git:https://github.com/glailton/ExpandableTextView.git"
            url = "https://github.com/glailton/ExpandableTextView"
        }
    }
}