apply plugin: 'java'
apply plugin: 'maven'
apply plugin: 'signing'
apply plugin: 'eclipse'

group = 'com.fiftyonred'
version = '0.4.0'

sourceCompatibility = 1.6
targetCompatibility = 1.6

repositories {
    mavenCentral()
}

dependencies {
    compile 'redis.clients:jedis:2.6.0'
    testCompile 'junit:junit:4.11'
}

task wrapper(type: Wrapper) {
    gradleVersion = '2.0'
}

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

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

artifacts {
    archives jar
    archives javadocJar
    archives sourcesJar
}

signing {
    sign configurations.archives
}

uploadArchives {
    repositories {
        mavenDeployer {
            beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }

            repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2/") {
              authentication(userName: sonatypeUsername, password: sonatypePassword)
            }

            pom.project {
               name 'mock-jedis'
               packaging 'jar'
               description 'Mock Jedis is a library for mocking out Jedis clients'
               url 'https://github.com/50onRed/mock-jedis'

               scm {
                   url 'scm:git@github.com:50onRed/mock-jedis.git'
                   connection 'scm:git@github.com:50onRed/mock-jedis.git'
                   developerConnection 'scm:git@github.com:50onRed/mock-jedis.git'
               }

               licenses {
                   license {
                       name 'MIT'
                       url 'https://raw.github.com/50onRed/mock-jedis/master/LICENSE'
                       distribution 'repo'
                   }
               }

               developers {
                   developer {
                       id 'idyedov'
                       name 'Ivan Dyedov'
                   }
               }
           }
        }
    }
}
