plugins {
    id 'com.android.library'
    id 'kotlin-android'
    id 'com.vanniktech.maven.publish'
}

android {
    compileSdkVersion 31

    defaultConfig {
        minSdkVersion 21
        targetSdkVersion 31

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
        consumerProguardFiles "consumer-rules.pro"
    }

    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'
    }
}

dependencies {
    implementation fileTree(dir: "libs", include: ["*.jar"])
    implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
    implementation 'androidx.core:core-ktx:1.6.0'
    implementation 'androidx.appcompat:appcompat:1.3.1'
    implementation 'com.google.android.material:material:1.4.0'
}

plugins.withId("com.vanniktech.maven.publish.base") {
    group = "io.github.ahmad-hamwi"
    version = "1.0.1"

    mavenPublishing {
        publishToMavenCentral("S01")

        // Will only apply to non snapshot builds.
        // Uses credentials as described above, supports both regular and in memory signing.
        signAllPublications()

        pom {
            name = "TabSync"
            description = "A lightweight synchronizer between Android's TabLayout and RecyclerView."
            inceptionYear = "2021"
            url = "https ://github.com/Ahmad-Hamwi/TabSync/"
            licenses {
                license {
                    name = "The Apache License, Version 2.0"
                    url = "http://www.apache.org/licenses/LICENSE-2.0.txt"
                    distribution = "http://www.apache.org/licenses/LICENSE-2.0.txt"
                }
            }
            developers {
                developer {
                    id = "Ahmad-Hamwi"
                    name = "Ahmad Hamwi"
                    url = "https://github.com/Ahmad-Hamwi/"
                }
            }
            scm {
                url = "https://github.com/Ahmad-Hamwi/TabSync/"
                connection = "scm:git:git://github.com/Ahmad-Hamwi/TabSync.git"
                developerConnection = "scm:git:ssh://git@github.com/Ahmad-Hamwi/TabSync.git"
            }
        }
    }
}