apply plugin: 'com.android.library'

buildscript {
    repositories {
        jcenter()
    }
}

group = 'io.github.memfis19'
version = '0.3.7'

ext {
    PUBLISH_GROUP_ID = 'io.github.memfis19'
    PUBLISH_ARTIFACT_ID = 'annca'
    PUBLISH_VERSION = '0.3.7'
    PUBLISH_VERSION_CODE = 11
    SUPPORT_VERSION = '25.3.1'
    TARGET_SDK = 35
    MIN_SDK = 23
}

android {
    namespace ("io.github.memfis19.annca")
    compileSdk(35)
    defaultConfig {
        minSdkVersion MIN_SDK
        targetSdkVersion TARGET_SDK
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    lintOptions {
        abortOnError false
    }
}

// ✅ Sources JAR
tasks.register('generateSourcesJar', Jar) {
    archiveClassifier.set('sources')
    from android.sourceSets.main.java.srcDirs
}

// ✅ Javadocs Task
tasks.register('generateJavadocs', Javadoc) {
    failOnError = false
    source = android.sourceSets.main.java.srcDirs
    classpath += project.files(android.bootClasspath.join(File.pathSeparator))
}

// ✅ Javadocs JAR
tasks.register("generateJavadocsJar", Jar) {
    archiveClassifier.set("javadoc")
    from(tasks.named("generateJavadocs"))
}

tasks.named("generateJavadocsJar").configure {
    dependsOn tasks.named("generateJavadocs")
}

// ✅ Publishing artifacts
artifacts {
    archives(tasks.named("generateSourcesJar"))
    archives(tasks.named("generateJavadocsJar"))
}

dependencies {
    implementation 'androidx.appcompat:appcompat:1.7.1'
    androidTestImplementation 'androidx.annotation:annotation:1.9.1'
    implementation fileTree(include: ['*.jar'], dir: 'libs')
}

tasks.register('wrapper', Wrapper) {
    gradleVersion = '2.4'
}