jmh-gradle-plugin icon indicating copy to clipboard operation
jmh-gradle-plugin copied to clipboard

jmh doesn't respect $buildDir

Open sherter opened this issue 8 years ago • 2 comments

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...

sherter avatar Oct 18 '16 11:10 sherter

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.

sgraf812 avatar Oct 18 '16 16:10 sgraf812

Well, then the evaluation of the buildDir variable must be delayed (put it in the afterEvaluate section)

sherter avatar Oct 18 '16 16:10 sherter