Skip to content
Snippets Groups Projects
build.gradle 3.15 KiB
Newer Older
Clayton, Brandon Scott's avatar
Clayton, Brandon Scott committed
plugins {
Clayton, Brandon Scott's avatar
Clayton, Brandon Scott committed
  id "application"
Clayton, Brandon Scott's avatar
Clayton, Brandon Scott committed
  id "com.diffplug.gradle.spotless" version "${spotlessVersion}"
  id "com.github.johnrengelman.shadow" version "5.2.0"
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 "jacoco"
Clayton, Brandon Scott's avatar
Clayton, Brandon Scott committed
  id "java"
Clayton, Brandon Scott's avatar
Clayton, Brandon Scott committed
  id "net.ltgt.apt-eclipse" version "${aptEclipseVersion}"
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"

Clayton, Brandon Scott's avatar
Clayton, Brandon Scott committed
repositories {
  jcenter()
}

// TODO uncomment once nshmp-lib is stable
// git {
//   implementation("https://code.usgs.gov/ghsc/nshmp/nshmp-lib.git", {
//     name "nshmp-ws-dep--nshmp-lib"
//     tag "v0.0.5"
//   })
// }
  // nshmpLib = "libs/nshmp-ws-dep--nshmp-lib"
  nshmpLib = "../nshmp-lib"
  nshmpLibGradleDir = "${nshmpLib}/gradle"
  spotbugsDir = "${nshmpLib}/gradle"
  spotlessDir = "${nshmpLib}/src/main/resources"
}

apply from: "${nshmpLibGradleDir}/git-hooks.gradle"
apply from: "${nshmpLibGradleDir}/spotbugs.gradle"
apply from: "${nshmpLibGradleDir}/spotless.gradle"

dependencies {
  // TODO remove once nshmp-lib is stable
  implementation project(":nshmp-lib")

  annotationProcessor platform("io.micronaut:micronaut-bom:${mnVersion}")
Clayton, Brandon Scott's avatar
Clayton, Brandon Scott committed
  annotationProcessor "io.micronaut:micronaut-inject-java"
  annotationProcessor "io.micronaut:micronaut-validation"
  implementation platform("io.micronaut:micronaut-bom:${mnVersion}")
Clayton, Brandon Scott's avatar
Clayton, Brandon Scott committed
  implementation "io.micronaut:micronaut-http-client"
  implementation "io.micronaut:micronaut-inject"
  implementation "io.micronaut:micronaut-validation"
  implementation "io.micronaut:micronaut-runtime"
  implementation "io.micronaut:micronaut-http-server-netty"
  implementation "com.fasterxml.jackson.module:jackson-module-parameter-names:${jacksonVersion}"
  runtimeOnly "ch.qos.logback:logback-classic:${logbackVersion}"
Clayton, Brandon Scott's avatar
Clayton, Brandon Scott committed
  // Swagger
  annotationProcessor("io.micronaut.configuration:micronaut-openapi:${mnOpenAPIVersion}")
Clayton, Brandon Scott's avatar
Clayton, Brandon Scott committed
  implementation("io.swagger.core.v3:swagger-annotations:${swaggerVersion}")

Clayton, Brandon Scott's avatar
Clayton, Brandon Scott committed
  // junit
  testAnnotationProcessor "io.micronaut:micronaut-inject-java:${mnVersion}"
  testImplementation platform("io.micronaut:micronaut-bom:${mnVersion}")
  testImplementation "org.junit.jupiter:junit-jupiter:${junitVersion}"
  testImplementation "org.junit.jupiter:junit-jupiter-api"
  testImplementation "io.micronaut.test:micronaut-test-junit5"
  testImplementation "io.micronaut.test:micronaut-test-spock"
  testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine"
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')
}

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