mirror of https://github.com/sbt/sbt.git
Merge pull request #8087 from eed3si9n/wip/test-quick-bug2
[1.x] fix: Fix incremental test with companion objects
This commit is contained in:
commit
978dd5779d
|
|
@ -1485,26 +1485,34 @@ object Defaults extends BuildCommon {
|
|||
if (stamps.isEmpty) Long.MinValue
|
||||
else stamps.max
|
||||
}
|
||||
def intlStamp(c: String, analysis: Analysis, s: Set[String]): Long = {
|
||||
if (s contains c) Long.MinValue
|
||||
def intlStamp0(javaClassName: String, analysis: Analysis, alreadySeen: Set[String])(
|
||||
className: String
|
||||
): Set[Long] = {
|
||||
import analysis.{ apis, relations }
|
||||
relations
|
||||
.internalClassDeps(className)
|
||||
.map(intlStamp(_, analysis, alreadySeen + javaClassName)) ++
|
||||
relations.externalDeps(className).map(stamp) ++
|
||||
apis.internal.get(javaClassName).toSeq.map(_.compilationTimestamp) ++
|
||||
apis.internal.get(className).toSeq.map(_.compilationTimestamp)
|
||||
}
|
||||
def intlStamp(javaClassName: String, analysis: Analysis, alreadySeen: Set[String]): Long =
|
||||
if (alreadySeen contains javaClassName) Long.MinValue
|
||||
else
|
||||
stamps.getOrElse(
|
||||
c, {
|
||||
val x = {
|
||||
import analysis.{ apis, relations => rel }
|
||||
rel.internalClassDeps(c).map(intlStamp(_, analysis, s + c)) ++
|
||||
rel.externalDeps(c).map(stamp) ++
|
||||
rel.productClassName.reverse(c).flatMap { pc =>
|
||||
apis.internal.get(pc).map(_.compilationTimestamp)
|
||||
} + Long.MinValue
|
||||
javaClassName, {
|
||||
val x: Long = {
|
||||
val classNames = analysis.relations.productClassName.reverse(javaClassName).toSeq
|
||||
classNames.flatMap(intlStamp0(javaClassName, analysis, alreadySeen)) ++ Seq(
|
||||
Long.MinValue
|
||||
)
|
||||
}.max
|
||||
if (x != Long.MinValue) {
|
||||
stamps(c) = x
|
||||
stamps(javaClassName) = x
|
||||
}
|
||||
x
|
||||
}
|
||||
)
|
||||
}
|
||||
def noSuccessYet(test: String) = succeeded.get(test) match {
|
||||
case None => true
|
||||
case Some(ts) => stamps.synchronized(stamp(test)) > ts
|
||||
|
|
|
|||
|
|
@ -0,0 +1,3 @@
|
|||
scalaVersion := "3.6.4"
|
||||
libraryDependencies += "com.eed3si9n.verify" %% "verify" % "1.0.0" % Test
|
||||
testFrameworks += new TestFramework("verify.runner.Framework")
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
package example
|
||||
|
||||
object B:
|
||||
def bbb: String = "3"
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
package example
|
||||
|
||||
object A:
|
||||
def aaa: String = B.bbb
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
package example
|
||||
|
||||
object B:
|
||||
def bbb: String = "2"
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
package example
|
||||
|
||||
object ATest extends verify.BasicTestSuite:
|
||||
test("aaa ") {
|
||||
assert(A.aaa == "2")
|
||||
}
|
||||
end ATest
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
> debug
|
||||
> testQuick
|
||||
$ sleep 2000
|
||||
$ copy-file changes/B.scala src/main/scala/example/B.scala
|
||||
|
||||
-> testQuick
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
// Global / cacheStores := Seq.empty
|
||||
|
||||
val scalatest = "org.scalatest" %% "scalatest" % "3.0.5"
|
||||
scalaVersion := "2.12.20"
|
||||
|
||||
lazy val root = (project in file("."))
|
||||
.settings(
|
||||
libraryDependencies += scalatest % Test,
|
||||
Test / parallelExecution := false
|
||||
)
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
> testQuick
|
||||
|
||||
# https://github.com/sbt/sbt/issues/5504
|
||||
$ copy-file changed/MathFunction.scala src/test/scala/MathFunction.scala
|
||||
> compile
|
||||
$ sleep 2000
|
||||
> debug
|
||||
-> testQuick MathFunctionTest
|
||||
|
|
@ -27,14 +27,8 @@ $ sleep 2000
|
|||
# src/test compilation group change.
|
||||
|
||||
$ copy-file changed/Base.scala src/test/scala/Base.scala
|
||||
> test:compile
|
||||
> Test/compile
|
||||
$ sleep 2000
|
||||
-> testQuick Create
|
||||
> testQuick Delete
|
||||
> testQuick Create
|
||||
|
||||
# https://github.com/sbt/sbt/issues/5504
|
||||
$ copy-file changed/MathFunction.scala src/test/scala/MathFunction.scala
|
||||
> compile
|
||||
$ sleep 2000
|
||||
-> testQuick MathFunctionTest
|
||||
Loading…
Reference in New Issue