plugins {
    id "com.jfrog.bintray" version "1.7"
}

apply plugin: 'java'
apply plugin: 'maven'
apply plugin: 'maven-publish'
apply plugin: 'groovy'
if (project.hasProperty('signing.keyId')) {
    apply plugin: 'signing'
}

group = 'org.phoenixframework.channels'
version = '1.0.0'

allprojects {
    sourceCompatibility = 1.7
    targetCompatibility = 1.7
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.fasterxml.jackson.core:jackson-databind:2.8.3'
    compile 'com.squareup.okhttp3:okhttp:3.6.0'
    compile 'org.slf4j:slf4j-api:1.7.22'
    testCompile 'org.codehaus.groovy:groovy-all:2.3.10'
    testCompile "org.spockframework:spock-core:1.0-groovy-2.3"

    // optional dependencies for using Spock
    testRuntime "org.hamcrest:hamcrest-core:1.3" // only necessary if Hamcrest matchers are used
    testRuntime "cglib:cglib-nodep:3.1"
    // allows mocking of classes (in addition to interfaces)
    testRuntime "org.objenesis:objenesis:2.1"
    // allows mocking of classes without default constructor (together with CGLIB)
}

task javadocJar(type: Jar) {
    classifier = 'javadoc'
    from javadoc
}

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

repositories {
    mavenCentral()
}

artifacts {
    archives javadocJar, sourcesJar
}

if (project.hasProperty('signing.keyId')) {
    signing {
        sign configurations.archives
    }
}

publishing {
    publications {
        JavaPhoenixChannelsJar(MavenPublication) {
            from components.java
            groupId 'com.github.eoinsha'
            artifactId 'JavaPhoenixChannels'
            version '1.0'
        }
    }
}

bintray {
    user = System.getenv('BINTRAY_USER')
    key = System.getenv('BINTRAY_KEY')
    pkg {
        repo = 'java-phoenix-channels'
        name = 'JavaPhoenixChannels'
        userOrg = 'javaphoenixchannels'
        licenses = ['BSD-3']
        vcsUrl = 'https://github.com/eoinsha/JavaPhoenixChannels.git'
    }
    publications = ['JavaPhoenixChannelsJar']
}
