Skip to content

Commit

Permalink
Reduce memory consumption
Browse files Browse the repository at this point in the history
Creating chains of settings was consuming an exponential amount of memory. This did not scale when used with builds with dozens of modules.

By using dynamic settings, the chain of dependencies is not kept, resulting in less memory consumption.
  • Loading branch information
julienrf committed Jul 27, 2021
1 parent 81e9043 commit ce6657a
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ object SbtVersionPolicySettings {
versionPolicyIgnoredInternalDependencyVersions.value match {
case Some(versionRegex) =>
allProjectRefs.foldLeft(Def.setting(Set.empty[(String, String)])) { case (previousModules, (projectRef, _)) =>
Def.setting {
Def.settingDyn {
val projectOrganization = (projectRef / organization).value
val projectName = (projectRef / moduleName).value
val projectVersion = (projectRef / version).value
Expand All @@ -333,10 +333,10 @@ object SbtVersionPolicySettings {
CrossVersion(projectCrossVersion, projectScalaVersion, projectScalaBinaryVersion)
.fold(projectName)(_(projectName))
val module = projectOrganization -> nameWithBinarySuffix
previousModules.value + module
Def.setting(previousModules.value + module)
} else {
// Don’t include the module if its version does not match the regex
previousModules.value
Def.setting(previousModules.value)
}
}
}
Expand Down

0 comments on commit ce6657a

Please sign in to comment.