melix / jmh-gradle-plugin

Integrates the JMH benchmarking framework with Gradle
Apache License 2.0
659 stars 88 forks source link

Report compilation failure better than "process command finished with non-zero exit code 1" #249

Open vlsi opened 1 year ago

vlsi commented 1 year ago

Describe the bug

Sample output:

Benchmark classes should not be final.
   [org.apache.jmeter.testelement.property.PropertyGetBenchmarkKotlin]

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':src:core:jmhRunBytecodeGenerator'.
> Process 'command '/.../java/17.0.7-librca/bin/java'' finished with non-zero exit value 1

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.

* Get more help at https://help.gradle.org

Of course, the output does include "Benchmark classes should not be final", however it was not that obvious. It would be much better if "what went wrong" highlighted the true error rather than "non-zero exit code".

To Reproduce

Generate a benchmark within a final class. JMH wants benchmark classes to be non-final, so it fails the compilation.

The failure reason should have compilation errors or something like that.