Skip to content

Commit

Permalink
Sort files when reading them from directories just in case
Browse files Browse the repository at this point in the history
  • Loading branch information
alexarchambault committed Mar 10, 2022
1 parent 04828ef commit d765fb0
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions modules/build/src/main/scala/scala/build/Inputs.scala
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,8 @@ final case class Inputs(
String.format(s"%040x", calculatedSum)
}

private def singleFilesFromDirectory(d: Inputs.Directory): Seq[Inputs.SingleFile] =
private def singleFilesFromDirectory(d: Inputs.Directory): Seq[Inputs.SingleFile] = {
import Ordering.Implicits.seqOrdering
os.walk.stream(d.path, skip = _.last.startsWith("."))
.filter(os.isFile(_))
.collect {
Expand All @@ -140,6 +141,8 @@ final case class Inputs(
Inputs.Script(d.path, p.subRelativeTo(d.path))
}
.toVector
.sortBy(_.subPath.segments)
}
}

object Inputs {
Expand Down Expand Up @@ -176,7 +179,9 @@ object Inputs {
}

sealed trait SingleFile extends OnDisk with SingleElement
sealed trait SourceFile extends SingleFile
sealed trait SourceFile extends SingleFile {
def subPath: os.SubPath
}
sealed trait Compiled extends Element
sealed trait AnyScalaFile extends Compiled

Expand Down

0 comments on commit d765fb0

Please sign in to comment.