apply plugin: 'com.android.library'

android {
    compileSdkVersion 25
    buildToolsVersion "25.0.0"

    defaultConfig {
        minSdkVersion 15
        targetSdkVersion 25
        versionCode 4
        versionName "0.0.2.1"

        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

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

    lintOptions {
        abortOnError false
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    compile 'com.android.support:appcompat-v7:25.0.0'
    compile "com.android.support:recyclerview-v7:25.0.0"
    testCompile 'junit:junit:4.12'
}

ext {
    // Where you will see your artifact in Bintray's web interface
    // The "bintrayName" should match the name of the Bintray repro.
    bintrayRepo = 'maven'
    bintrayName = 'panter_dialog'

    // Maven metadata
    publishedGroupId = 'com.eminayar.panterdialog'
    libraryName = 'PanterDialog'
    // Save yourself a head ache, and set this equal to the name of the Android Studio library
    // module. The artifact name needs to match the name of the library.
    artifact = 'panter-dialog'

    licenseName = 'The Apache Software License, Version 2.0'
    licenseUrl = 'http://www.apache.org/licenses'
    allLicenses = ["Apache-2.0"]

    siteUrl = 'https://github.com/kngfrhzs/panter-dialog'
    gitUrl = 'https://github.com/kngfrhzs/panter-dialog.git'

    libraryDescription = 'Panter Dialog is an stylish android library that helps users add cool features like adding header and header logos'
    libraryVersion = '0.0.2.1'

    developerId = 'kngfrhzs'
    developerName = 'Muhammed Emin Ayar'
    developerEmail = 'ayarmuhammedemin@gmail.com'
}
apply plugin: 'com.github.dcendents.android-maven'

group = publishedGroupId                               // Maven Group ID for the artifact

install {
    repositories.mavenInstaller {
        // This generates POM.xml with proper parameters
        pom {
            project {
                packaging 'aar'
                groupId publishedGroupId
                artifactId artifact

                // Add your description here
                name libraryName
                description libraryDescription
                url siteUrl

                // Set your license
                licenses {
                    license {
                        name licenseName
                        url licenseUrl
                    }
                }
                developers {
                    developer {
                        id developerId
                        name developerName
                        email developerEmail
                    }
                }
                scm {
                    connection gitUrl
                    developerConnection gitUrl
                    url siteUrl

                }
            }
        }
    }
}
apply plugin: 'com.jfrog.bintray'

version = libraryVersion
if (project.hasProperty("android")) { // Android libraries
    task sourcesJar(type: Jar) {
        classifier = 'sources'
        from android.sourceSets.main.java.srcDirs
    }

    task javadoc(type: Javadoc) {
        source = android.sourceSets.main.java.srcDirs
        classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
    }
} else { // Java libraries
    task sourcesJar(type: Jar, dependsOn: classes) {
        classifier = 'sources'
        from sourceSets.main.allSource
    }
}

artifacts {
    archives sourcesJar
}

// Bintray
Properties properties = new Properties()
if (project.rootProject.file('local.properties').exists()) {
    properties.load(project.rootProject.file('local.properties').newDataInputStream())

    bintray {
        user = properties.getProperty("bintray.user")
        key = properties.getProperty("bintray.apikey")

        configurations = ['archives']
        pkg {
            repo = bintrayRepo
            name = bintrayName
            desc = libraryDescription
            websiteUrl = siteUrl
            vcsUrl = gitUrl
            licenses = allLicenses
            publish = true
            publicDownloadNumbers = true
            version {
                desc = libraryDescription
                gpg {
                    sign = true //Determines whether to GPG sign the files. The default is false
                    passphrase = properties.getProperty("bintray.gpg.password")
                    //Optional. The passphrase for GPG signing'
                }
            }
        }
    }
}