mirror of https://github.com/sbt/sbt.git
[2.x] test: Add move-file test (#9197)
**Problem** Moving files around seems to break compile task.
This commit is contained in:
parent
1f151ad6e3
commit
59c007d6a4
|
|
@ -0,0 +1,5 @@
|
|||
package example
|
||||
|
||||
object Main {
|
||||
def main(args: Array[String]): Unit = ()
|
||||
}
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
import sbt.internal.inc.Analysis
|
||||
import complete.DefaultParsers.*
|
||||
|
||||
scalaVersion := "2.13.18"
|
||||
|
||||
val checkStampSize = inputKey[Unit]("Verifies the accumulated number of iterations of incremental compilation.")
|
||||
checkStampSize := {
|
||||
val expected: Int = (Space ~> NatBasic).parsed
|
||||
val analysis = (Compile / compile).value match
|
||||
case a: Analysis => a
|
||||
println(s"analysis: $analysis")
|
||||
val sourceStampSize = analysis.readStamps.getAllSourceStamps.size
|
||||
assert(sourceStampSize == expected, s"sourceStampSize = $sourceStampSize")
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
> checkStampSize 1
|
||||
|
||||
# move A.scala elsewhere
|
||||
$ copy-file A.scala A.txt
|
||||
$ delete A.scala
|
||||
> checkStampSize 0
|
||||
|
||||
# move A.scala back
|
||||
$ copy-file A.txt A.scala
|
||||
$ delete A.txt
|
||||
$ exists A.scala
|
||||
|
||||
> show Compile/sources
|
||||
|
||||
# if we recompile, we should regain stamp size 1
|
||||
> debug
|
||||
> checkStampSize 1
|
||||
Loading…
Reference in New Issue