plugins {
    id "com.github.hierynomus.license" version "0.12.1"
    id 'com.palantir.git-version' version '0.5.1'
}

apply plugin: 'java'
apply plugin: 'idea'

repositories {
    mavenLocal()
    mavenCentral()
    maven {
        name 'jboss'
        url 'http://repository.jboss.org/nexus/content/groups/public-jboss'
    }
}

idea {
    project {
        languageLevel = '1.8'
        vcs = 'Git'
        ipr.withXml { xmlFile ->
            // enable 'Annotation Processors'
            xmlFile.asNode().component.find {
                it.@name == 'CompilerConfiguration'
            }['annotationProcessing'][0].replaceNode {
                annotationProcessing {
                    profile(default: true, name: 'Default', useClasspath: 'true', enabled: true)
                }
            }
        }
    }
}

license {
    header project.file('../../LICENSE-HEADER')
    exclude "**/GeoLocation.java"
    mapping "drl", 'JAVADOC_STYLE'
}


if (hasProperty("snapshot") && gitVersion().toString().contentEquals("unspecified")) {
    throw new GradleException('snapshot version `unspecified');
}

def eventsourcingVersion = gitVersion()

dependencies {
    testCompile 'org.testng:testng:6.9.10'

    compile 'org.projectlombok:lombok:1.16.8'

    compile "com.eventsourcing:eventsourcing-core:${eventsourcingVersion}"
    compile "com.eventsourcing:eventsourcing-cep:${eventsourcingVersion}"
    compile "com.eventsourcing:eventsourcing-inmem:${eventsourcingVersion}"
    compile "com.eventsourcing:eventsourcing-postgresql:${eventsourcingVersion}"

    testCompile "com.eventsourcing:eventsourcing-repository:${eventsourcingVersion}"

    // Drools
    compile 'org.kie:kie-api:6.4.0.Final'
    compile 'org.drools:drools-compiler:6.4.0.Final'

    // Google Maps
    compile 'com.google.maps:google-maps-services:0.1.15'

    // Connection pool
    compile 'com.zaxxer:HikariCP:2.4.6'
}

test.useTestNG()

tasks.withType(JavaCompile) {
    options.compilerArgs << "-parameters"
}
