summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFabian Mastenbroek <mail.fabianm@gmail.com>2021-10-19 10:59:47 +0200
committerFabian Mastenbroek <mail.fabianm@gmail.com>2021-10-25 15:37:21 +0200
commit1b0cf98d4d7b842fffcc62a1c7cf50cba0f97277 (patch)
tree7fefaf0bd4ac3d86773c08363c4926d1a529f04e
parent52eae4b9ed571573d995b7d47ecb7789a1b4d8ac (diff)
build(jmh): Fix duplicate classpath entries
This change fixes an issue with the JMH plugin where entries would be included twice on the classpath or entries that did not belong on the classpath were also included.
-rw-r--r--buildSrc/src/main/kotlin/benchmark-conventions.gradle.kts16
-rw-r--r--opendc-simulator/opendc-simulator-flow/build.gradle.kts2
2 files changed, 18 insertions, 0 deletions
diff --git a/buildSrc/src/main/kotlin/benchmark-conventions.gradle.kts b/buildSrc/src/main/kotlin/benchmark-conventions.gradle.kts
index 65608e8f..7d8775c6 100644
--- a/buildSrc/src/main/kotlin/benchmark-conventions.gradle.kts
+++ b/buildSrc/src/main/kotlin/benchmark-conventions.gradle.kts
@@ -20,6 +20,7 @@
* SOFTWARE.
*/
+import me.champeau.jmh.JMHTask
import org.jetbrains.kotlin.allopen.gradle.*
plugins {
@@ -37,4 +38,19 @@ jmh {
profilers.add("stack")
profilers.add("gc")
+
+ includeTests.set(false) // Do not include tests by default
+}
+
+tasks.named("jmh", JMHTask::class) {
+ outputs.upToDateWhen { false } // XXX Do not cache the output of this task
+
+ testRuntimeClasspath.setFrom() // XXX Clear test runtime classpath to eliminate duplicate dependencies on classpath
+}
+
+dependencies {
+ constraints {
+ val libs = Libs(project)
+ jmh(libs["commons.math3"]) // XXX Force JMH to use the same commons-math3 version as OpenDC
+ }
}
diff --git a/opendc-simulator/opendc-simulator-flow/build.gradle.kts b/opendc-simulator/opendc-simulator-flow/build.gradle.kts
index 05e21c3c..f5b67851 100644
--- a/opendc-simulator/opendc-simulator-flow/build.gradle.kts
+++ b/opendc-simulator/opendc-simulator-flow/build.gradle.kts
@@ -36,4 +36,6 @@ dependencies {
testImplementation(projects.opendcSimulator.opendcSimulatorCore)
testImplementation(libs.slf4j.simple)
+
+ jmhImplementation(projects.opendcSimulator.opendcSimulatorCore)
}