diff --git a/extractor/src/main/scala/org/jetbrains/sbt/extractors/ProjectExtractor.scala b/extractor/src/main/scala/org/jetbrains/sbt/extractors/ProjectExtractor.scala index b1fcf89..a02a5e2 100644 --- a/extractor/src/main/scala/org/jetbrains/sbt/extractors/ProjectExtractor.scala +++ b/extractor/src/main/scala/org/jetbrains/sbt/extractors/ProjectExtractor.scala @@ -1,15 +1,15 @@ package org.jetbrains.sbt package extractors -import org.jetbrains.sbt.structure._ +import org.jetbrains.sbt.structure.* import sbt.Def.Initialize import sbt.jetbrains.keysAdapterEx -import sbt.{Def, File, Configuration => _, _} +import sbt.{Def, File, Configuration as _, *} import scala.reflect.ClassTag import scala.util.{Failure, Success, Try} // don't remove this import: sbt.jetbrains.apiAdapter._ -- it shadows some symbols for sbt 1.0 compatibility -import sbt.jetbrains.apiAdapter._ +import sbt.jetbrains.apiAdapter.* /** * @author Nikolay Obedin @@ -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.
+ * This is a dirty WORKAROUND for https://youtrack.jetbrains.com/issue/SCL-13127
+ * "jmh" configuration is defined in some strange way:
+ * - 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.id.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,