/*
 * This file was generated by the Gradle 'init' task.
 *
 * This is a general purpose Gradle build.
 * Learn how to create Gradle builds at https://guides.gradle.org/creating-new-gradle-builds/
 */
plugins {
  id 'java'
  id 'application'
  id 'com.github.johnrengelman.shadow' version '5.2.0'
}
ext {
  vertxVersion = '4.0.0'
}

repositories {
  mavenLocal()
  jcenter()
}

group = 'com.aruistar'
version = '1.0.0-SNAPSHOT'

mainClassName = 'io.vertx.core.Launcher'

def mainVerticleName = 'com.aruistar.vertxstarter.MainVerticle'
def watchForChange = 'src/**/*'
def doOnChange = 'gradle classes'

dependencies {

  implementation "io.vertx:vertx-core:$vertxVersion"
  implementation "io.vertx:vertx-web:$vertxVersion"
  implementation "io.vertx:vertx-pg-client:$vertxVersion"

  implementation group: 'ch.qos.logback', name: 'logback-classic', version: '1.2.3'
  implementation group: 'org.slf4j', name: 'jul-to-slf4j', version: '1.7.30'

  testImplementation "io.vertx:vertx-junit5:$vertxVersion"

  testImplementation "io.vertx:vertx-web-client:$vertxVersion"
  testImplementation "org.codehaus.groovy:groovy-sql:3.0.7"
  testImplementation group: 'org.postgresql', name: 'postgresql', version: '42.2.5'
}

java {
  sourceCompatibility = JavaVersion.VERSION_11
  targetCompatibility = JavaVersion.VERSION_11
}

shadowJar {
  classifier = 'fat'
  manifest {
    attributes 'Main-Verticle': mainVerticleName
  }
  mergeServiceFiles {
    include 'META-INF/services/io.vertx.core.spi.VerticleFactory'
  }
}

test {
  useJUnitPlatform()
  testLogging {
    events 'PASSED', 'FAILED', 'SKIPPED'
  }
}

run {
  args = ['run', mainVerticleName, "--redeploy=$watchForChange", "--launcher-class=$mainClassName", "--on-redeploy=$doOnChange"]
}

