buildscript {
    repositories {
        jcenter()
    }

    dependencies {
        classpath 'com.bmuschko:gradle-nexus-plugin:2.2'
    }
}
/**
 plugins {id 'me.champeau.gradle.jmh' version '0.2.0'}**/


def custom = { "$rootDir/gradle/${it}.gradle" } //find custom plugins locally

apply plugin: 'me.champeau.gradle.jmh'
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'maven-publish'
apply plugin: 'com.bmuschko.nexus'
apply plugin: 'jacoco'
apply from: custom('jacoco-version')
apply from: custom('jacoco-config')
apply from: custom('jacoco-excludes')

sourceCompatibility = 1.8
targetCompatibility = 1.8

jar {
    manifest {
        attributes 'Implementation-Title': 'cyclops', 'Implementation-Version': version
    }
}

repositories {
    mavenCentral()
    jcenter()
}

if (JavaVersion.current().isJava8Compatible()) {
    allprojects {
        tasks.withType(Javadoc) {
            options.addStringOption('Xdoclint:none', '-quiet')
        }
    }
}
configurations {
    provided
}

dependencies {


    compile 'org.agrona:Agrona:0.9.1'
    compile 'org.reactivestreams:reactive-streams:1.0.0'
    compile 'io.kindedj:kindedj:'+kindedJVersion
    provided 'org.projectlombok:lombok:1.16.20'
    testCompile group: 'io.projectreactor', name: 'reactor-test', version: '3.2.2.RELEASE'
    testCompile 'com.github.stefanbirkner:system-rules:1.10.0'
    testCompile 'io.projectreactor:reactor-core:3.2.2.RELEASE'
    testCompile 'com.google.guava:guava:19.0'
    testCompile 'org.reactivestreams:reactive-streams-tck:1.0.0'
    testCompile 'junit:junit:4.12'
    testCompile 'org.hamcrest:hamcrest-all:1.3'
    testCompile 'org.mockito:mockito-all:1.9.5'
    testCompile 'io.javaslang:javaslang:2.0.2'
    testCompile 'org.assertj:assertj-core:3.8.0'
    testCompile(group: 'org.hibernate', name: 'hibernate-core', version: '5.1.0.Final')
    testCompile (group: 'org.hibernate', name: 'hibernate-entitymanager', version: '5.1.0.Final')
    testCompile group: 'org.hsqldb', name: 'hsqldb', version: '2.0.0'
    jmh 'com.github.akarnokd:ixjava:1.0.0-RC5'
    jmh 'io.vavr:vavr:0.9.2'
    jmh 'com.google.guava:guava:19.0'

}
sourceSets {
    main.compileClasspath += [configurations.provided]
    test.compileClasspath += [configurations.provided]
    test.runtimeClasspath += [configurations.provided]
}
jacocoTestReport {
    afterEvaluate {
        classDirectories = files(classDirectories.files.collect {
            fileTree(dir: it, exclude: ['com/aol/cyclops2/util/stream/scheduling/cron/**'])
        })
    }
}

jmh {
    jmhVersion = '1.14'
    humanOutputFile = null
    include = ".*scrabble*"
}

task testNG(type: Test) {
    useTestNG {}
    testLogging {
        events "started", "passed", "skipped", "failed"//, "standardOut", "standardError"
    }
    reports.html.destination = file("$buildDir/reports/test")
}

task testSuite(type: Test) {

    include '**/*TestSuite.class'
    reports.junitXml.destination = "$buildDir/reports/test"
    reports.html.destination = "$buildDir/reports/test"
}

test {
    reports.html.destination = file("$buildDir/reports/test")
    forkEvery = 1
    testLogging {
        events "started", "passed", "skipped", "failed"//, "standardOut", "standardError"
    }
}

test {
    systemProperties 'property': 'value'
}
task packageTests(type: Jar) {
    from sourceSets.test.output
    classifier = 'tests'
}

artifacts.archives packageTests

javadoc {
    configure((CoreJavadocOptions) getOptions()) {
        addStringOption('sourcepath', "/Sources/jool-0.9.11-sources.jar")
    }
    exclude '**/internal/**'
}

modifyPom {
    project {
        name 'cyclops'
        description 'Platform for Functional Reactive Programming with Java 8'
        url 'https://github.com/aol/cyclops-react'
        inceptionYear '2015'

        groupId 'com.oath.cyclops'
        artifactId 'cyclops'
        version "$version"

        scm {
            url 'scm:git@github.com:aol/cyclops-react.git'
            connection 'scm:git@github.com:aol/cyclops-react.git'
            developerConnection 'scm:git@github.com:aol/simple-react.git'
        }

        licenses {
            license {
                name 'The Apache Software License, Version 2.0'
                url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
                distribution 'repo'
            }
        }

        developers {
            developer {
                id 'johnmcclean-aol'
                name 'John McClean'
                email 'john.mcclean@teamaol.com'
            }
            developer {
                id 'kewangie'
                name 'Ke Wang'
                email 'ke.wang@teamaol.com'
            }

            developer {
                id 'tkountis'
                name 'Thomas Kountis Wang'
                email 'thomas.kountis@adtech.com'
            }
            developer {
                id 'colinfkennedy'
                name 'Colin Kennedy'
                email 'Colin.Kennedy@teamaol.com'
            }
        }
    }
}

extraArchive {
    sources = true
    tests = true
    javadoc = true
}

nexus {
    sign = true
    repositoryUrl = 'https://oss.sonatype.org/service/local/staging/deploy/maven2'
    snapshotRepositoryUrl = 'https://oss.sonatype.org/content/repositories/snapshots'
}
/**
 task wrapper(type: Wrapper) {gradleVersion = '2.14.1'}**/
