plugins {
    id 'java'
    id 'checkstyle'
    id 'findbugs'
    id 'pmd'
    id 'jacoco'
    id 'net.researchgate.release' version '2.4.0'
    id "com.jfrog.bintray" version '1.7'
    id 'maven'
    id 'maven-publish'
}

group 'com.evokly'

publishing {
    publications {
        MyPublication(MavenPublication) {
            from components.java
            groupId 'com.evokly'
            artifactId 'kafka-connect-mqtt'
            version '1.0'
        }
    }
}


ext {
    kafkaVersion = '0.10.0.0'
}


processResources {
    expand project.properties
}

repositories {
    mavenCentral()

    maven { url "https://repo.eclipse.org/content/repositories/paho-releases/" }
}

dependencies {
    testCompile group: 'junit', name: 'junit', version: '4.12'
    compile "org.apache.kafka:connect-api:$kafkaVersion"
    compile 'org.eclipse.paho:org.eclipse.paho.client.mqttv3:1.0.2'
    compile 'org.bouncycastle:bcprov-jdk15on:1.54'
    compile 'org.bouncycastle:bcpkix-jdk15on:1.54'
    compile 'org.bouncycastle:bcpg-jdk15on:1.54'
    compile 'commons-io:commons-io:2.4'
    compile 'org.slf4j:slf4j-api:1.7.14'
    testCompile 'org.slf4j:slf4j-simple:1.7.14'
}

checkstyle {
    repositories {
        mavenCentral()
    }
    configurations {
        checkstyle
    }
    dependencies {
        checkstyle 'com.puppycrawl.tools:checkstyle:6.12.1'
    }
}

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

task copyRuntimeLibs(type: Copy) {
    into "$buildDir/output/lib"
    from configurations.runtime
}


bintray {
    user = System.getenv('BINTRAY_USER')
    key = System.getenv('BINTRAY_KEY')
    pkg {
        repo = 'maven'
        name = 'kafka-connect-mqtt'
        userOrg = 'evokly'
        licenses = ['MIT']
        vcsUrl = 'https://github.com/evokly/kafka-connect-mqtt.git'
        version {
            name = '1.0'
            vcsTag = '1.0'
        }
        publications = ['MyPublication']
    }
}
