Skip to content
Snippets Groups Projects
tasks.gradle 1.16 KiB
Newer Older
apply plugin: "com.star-zero.gradle.githook"
apply plugin: "com.github.spotbugs"
apply plugin: "com.diffplug.gradle.spotless"

tasks.withType(JavaCompile) {
  options.encoding = "UTF-8"
  options.compilerArgs.add("-parameters")
}

tasks.withType(JavaExec) {
  jvmArgs('-noverify', '-XX:TieredStopAtLevel=1', '-Dcom.sun.management.jmxremote')
}

task nshmpLibArtifacts(type: Copy) {
  from {
    configurations.nshmp.collect { zipTree(it) }
  }
  into nshmpLib
}

/* SpotBugs */
tasks.withType(com.github.spotbugs.snom.SpotBugsTask) {
  dependsOn nshmpLibArtifacts
  reports {
    html {
      enabled true
      stylesheet = 'fancy-hist.xsl'
    }
  }
}

/* Spotless */
tasks.withType(com.diffplug.gradle.spotless.SpotlessExtension) {
  dependsOn nshmpLibArtifacts
}

/* Githook */
tasks.withType(com.star_zero.gradle.githook.GithookExtension) {
  dependsOn nshmpLibArtifacts
}

/* Run UpdateSwagger */
task swagger(type: JavaExec) {
  doFirst {
    mkdir swaggerDir
  }
  classpath sourceSets.main.runtimeClasspath
  main = "gov.usgs.earthquake.nshmp.netcdf.swagger.UpdateSwagger"
}

task swaggerClean(type: Delete) {
  delete swaggerDir
}

task libsClean(type: Delete) {
  delete libsDir
}