apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
//apply plugin: 'kotlin-android-extensions'
apply plugin: 'maven-publish'

android {
    namespace 'com.effective.android.panel'  // 替换为你的包名
    compileSdkVersion config.compile_sdk_version

    defaultConfig {
        multiDexEnabled true
        minSdkVersion config.min_sdk_version
        targetSdkVersion config.target_sdk_version
        versionCode config.version_code
        versionName config.version_name
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_17
        targetCompatibility JavaVersion.VERSION_17
    }

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

}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    implementation deps.androidx.annotations
    implementation deps.androidx.core
    implementation deps.androidx.appcompat
}

task generateSourcesJar(type: Jar) {
    archiveClassifier.set("sources")
    from android.sourceSets.main.java.srcDirs
}

def versionName = "1.5.14"

// Because the components are created only during the afterEvaluate phase, you must
// configure your publications using the afterEvaluate() lifecycle method.
afterEvaluate {
    publishing {
        publications {
            Production(MavenPublication) {
                // Creates a Maven publication called "release".
                // Applies the component for the release build variant.
                from components.release
                // You can then customize attributes of the publication as shown below.
                groupId = 'com.github.Yummylau'
                artifactId = 'panelSwitchHelper-androidx'
                version = versionName
                // 上传source，这样使用放可以看到方法注释
//                artifact generateSourcesJar
            }
        }
    }
}