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

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

group = 'pl.itako'
version = '1.1.5'

sourceCompatibility = JavaVersion.VERSION_1_6
targetCompatibility = JavaVersion.VERSION_1_6

repositories {
    jcenter()
    mavenCentral()
    maven { url "https://dl.google.com/dl/android/maven2/" }
}

dependencies {
    compile gradleApi()
    compile "org.codehaus.groovy:groovy-all:2.4.12"
    compile 'com.android.tools.build:gradle:3.1.3'
    compile 'com.google.guava:guava:18.0'

    testCompile ('org.spockframework:spock-core:1.0-groovy-2.4') {
        exclude module: 'groovy-all'
    }
}

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

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

artifacts {
    archives sourcesJar, javadocJar
}

publishing {
    publications {
        mavenJava(MavenPublication) {
            from components.java

            artifact sourcesJar {
                classifier "sources"
            }

            artifact javadocJar {
                classifier "javadoc"
            }
        }
    }
}

bintray {
    user = project.hasProperty("bintrayUser") ? bintrayUser : null
    key = project.hasProperty("bintrayKey") ? bintrayKey : null
    publications = ['mavenJava']
    pkg {
        repo = 'icon-version'
        name = 'icon-version'
        desc = 'Android gradle plugin that adds version and flavor name to all app icons.'
        licenses = ['Apache-2.0']
    }
}
