apply plugin: 'java-library'
apply plugin: 'maven'

ext {
  geotoolsVersion = '18.2'
}

dependencies {
  implementation fileTree('libs') { include '*.jar' }
  //dependencies copied from test-shared. Otherwise we'd need the dependency graph in src/libs
  implementation group: 'junit', name: 'junit', version: '4.12'
  implementation group: 'org.hamcrest', name: 'hamcrest-library', version: '1.3'
  implementation group: 'org.json', name: 'json', version: '20180130'
  implementation group: 'ch.qos.logback', name: 'logback-classic', version: project.property('logbackVersion')
  implementation group: 'org.geotools', name: 'gt-main', version: project.property('geotoolsVersion')
  implementation group: 'org.geotools', name: 'gt-coverage', version: project.property('geotoolsVersion')
  implementation group: 'net.sourceforge.javacsv', name: 'javacsv', version: '2.0'
}

repositories {
  maven {
    url "http://download.osgeo.org/webdav/geotools/"
  }
  maven {
    url "http://maven.geo-solutions.it/"
  }
  mavenCentral()
}

task(integrationTest, type: Test) {
  if (project.property('useShellRunner')) {
    if (project.hasProperty('riskscapeBin')) {
      environment 'RISKSCAPE_CLI_BIN', project.property('riskscapeBin')
    }
    environment 'RISKSCAPE_CLI_TEST_RUNNER_CLASS', 'nz.org.riskscape.engine.cli.ShellRunner'
  }
  environment 'Kaiju_Home', project.property('kaijuHome')
  outputs.upToDateWhen {
    // always run tests
    false
  }
  useJUnit {
    includeCategories 'nz.org.riskscape.engine.cli.CliIntegrationTest'
  }
  testLogging {
    showStandardStreams = true
  }
}
