Skip to content
Snippets Groups Projects
build.gradle 2.05 KiB
Newer Older
Clayton, Brandon Scott's avatar
Clayton, Brandon Scott committed
plugins {
Clayton, Brandon Scott's avatar
Clayton, Brandon Scott committed
  id "application"
  id "com.diffplug.spotless" version "${spotlessVersion}"
  id "com.github.johnrengelman.shadow" version "${shadowVersion}"
  id "com.github.node-gradle.node" version "${nodeVersion}"
Clayton, Brandon Scott's avatar
Clayton, Brandon Scott committed
  id "com.github.spotbugs" version "${spotbugsVersion}"
  id "com.star-zero.gradle.githook" version "${githooksVersion}"
Clayton, Brandon Scott's avatar
Clayton, Brandon Scott committed
  id "eclipse-wtp"
  id "io.micronaut.application" version "${mnPluginVersion}"
Clayton, Brandon Scott's avatar
Clayton, Brandon Scott committed
  id "jacoco"
  id "java-library"
  id "maven-publish"
Clayton, Brandon Scott's avatar
Clayton, Brandon Scott committed
sourceCompatibility = JavaVersion.VERSION_11
Clayton, Brandon Scott's avatar
Clayton, Brandon Scott committed
compileJava.options.encoding = "UTF-8"
Clayton, Brandon Scott's avatar
Clayton, Brandon Scott committed
mainClassName = "gov.usgs.earthquake.nshmp.www.Application"

configurations {
  nshmp
java {
  withSourcesJar()
}

  libsDir = "libs"
  nshmpLib = "${libsDir}/nshmp-lib-artifacts"
  nshmpLibGradleDir = "${nshmpLib}/gradle"
  spotbugsDir = "${nshmpLib}/gradle"
  spotlessDir = "${nshmpLib}/src/main/resources"
}

apply from: "${projectDir}/gradle/repositories.gradle"
apply from: "${projectDir}/gradle/dependencies.gradle"
Clayton, Brandon Scott's avatar
Clayton, Brandon Scott committed
test {
Clayton, Brandon Scott's avatar
Clayton, Brandon Scott committed
  useJUnitPlatform()

Clayton, Brandon Scott's avatar
Clayton, Brandon Scott committed
  reports {
    junitXml.enabled = true
    html.enabled = true
  }
}

jacocoTestReport {
  reports {
    xml.enabled true
    html.enabled true
  }
}
check.dependsOn jacocoTestReport

Clayton, Brandon Scott's avatar
Clayton, Brandon Scott committed
shadowJar {
  mergeServiceFiles()
}

Clayton, Brandon Scott's avatar
Clayton, Brandon Scott committed
tasks.withType(JavaCompile) {
  options.encoding = "UTF-8"
Clayton, Brandon Scott's avatar
Clayton, Brandon Scott committed
  options.compilerArgs.add("-parameters")
tasks.withType(JavaExec) {
  jvmArgs('-noverify', '-XX:TieredStopAtLevel=1', '-Dcom.sun.management.jmxremote')
}

task libsClean(type: Delete) {
  delete libsDir
}
clean.dependsOn libsClean


/* Add HTML reports to SpotBugs */
Clayton, Brandon Scott's avatar
Clayton, Brandon Scott committed
tasks.withType(com.github.spotbugs.snom.SpotBugsTask) {
  reports {
Clayton, Brandon Scott's avatar
Clayton, Brandon Scott committed
    html {
      enabled true
      stylesheet = 'fancy-hist.xsl'
    }

gradle.afterProject {
  copy {
    from {
      configurations.nshmp.collect { zipTree(it) }
    }
    into nshmpLib
  }
  apply from: "${nshmpLibGradleDir}/git-hooks.gradle"
Clayton, Brandon Scott's avatar
Clayton, Brandon Scott committed
  // apply from: "${nshmpLibGradleDir}/node.gradle"
  apply from: "${nshmpLibGradleDir}/spotbugs.gradle"
  apply from: "${nshmpLibGradleDir}/spotless.gradle"
Clayton, Brandon Scott's avatar
Clayton, Brandon Scott committed
  apply from: "${projectDir}/gradle/node.gradle"