apply plugin: "java"
apply plugin: "idea"
apply plugin: "eclipse"

task wrapper(type: Wrapper) {
    gradleVersion = "1.10"
    jarFile = "gradle/gradle-wrapper.jar"
}

repositories {
    mavenCentral()
}

ext.commonsFileUploadVersion = "1.3"
ext.seleniumVersion = "2.39.0"
ext.junitVersion = "4.11"
ext.jettyVersion = "6.1.21"
ext.jsr305Version = "2.0.1"
ext.phantomjsdriverVersion = "1.1.0"

dependencies {
    ["selenium-java", "selenium-remote-driver", "selenium-server"].each {
        testCompile "org.seleniumhq.selenium:$it:$seleniumVersion"
    }
    testCompile "com.google.code.findbugs:jsr305:$jsr305Version"
    testCompile "junit:junit-dep:$junitVersion"
    testCompile "org.mortbay.jetty:jetty:$jettyVersion"
    testCompile "commons-fileupload:commons-fileupload:$commonsFileUploadVersion"
    testCompile "com.github.detro.ghostdriver:phantomjsdriver:$phantomjsdriverVersion"
}

tasks.withType(JavaExec) {
    classpath = configurations.compile + sourceSets.test.output
    args project.hasProperty("args") ? project.args.split("\\s") : []
}

test {
    maxParallelForks = 3

    afterTest { descriptor, result ->
        logger.quiet(result.toString() + " for " + descriptor + " in " + descriptor.getParent())
    }
}
