apply plugin: "spock-base"

displayName = "Spock Framework - Report Module"

description = "Interactive, business-friendly HTML reports for Spock specifications."

dependencies {
  compile project(":spock-core")
  //compile "com.github.jknack:handlebars:0.7.0"
  //compile "com.fasterxml.jackson.core:jackson-core:2.1.2"
  // "com.fasterxml.jackson.core:jackson-databind:2.1.2"
}

test {
  exclude "org/spockframework/report/sample/FightOrFlightStory.class"
  exclude "org/spockframework/report/sample/FightOrFlightSpec.class"
}

ext.spockLogFileDir = file("$buildDir/spock/logFiles")
ext.spockLogFileName = "spock-log"

task sampleTest(type: Test) {
  finalizedBy "sampleReport"
  reports.junitXml.enabled = false
  reports.html.enabled = false

  testClassesDir = test.testClassesDir
  classpath = test.classpath
  include "org/spockframework/report/sample/FightOrFlightStory.class"
  include "org/spockframework/report/sample/FightOrFlightSpec.class"
  testLogging.exceptionFormat = "full"
  testLogging.showExceptions = true
  maxParallelForks = 1

  systemProperty "spock.logFileDir", spockLogFileDir
  systemProperty "spock.logFileName", spockLogFileName

  doFirst {
    delete spockLogFileDir
  }
}

task sampleReport(type: org.spockframework.gradle.GenerateSpockReport) {
  reportName = "Ninja Commander"
  reportFileName = "ninja.html"
  debug = true
  local = true
  liveLogFiles = (1..10).collect { file("$spockLogFileDir/$spockLogFileName-$it") }
  spockReportClasspath = sourceSets.main.runtimeClasspath
  outputDirectory = file("$buildDir/spock/reports/")
}

