apply plugin: 'application'

mainClassName = 'au.com.dius.pactworkshop.dropwizardprovider.MainApplication'

dependencies {
  implementation 'io.dropwizard:dropwizard-core:1.3.25'
  implementation 'javax.xml.bind:jaxb-api:2.3.1'

  testCompile 'junit:junit:4.12'
  testCompile 'io.dropwizard:dropwizard-testing:1.3.25'
  testCompile 'au.com.dius.pact.provider:junit:4.1.19'
}

jar {
  manifest {
    attributes("Class-Path": (configurations.compile + configurations.runtime).collect { it.getName() }.join(' ') ,
      "Main-Class": mainClassName
    )
  }
}

run {
  if ( project.hasProperty("appArgs") ) {
    args appArgs.split(',')
  } else {
    args 'server'
  }
}

test {
  systemProperty 'pactBrokerHost', pactBrokerHost
  systemProperty 'pactBrokerScheme', pactBrokerScheme
  systemProperty 'pactBrokerPort', pactBrokerPort
  systemProperty 'pactBrokerUser', pactBrokerUser
  systemProperty 'pactBrokerPassword', pactBrokerPassword
  systemProperty 'pactbroker.consumerversionselectors.tags', 'test,prod'
  systemProperty 'pact.provider.version', '1.0.0'
  systemProperty 'pact.verifier.publishResults', 'true'
}
