From 0e1a0516768712d034697af460aa0bdc991d536f Mon Sep 17 00:00:00 2001 From: "Kenneth J. Shackleton" Date: Mon, 3 Jun 2024 07:50:42 +0100 Subject: [PATCH] Configuration cache friendly JMH plugin. Signed-off-by: Kenneth J. Shackleton --- buildSrc/src/main/kotlin/JmhPlugin.kt | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/buildSrc/src/main/kotlin/JmhPlugin.kt b/buildSrc/src/main/kotlin/JmhPlugin.kt index 4817d09611..5c7ac24cbf 100644 --- a/buildSrc/src/main/kotlin/JmhPlugin.kt +++ b/buildSrc/src/main/kotlin/JmhPlugin.kt @@ -36,19 +36,19 @@ class JmhPlugin : Plugin { } } tasks.register("jmh", JavaExec::class.java) { - val reportDir = "$buildDir/reports/jmh" - val reportFile = "$reportDir/jmh.json" + val reportDir = layout.buildDirectory.dir("reports/jmh") + val reportFile = layout.buildDirectory.file("reports/jmh/jmh.json") group = "benchmark" dependsOn("jmhClasses") mainClass.set("org.openjdk.jmh.Main") args( "-rf", "json", - "-rff", reportFile + "-rff", reportFile.get().asFile.absolutePath ) classpath(sourceSets.getByName("jmh").runtimeClasspath) - doFirst { mkdir(reportDir) } + doFirst { reportDir.get().asFile.mkdir() } outputs.apply { - file(reportFile) + file(reportFile.get().asFile) upToDateWhen { false } } }