
def pluginVersion = '1.0.4'

group 'org.fabiomsr'
version pluginVersion

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.6'
    }
}

apply plugin: 'groovy'
apply plugin: 'maven'
apply plugin: 'maven-publish'
apply plugin: 'com.jfrog.bintray'

compileJava {
    sourceCompatibility  '1.6'
    targetCompatibility  '1.6'
}

compileGroovy {
    sourceCompatibility  '1.6'
    targetCompatibility  '1.6'
}


repositories {
    jcenter()
}

repositories {
    flatDir {
        dirs 'libs'
    }
}

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.6'
    }
}

dependencies {

    compile gradleApi()
    compile localGroovy()

    compile group:'com.android.tools.build', name:'gradle', version:'2.1.0'
    compile group:'com.github.depsypher', name:'pngtastic',  version:'1.2'

    testCompile group: 'junit', name: 'junit', version: '4.11'
}

task sourcesJar(type: Jar, dependsOn: classes) {
    classifier = 'sources'
    from sourceSets.main.allSource
}

publishing {
    repositories {
        maven {
            url mavenLocal()
        }
    }

    publications {
        maven(MavenPublication) {
            groupId 'org.fabiomsr'
            artifactId 'drawable-optimizer-gradle-plugin'
            version pluginVersion

            from components.java

            artifact (sourcesJar) {
                classifier "sources"
            }
        }
    }
}



bintray {
    user = project.hasProperty('BINTRAY_USER') ? project.property('BINTRAY_USER') : System.getenv('BINTRAY_USER')
    key = project.hasProperty('BINTRAY_API_KEY') ? project.property('BINTRAY_API_KEY') : System.getenv('BINTRAY_API_KEY')
    publications = ['maven']
    configurations = ['archives']

    pkg {
        repo = 'maven'
        name = 'drawable-optimizer'
        licenses = ['Apache-2.0']
        vcsUrl = 'https://github.com/fabiomsr/drawable-optimizer-gradle-plugin.git'

        version {
            name = pluginVersion
            desc = 'Drawable Optimizer Gradle Plugin'
            vcsTag = pluginVersion
            attributes = ['gradle-plugin': 'org.fabiomsr:drawable-optimizer-gradle-plugin']
        }
    }


}