-
Notifications
You must be signed in to change notification settings - Fork 91
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Run tests from other directories than src/main/scala #63
Comments
What tests? Technically you could, but I'd rather not suggest that (just override the settings) |
Which setting would one need to override for using a custom source directory that contains the benchmarks (such as I guess moving the benchmark code into its own module/project is a decent solution as well, but that would require making it a multi-module sbt project for some people :-). |
The gradle plugin for JMH (https://github.com/melix/jmh-gradle-plugin) uses |
Hey there, Would you like to contrib this fix? I'm a bit overloaded right now? |
We're just integrating a previously external jmh project into our multimodule project, so that it's kept in sync with code changes and lower the barrier to run benchmarks after changes. Because our benchmarks depend on the test artifact of another module (which provides e.g. scalacheck generators) and Intellij does not support "compile->test" dependencies (it just ignores the dependency) we're also "forced" to integrate jmh into the test configuration. Here's a "hack" that seems to do the trick: In our multimodule build.sbt we have this dependency:
In microbench/build.sbt:
Hopefully this helps others until we have a better solution. |
As mentioned in [sbt#63|sbt#63 (comment)] one can hack around the hardcoded config that is used for `classDirectory` and `dependencyClasspath` (both are taken from the `Compile` config). This change allows the user to set ``` classDirectory in Jmh := (classDirectory in Test).value dependencyClasspath in Jmh := (dependencyClasspath in Test).value ``` so that jmh will use the appropriate values.
As mentioned in [sbt#63](sbt#63 (comment)) one can hack around the hardcoded config that is used for `classDirectory` and `dependencyClasspath` (both are taken from the `Compile` config). This change allows the user to set ``` classDirectory in Jmh := (classDirectory in Test).value dependencyClasspath in Jmh := (dependencyClasspath in Test).value ``` so that jmh will use the appropriate values.
As mentioned in [#63](#63 (comment)) one can hack around the hardcoded config that is used for `classDirectory` and `dependencyClasspath` (both are taken from the `Compile` config). This change allows the user to set ``` classDirectory in Jmh := (classDirectory in Test).value dependencyClasspath in Jmh := (dependencyClasspath in Test).value ``` so that jmh will use the appropriate values.
To answer the OP's (@tomqaz) question, the following code in sourceDirectory in Jmh := (sourceDirectory in Test).value
classDirectory in Jmh := (classDirectory in Test).value
dependencyClasspath in Jmh := (dependencyClasspath in Test).value |
Thanks @alexandrnikitin for the comment at sbt/sbt-jmh#63 (comment)
It is possible to keep tests for example in src/test/scala directory?
The text was updated successfully, but these errors were encountered: