/*
 * This file was generated by the Gradle 'init' task.
 * For more details on building Java & JVM projects, please refer to https://docs.gradle.org/8.7/userguide/building_java_projects.html in the Gradle documentation.
 */

plugins {
    // Apply the application plugin to add support for building a CLI application in Java.
    application
    // JMH Gradle Plugin
    id("me.champeau.jmh") version "0.7.2"
}

repositories {
    // Use Maven Central for resolving dependencies.
    mavenCentral()
}

dependencies {
    // Use JUnit Jupiter for testing.
    testImplementation(libs.junit.jupiter)

    testRuntimeOnly("org.junit.platform:junit-platform-launcher")

    // This dependency is used by the application.
    //implementation(libs.guava)
}

// Apply a specific Java toolchain to ease working on different environments.
java {
    toolchain {
        languageVersion = JavaLanguageVersion.of(23)
    }
}

// The `application` plugin provides the `JavaExec` task.
// It automatically creates one task of that type called `run`.
// It is not possible to rename it.
// Thus, we remove it and add two custom named `JavaExec` tasks instead.
tasks.getByName("run") {
    enabled = false
    description = "This task has been disabled. It does nothing o.O"
}

tasks.register<JavaExec>("runCustomBenchmark") {
    group = "application"
    classpath = sourceSets["main"].runtimeClasspath
    mainClass = "de.uni_marburg.powersort.benchmark.Main"
}

tasks.named<Test>("test") {
    // Use JUnit Platform for unit tests.
    useJUnitPlatform()

    reports {
        // XML reports for GitLab CI.
        junitXml.required.set(true)
        // HTML reports to view with a webbrowser.
        html.required.set(true)
    }
}