plugins {
    id 'java'
    id 'groovy'
    id 'application'
    id "com.github.johnrengelman.shadow" version "7.1.2"
}

group 'com.aruistar'
version '1.0-SNAPSHOT'

repositories {
    maven {
        url "https://oss.sonatype.org/content/repositories/snapshots"
        mavenContent {
            snapshotsOnly()
        }
    }
    mavenCentral()
}

def vertxVersion = "4.4.1"
def junitJupiterVersion = "5.6.0"


def mainVerticleName = "com.aruistar.geekwalk.ProxyVerticle"
def watchForChange = "src/**/*"
def doOnChange = "./gradlew classes"
def launcherClassName = "io.vertx.core.Launcher"

application {
    mainClassName = launcherClassName
}

dependencies {
    implementation("io.vertx:vertx-core:$vertxVersion")
    implementation("io.vertx:vertx-web:$vertxVersion")
    implementation("io.vertx:vertx-web-client:$vertxVersion")

    testImplementation("org.codehaus.groovy:groovy:3.0.8")
    testImplementation("org.codehaus.groovy:groovy-json:3.0.8")

    testImplementation("org.assertj:assertj-core:3.19.0")
    testImplementation("io.vertx:vertx-junit5:$vertxVersion")
}

//java {
//    sourceCompatibility = JavaVersion.VERSION_1_8
//    targetCompatibility = JavaVersion.VERSION_1_8
//}

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

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