@@ -55,8 +55,17 @@ final class SbtAlg[F[_]](config: Config)(implicit
5555 for {
5656 buildRootDir <- workspaceAlg.buildRootDir(buildRoot)
5757 maybeSbtVersion <- getSbtVersion(buildRootDir)
58- lines <- addStewardPluginTemporarily(buildRootDir, maybeSbtVersion).surround {
59- val commands = Nel .of(crossStewardDependencies, reloadPlugins, stewardDependencies)
58+ metaBuilds = Math .max(
59+ LazyList
60+ .iterate(buildRootDir / project)(_ / project)
61+ .takeWhile(p => p.exists && p.isDirectory)
62+ .size,
63+ 1 // There is always at least one meta build, even if there is no project folder
64+ )
65+ lines <- addStewardPluginTemporarily(buildRootDir, maybeSbtVersion, metaBuilds).surround {
66+ val commands = Nel .of(crossStewardDependencies) ++ List
67+ .fill(metaBuilds)(List (reloadPlugins, stewardDependencies))
68+ .flatten
6069 sbt(commands, buildRootDir)
6170 }
6271 dependencies = parser.parseDependencies(lines)
@@ -65,7 +74,8 @@ final class SbtAlg[F[_]](config: Config)(implicit
6574
6675 private def addStewardPluginTemporarily (
6776 buildRootDir : File ,
68- maybeSbtVersion : Option [Version ]
77+ maybeSbtVersion : Option [Version ],
78+ metaBuilds : Int
6979 ): Resource [F , Unit ] =
7080 for {
7181 _ <- Resource .unit[F ]
@@ -74,8 +84,9 @@ final class SbtAlg[F[_]](config: Config)(implicit
7484 case _ => " 1_3_11"
7585 }
7686 plugin <- Resource .eval(stewardPlugin(pluginVersion))
77- _ <- fileAlg.createTemporarily(buildRootDir / project, plugin)
78- _ <- fileAlg.createTemporarily(buildRootDir / project / project, plugin)
87+ _ <- List
88+ .iterate(buildRootDir / project, metaBuilds + 1 )(_ / project)
89+ .collectFold(fileAlg.createTemporarily(_, plugin))
7990 } yield ()
8091
8192 private def stewardPlugin (version : String ): F [FileData ] = {
0 commit comments