apply plugin: 'java'
apply plugin: 'maven-publish'
apply plugin: 'me.tatarka.retrolambda'
apply plugin: 'com.jfrog.bintray'
apply plugin: 'findbugs'

def props = new Properties()
props.load(new FileInputStream("${rootDir}/eyetribe.properties"))
props.each { key, val ->
    project.ext.set(key, val)
}

group = 'com.theeyetribe'
version = project.hasProperty('currentVersion') ? project.currentVersion : '0.0.1'

def versionCurrent = version
def versionName = "v.${version}"
def id = 'eyetribe-java'

dependencies {
    testCompile group: 'junit', name: 'junit', version: '4.11'
    compile 'com.google.code.gson:gson:2.5'
}

retrolambda {
    jdk System.getenv("JAVA8_HOME")
    oldJdk System.getenv("JAVA6_HOME")
    javaVersion JavaVersion.VERSION_1_6
}

jar {
    archivesBaseName = id
    
    from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } }
}
jar.outputs.upToDateWhen {false}

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

task sourceJar (type : Jar) {
    classifier = 'sources'
    from sourceSets.main.allSource
}

findbugs {
    ignoreFailures = true
    toolVersion = "3.0.1"
    sourceSets = [sourceSets.main]
    reportsDir = file("$project.buildDir/reports/findbugs")
    effort = "max"
}

tasks.withType(FindBugs) {
    reports {
        xml.enabled = false
        html.enabled = true
    }
}
