Fix checkbuild sources for projects with meta-meta-build

If a project had a meta-meta build (project/project), the build sources
in the project directory were ignored. This was because the projectGlobs
method did not correctly handle recursion. It inadvertently
discarded the accumulator globs and only returned the most recently
generated globs. This commit fixes that and adds a regression test to
the nio/reload scripted test.
This commit is contained in:
Ethan Atkins 2019-09-21 10:39:54 -07:00
parent d07c2b4520
commit bb0fd5c84c
2 changed files with 6 additions and 2 deletions

View File

@ -67,14 +67,14 @@ private[sbt] object CheckBuildSources {
@tailrec
def projectGlobs(projectDir: File, globs: Seq[Glob]): Seq[Glob] = {
val glob = projectDir.toGlob
val base = Seq(
val updatedGlobs = globs ++ Seq(
glob / "*.{sbt,scala,java}",
// We only want to recursively look in source because otherwise we have to search
// the project target directories which is expensive.
glob / "src" / ** / "*.{scala,java}"
)
val nextLevel = projectDir / "project"
if (nextLevel.exists) projectGlobs(nextLevel, base) else base
if (nextLevel.exists) projectGlobs(nextLevel, updatedGlobs) else updatedGlobs
}
projectGlobs(projectDir, baseDir.toGlob / "*.sbt" :: Nil)
} else Nil

View File

@ -29,3 +29,7 @@ $ copy-file changes/sub.sbt sub/build.sbt
$ copy-file changes/ScalafmtVersion.scala project/project/ScalafmtVersion.scala
> scalafmt
$ delete project/plugins.sbt
-> scalafmt