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

version = "1.0.0"

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.2"

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

    lintOptions {
        abortOnError false
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])

    final SUPPORT_LIBRARY_VERSION = '23.1.1'

    compile "com.android.support:appcompat-v7:$SUPPORT_LIBRARY_VERSION"
    compile "com.android.support:design:$SUPPORT_LIBRARY_VERSION"

    testCompile 'junit:junit:4.12'
}

def siteUrl = 'https://github.com/dmallcott/ProgressFloatingActionButton'
def gitUrl = 'https://github.com/dmallcott/ProgressFloatingActionButton.git'
group = 'com.github.dmallcott'

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

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

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

task generateJavaDocsJar(type: Jar, dependsOn: generateJavaDocs) {
    from generateJavaDocs.destinationDir
    classifier 'javadoc'
}

artifacts {
    archives generateJavaDocsJar
    archives generateSourcesJar
}

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

    configurations = ['archives']
    pkg {
        repo = "maven"
        name = "ProgressFloatingActionButton"
        websiteUrl = siteUrl
        vcsUrl = gitUrl
        licenses = ["Apache-2.0"]
        publish = true
    }
}

