jmh-gradle-plugin
jmh-gradle-plugin copied to clipboard
jmh doesn't respect $buildDir
When setting $buildDir
to something else than /build
, the jmh task fails with an exception:
Processing 0 classes from /home/simon/repositories/minijavac/build/classes/jmh with "reflection" generator
Writing out Java source to /home/simon/repositories/minijavac/build/jmh-generated-sources and resources to /home/simon/repositories/minijavac/build/jmh-generated-classes
Error writing compiler hint list
java.io.IOException: Unable to create /home/simon/repositories/minijavac/build/jmh-generated-classes/META-INF
at org.openjdk.jmh.generators.core.FileSystemDestination.newResource(FileSystemDestination.java:56)
at org.openjdk.jmh.generators.core.CompilerControlPlugin.finish(CompilerControlPlugin.java:101)
at org.openjdk.jmh.generators.core.BenchmarkGenerator.complete(BenchmarkGenerator.java:128)
at org.openjdk.jmh.generators.bytecode.JmhBytecodeGenerator.main(JmhBytecodeGenerator.java:101)
Error writing benchmark list
java.io.IOException: Unable to create /home/simon/repositories/minijavac/build/jmh-generated-classes/META-INF
at org.openjdk.jmh.generators.core.FileSystemDestination.newResource(FileSystemDestination.java:56)
at org.openjdk.jmh.generators.core.BenchmarkGenerator.complete(BenchmarkGenerator.java:199)
at org.openjdk.jmh.generators.bytecode.JmhBytecodeGenerator.main(JmhBytecodeGenerator.java:101)
It looks like the path build
is hardcoded somewhere or $buildDir is evaluated too early...
Actually, it's not that it's hard-coded, but that there is no way we can set the buildDir
before the plugins{}
. One could use the old plugins
syntax though.
Well, then the evaluation of the buildDir
variable must be delayed (put it in the afterEvaluate section)