apply plugin: 'com.android.library'
apply plugin: 'maven-publish'

android {
    defaultConfig {
        minSdkVersion rootProject.ext.minSdkVersion
        targetSdkVersion rootProject.ext.targetSdkVersion
        compileSdk rootProject.ext.compileSdkVersion
        versionCode 13
        versionName "1.1.1"

        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_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    publishing {
        singleVariant("release") {
            withSourcesJar()
        }
    }

    namespace 'com.github.AAChartModel.AAChartCore'

    libraryVariants.all { variant ->
        variant.outputs.all {
            outputFileName = "AAChartCore_v" +
                    defaultConfig.versionName + ".aar"
        }
    }
}

dependencies {
    implementation 'com.google.code.gson:gson:2.10.1'
}

afterEvaluate {
    publishing {
        repositories {
            it.mavenLocal()
        }
        publications {
            // Creates a Maven publication called "release".
            release(MavenPublication) {
                from components.release
                groupId = 'com.github.AAChartModel'
                artifactId = 'AAChartCore'
                version = android.defaultConfig.versionName
            }
        }
    }
}

