buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.1.0'
        classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7'
        classpath 'com.github.dcendents:android-maven-gradle-plugin:1.3'
    }
}

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

android {
    compileSdkVersion 24
    buildToolsVersion "24.0.2"
    defaultConfig {
        minSdkVersion 9
        targetSdkVersion 24
    }
}

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
}

publishing {
    publications {
        MyPublication(MavenPublication) {
            artifact javadocJar
            artifact sourcesJar
            artifact file('build/outputs/aar/library-release.aar')
            groupId group
            artifactId 'emphasis'
            version '0.4'
        }
    }
}

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

// To upload simply update the version everywhere , then run "gradlew bintrayUpload"
bintray {
    user = properties.getProperty("bintray.user")
    key = properties.getProperty("bintray.apikey")

    publications = ['MyPublication']

    pkg {
        repo = 'maven'
        name = 'emphasis'
        licenses = ["Apache-2.0"]
        vcsUrl = 'https://github.com/athkalia/EmphasisTextView.git'
        desc = 'An android TextView that supports highlighting parts or all of the text contained in it.'
        websiteUrl = 'https://github.com/athkalia/EmphasisTextView'
        publicDownloadNumbers = true
        publish = true
        dryRun = false  //Whether to run this as dry-run, without deploying
        version {
            name = '0.4'
            released = new Date()
        }
    }
}

dependencies {
    testCompile 'junit:junit:4.12'
    testCompile 'org.robolectric:robolectric:3.1'
}
