Skip to content

Commit

Permalink
cosmetic changes in DependenciesExtractor
Browse files Browse the repository at this point in the history
  • Loading branch information
azdrojowa123 committed Oct 11, 2024
1 parent ec7838d commit 66701d4
Showing 1 changed file with 4 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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) =>
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 66701d4

Please sign in to comment.