Skip to content

Commit

Permalink
ignore "jmh" sbt configuration from JmhPlugin (workaround fix) #SCL-1…
Browse files Browse the repository at this point in the history
…3127 fixed
  • Loading branch information
unkarjedy committed Jun 19, 2024
1 parent 02184b3 commit db92bea
Showing 1 changed file with 24 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,30 @@ class ProjectExtractor(
case repo: MavenRepository => ResolverData(repo.name, repo.root)
}.toSet

val configurations =
mergeConfigurations(
sourceConfigurations.flatMap(extractConfiguration(Compile.name)) ++
testConfigurations.flatMap(extractConfiguration(Test.name))
)
/**
* Ignore "jmh" configuration.<br>
* This is a dirty WORKAROUND for https://youtrack.jetbrains.com/issue/SCL-13127<br>
* "jmh" configuration is defined in some strange way:<br>
* - it extends Test configuration
* - it also assigns compilation output to Compile configuration compilation output
* {{{
* val Jmh = config("jmh") extend Test
* classDirectory := (classDirectory in Compile).value
* }}}
*
* It should be fine to ignore this configuration as we don't support it natively in IntelliJ anyway.
*
* @see https://github.com/sbt/sbt-jmh
* @see https://github.com/sbt/sbt-jmh/blob/main/plugin/src/main/scala/pl/project13/scala/sbt/JmhPlugin.scala
*/
def isJmhConfiguration(config: sbt.Configuration): Boolean =
config.name.toLowerCase == "jmh"

val compileConfigurationsData = sourceConfigurations.flatMap(extractConfiguration(Compile.name))
val testConfigurationData = testConfigurations
.filterNot(isJmhConfiguration)
.flatMap(extractConfiguration(Test.name))
val configurations = mergeConfigurations(compileConfigurationsData ++ testConfigurationData)
ProjectData(
projectRef.id,
projectRef.build,
Expand Down

0 comments on commit db92bea

Please sign in to comment.