apply plugin: 'com.android.library'
apply plugin: 'com.jfrog.bintray'

version = "1.3"

android {
    compileSdkVersion 22
    buildToolsVersion "22.0.1"

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

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

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

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

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

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

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

    configurations = ['published', 'archives']
    //publications = ['published']
    filesSpec {
        from 'files'
        into 'standalone_files/level1'
        rename '(.+)\\.(.+)', '$1-suffix.$2'
    }

    dryRun = false //Whether to run this as dry-run, without deploying
    publish = true //If version should be auto published after an upload
    //Package configuration. The plugin will use the repo and name properties to check if the package already exists. In that case, there's no need to configure the other package properties (like userOrg, desc, etc).
    pkg {
        repo = 'maven'
        name = 'FlexibleRatingBar'
        desc = 'Enhanced version of RatingBar with support for different polygons, proper resizing, and coloration'
        websiteUrl = 'https://github.com/Amagi82/FlexibleRatingBar'
        issueTrackerUrl = 'https://github.com/Amagi82/FlexibleRatingBar'
        vcsUrl = 'https://github.com/Amagi82/FlexibleRatingBar.git'
        licenses = ['Apache-2.0']
        labels = ['android', 'ratingbar', 'rating bar']
        publicDownloadNumbers = true

    }
}