artyushov / idea-jmh-plugin

Plugin for Itellij IDEA to make benchmarking with JMH easier.
MIT License
445 stars 43 forks source link

bazel support #48

Closed hugebdu closed 1 year ago

hugebdu commented 1 year ago

Is bazel as well supported?

Trying to run a benchmark fails with errors:

Resource compiler: Error: Couldn't copy [/Users/daniels/sources/server-infra/framework/future-utils/test/com/wixpress/framework/BUILD.bazel] to [/production/.workspace/framework/future-utils/test/com/wixpress/framework/BUILD.bazel]
java.io.IOException: Couldn't copy [/Users/daniels/sources/server-infra/framework/future-utils/test/com/wixpress/framework/BUILD.bazel] to [/production/.workspace/framework/future-utils/test/com/wixpress/framework/BUILD.bazel]
    at com.intellij.openapi.util.io.FileUtil.performCopy(FileUtil.java:419)
    at com.intellij.openapi.util.io.FileUtil.copyContent(FileUtil.java:408)
    at org.jetbrains.jps.incremental.FSOperations.copy(FSOperations.java:472)
    at org.jetbrains.jps.incremental.resources.ResourcesBuilder.copyResource(ResourcesBuilder.java:123)
    at org.jetbrains.jps.incremental.resources.ResourcesBuilder.lambda$build$0(ResourcesBuilder.java:67)
    at org.jetbrains.jps.incremental.fs.BuildFSState.processFilesToRecompile(BuildFSState.java:374)
    at org.jetbrains.jps.incremental.IncProjectBuilder$6.processDirtyFiles(IncProjectBuilder.java:1261)
    at org.jetbrains.jps.incremental.resources.ResourcesBuilder.build(ResourcesBuilder.java:56)
    at org.jetbrains.jps.incremental.resources.ResourcesBuilder.build(ResourcesBuilder.java:27)
    at org.jetbrains.jps.incremental.IncProjectBuilder.buildTarget(IncProjectBuilder.java:1266)
    at org.jetbrains.jps.incremental.IncProjectBuilder.runBuildersForChunk(IncProjectBuilder.java:1166)
    at org.jetbrains.jps.incremental.IncProjectBuilder.buildTargetsChunk(IncProjectBuilder.java:1303)
    at org.jetbrains.jps.incremental.IncProjectBuilder.buildChunkIfAffected(IncProjectBuilder.java:1118)
    at org.jetbrains.jps.incremental.IncProjectBuilder$BuildParallelizer$1.run(IncProjectBuilder.java:1084)
    at com.intellij.util.concurrency.BoundedTaskExecutor.doRun(BoundedTaskExecutor.java:243)
    at com.intellij.util.concurrency.BoundedTaskExecutor.access$200(BoundedTaskExecutor.java:29)
    at com.intellij.util.concurrency.BoundedTaskExecutor$1.executeFirstTaskAndHelpQueue(BoundedTaskExecutor.java:216)
    at com.intellij.util.ConcurrencyUtil.runUnderThreadName(ConcurrencyUtil.java:212)
    at com.intellij.util.concurrency.BoundedTaskExecutor$1.run(BoundedTaskExecutor.java:205)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
    at java.base/java.lang.Thread.run(Thread.java:1589)
Caused by: java.nio.file.FileSystemException: /production: Read-only file system
    at java.base/sun.nio.fs.UnixException.translateToIOException(UnixException.java:100)
    at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:106)
stokito commented 1 year ago

You just need to create a benchmark project, add dependency with JMH and then the plugin will show an icon to run the benchmark. The plugin doesn't know anything about any build system. Please note that you can't add a benchmark to existing project you need to create a separate project because the JMH actually adds a pre-compiler that mangles with bytecode to add sampling wrappers. So if you wish to use bazel you probably doing something wrong.