From 66701d4852bb56f7384b5fb9c0681ca595f2c696 Mon Sep 17 00:00:00 2001 From: Aleksandra Zdrojowa Date: Fri, 11 Oct 2024 11:46:03 +0200 Subject: [PATCH] cosmetic changes in DependenciesExtractor --- .../sbt/extractors/DependenciesExtractor.scala | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/extractor/src/main/scala/org/jetbrains/sbt/extractors/DependenciesExtractor.scala b/extractor/src/main/scala/org/jetbrains/sbt/extractors/DependenciesExtractor.scala index 579bf91..f226c11 100644 --- a/extractor/src/main/scala/org/jetbrains/sbt/extractors/DependenciesExtractor.scala +++ b/extractor/src/main/scala/org/jetbrains/sbt/extractors/DependenciesExtractor.scala @@ -61,7 +61,7 @@ class DependenciesExtractor(unmanagedClasspath: SbtConfiguration => Keys.Classpa val allModuleDependencies = forAllConfigurations(modulesIn) if (separateProdTestSources) { processDependencies(allModuleDependencies) { case(moduleId, configs) => - ModuleDependencyData.apply(moduleId, configs) + ModuleDependencyData(moduleId, configs) } } else { val dependencies = allModuleDependencies.map { case(moduleId, configs) => @@ -141,18 +141,11 @@ class DependenciesExtractor(unmanagedClasspath: SbtConfiguration => Keys.Classpa } private def updateProductionConfigs(prodConfigs: Seq[Configuration], allConfigs: Set[Configuration]): Seq[Configuration] = { - def mergeProvidedAndRuntime(): Seq[Configuration] = - prodConfigs.map { - case Configuration.Provided | Configuration.Runtime => Configuration.Compile - case x => x - }.distinct - - val shouldMergeProvidedAndRuntime = Seq(Configuration.Provided, Configuration.Runtime).forall(prodConfigs.contains) + val containsProvidedAndRuntime = Seq(Configuration.Provided, Configuration.Runtime).forall(prodConfigs.contains) val isCustomSourceConfigPresent = allConfigs.map(_.name).toSeq.intersect(sourceConfigurationsNames).nonEmpty - if (shouldMergeProvidedAndRuntime) { - mergeProvidedAndRuntime() - } else if (prodConfigs.isEmpty && isCustomSourceConfigPresent) { + val shouldBeCompileScope = containsProvidedAndRuntime || (prodConfigs.isEmpty && isCustomSourceConfigPresent) + if (shouldBeCompileScope) { Seq(Configuration.Compile) } else { prodConfigs