powersort/app/build.gradle.kts

91 lines
3.3 KiB
Plaintext
Raw Normal View History

2024-11-19 18:43:10 +01:00
/*
* 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
2025-01-07 16:43:15 +00:00
// JMH Gradle Plugin
2025-01-07 16:43:15 +00:00
// https://github.com/melix/jmh-gradle-plugin/blob/master/README.adoc#usage
id("me.champeau.jmh") version "0.7.2"
2024-11-19 18:43:10 +01:00
}
repositories {
// Use Maven Central for resolving dependencies.
mavenCentral()
}
2025-01-07 16:43:15 +00:00
val latestJmhVersion = "1.37"
2024-11-19 18:43:10 +01:00
dependencies {
// Use JUnit Jupiter for testing.
testImplementation(libs.junit.jupiter)
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
2025-01-07 16:43:15 +00:00
// Required to use the IntelliJ plugin "JMH Java Microbenchmark Harness".
// https://stackoverflow.com/a/71286156/6334421
jmhAnnotationProcessor("org.openjdk.jmh:jmh-generator-annprocess:$latestJmhVersion")
2024-11-19 18:43:10 +01:00
}
// Apply a specific Java toolchain to ease working on different environments.
java {
toolchain {
languageVersion = JavaLanguageVersion.of(23)
2024-11-19 18:43:10 +01:00
}
}
// 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") {
description = "This task has been disabled. It does nothing o.O"
2025-01-07 17:32:18 +00:00
enabled = false
}
2025-01-07 17:32:18 +00:00
tasks.register<JavaExec>("runCbmCgl") {
description = "Run Custom Benchmark (CBM) with Custom Generated Lists (CGL)"
group = "application"
classpath = sourceSets["main"].runtimeClasspath
mainClass = "de.uni_marburg.powersort.benchmark.CbmCgl"
}
tasks.register<JavaExec>("runCbmCompetition") {
description = "Run Custom Benchmark (CBM) with Powersort competition lists"
group = "application"
classpath = sourceSets["main"].runtimeClasspath
2025-01-07 17:32:18 +00:00
mainClass = "de.uni_marburg.powersort.benchmark.CbmCompetition"
2024-11-19 18:43:10 +01:00
}
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)
}
2025-01-07 16:43:15 +00:00
}
// https://github.com/melix/jmh-gradle-plugin/blob/master/README.adoc#configuration-options
jmh {
// Use latest JMH version (1.37, https://github.com/openjdk/jmh/tags)
// instead of default (1.36, https://github.com/melix/jmh-gradle-plugin/blob/dfdbb0cd3a363e2dbbcaab93bb1be32178f4cae4/src/main/java/me/champeau/jmh/DefaultsConfigurer.java#L24)
jmhVersion = latestJmhVersion // Specifies JMH version
// Force GC (garbage collection) between iterations.
//
// Forcing the GC may help to lower the noise in GC-heavy benchmarks, at the expense of jeopardizing GC ergonomics decisions. Use with care.
// https://github.com/openjdk/jmh/blob/1be779e0b4af174b67abf8080d1b76dda570d88d/jmh-core/src/main/java/org/openjdk/jmh/runner/options/CommandLineOptions.java#L148-L152
forceGC = true
excludes = listOf(
2025-01-07 17:54:06 +00:00
// To skip JmhCgl or JmhCompetition, uncomment it below.
// "de.uni_marburg.powersort.benchmark.JmhCgl.benchmark",
// "de.uni_marburg.powersort.benchmark.JmhCompetition.benchmark",
2025-01-07 16:43:15 +00:00
)
}