apply plugin: 'com.android.library'
apply plugin: "com.jfrog.bintray"
apply plugin: 'com.github.dcendents.android-maven'
apply plugin: 'maven'

version = "1.2.0"

android {
    compileSdkVersion 25
    buildToolsVersion "25.0.2"

    defaultConfig {
        minSdkVersion 16
        targetSdkVersion 25
        versionCode 3
        versionName version
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile 'com.android.support:support-annotations:25.3.1'
}


def siteUrl = 'https://github.com/ashazar/TabDrawer'
def gitUrl = 'https://github.com/ashazar/TabDrawer.git'
group = "com.ashazar.tabdrawer"

install {
    repositories.mavenInstaller {
        pom {
            project {
                packaging 'aar'
                name 'TabDrawer'
                description = 'Android Navigation Tab Bar with Drawer - Alternative to Navigation Drawer (Hamburger Menu)'
                url siteUrl

                licenses {
                    license {
                        name 'MIT'
                        url 'https://raw.githubusercontent.com/ashazar/TabDrawer/master/LICENSE.md'
                    }
                }
                developers {
                    developer {
                        id 'ashazar'
                        name 'Serdar Hazar'
                    }
                }
                scm {
                    connection gitUrl
                    developerConnection gitUrl
                    url siteUrl
                }
            }
        }
    }
}

task sourcesJar(type: Jar) {
    from android.sourceSets.main.java.srcDirs
    classifier = 'sources'
}

task javadoc(type: Javadoc) {
    source = android.sourceSets.main.java.srcDirs
    classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
}

task javadocJar(type: Jar, dependsOn: javadoc) {
    classifier = 'javadoc'
    from javadoc.destinationDir
}
artifacts {
    archives javadocJar
    archives sourcesJar
}

Properties properties = new Properties()
properties.load(project.rootProject.file('local.properties').newDataInputStream())

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

    configurations = ['archives']
    pkg {
        repo = "maven"
        name = "tabdrawer"
        websiteUrl = siteUrl
        vcsUrl = gitUrl
        licenses = ["MIT"]
        publish = true
        version {
            gpg {
                sign = true
                passphrase = properties.getProperty("bintray.gpg.password")
            }
        }
    }
}