Old incremental compiler is no more

This commit is contained in:
Eugene Yokota 2016-05-05 23:37:31 -04:00
parent 8e7ab49594
commit e3560e4ed6
27 changed files with 0 additions and 190 deletions

View File

@ -1,4 +0,0 @@
// T is a type constructor [x]C
// C extends D
// E verifies the core type gets pulled out
trait A extends B.T[Int] with (E[Int] @unchecked)

View File

@ -1,19 +0,0 @@
object B {
type T[x] = C
}
class B {
// not public, so this shouldn't be tracked as an inherited dependency
private[this] class X extends D with E[Int]
def x(i: Int): Unit = {
// not public, not an inherited dependency
trait Y extends D
}
def y(j: Int): Unit = {
// not public
val w: D { def length: Int } = ???
()
}
}

View File

@ -1 +0,0 @@
trait C extends D

View File

@ -1 +0,0 @@
trait D extends G.P

View File

@ -1,3 +0,0 @@
class F {
def q: C { def length: Int } = ???
}

View File

@ -1 +0,0 @@
object G { trait P extends J }

View File

@ -1,36 +0,0 @@
// this test is specific to the old incremental compilation algorithm
incOptions := incOptions.value.withNameHashing(false)
lazy val verifyDeps = taskKey[Unit]("verify inherited dependencies are properly extracted")
verifyDeps := {
val a = compile.in(Compile).value match { case a: Analysis => a }
val baseDir = baseDirectory.value
def relative(f: java.io.File): java.io.File = f.relativeTo(baseDir) getOrElse f
def toFile(s: String) = relative(baseDir / (s + ".scala"))
def inheritedDeps(name: String): Set[File] = {
val file = (baseDir / (name + ".scala")).getAbsoluteFile
val absoluteFiles = a.relations.publicInherited.internal.forward(file)
absoluteFiles.map(relative)
}
val ADeps = Set("C", "D", "E", "G", "J").map(toFile)
same(inheritedDeps("A"), ADeps)
val BDeps = Set.empty[File]
same(inheritedDeps("B"), BDeps)
val CDeps = Set("D", "G", "J").map(toFile)
same(inheritedDeps("C"), CDeps)
val DDeps = Set("G", "J").map(toFile)
same(inheritedDeps("D"), DDeps)
val EDeps = Set.empty[File]
same(inheritedDeps("E"), EDeps)
val FDeps = Set("C", "D", "G", "J").map(toFile)
same(inheritedDeps("F"), FDeps)
val GDeps = Set("J").map(toFile)
same(inheritedDeps("G"), GDeps)
val JDeps = Set.empty[File]
same(inheritedDeps("J"), JDeps)
}
def same[T](x: T, y: T): Unit = {
assert(x == y, s"\nActual: $x, \nExpected: $y")
}

View File

@ -1 +0,0 @@
class A implements B.T<Integer>, E {}

View File

@ -1,11 +0,0 @@
public class B {
static interface T<X> extends C {}
// not public, so this shouldn't be tracked as an inherited dependency
private class Q implements E<Integer> {}
public void x(int i) {
// not public, not an inherited dependency
D j = new D() {};
}
}

View File

@ -1 +0,0 @@
interface C extends D {}

View File

@ -1 +0,0 @@
interface D extends G.P {}

View File

@ -1 +0,0 @@
public interface E<T> {}

View File

@ -1,3 +0,0 @@
public class F {
public C q() { return null; }
}

View File

@ -1,3 +0,0 @@
public class G {
static interface P extends J {}
}

View File

@ -1 +0,0 @@
public interface J {}

View File

@ -1,30 +0,0 @@
// this test is specific to the old incremental compilation algorithm
incOptions := incOptions.value.withNameHashing(false)
lazy val verifyDeps = taskKey[Unit]("verify inherited dependencies are properly extracted")
verifyDeps := {
val a = compile.in(Compile).value match { case a: Analysis => a }
same(a.relations.publicInherited.internal.forwardMap, expectedDeps.forwardMap)
}
lazy val expected = Seq(
"A" -> Seq("C", "D", "E", "G", "J"),
"B" -> Seq("C", "D", "G", "J"),
"C" -> Seq("D", "G", "J"),
"D" -> Seq("G", "J"),
"E" -> Seq(),
"F" -> Seq(),
"G" -> Seq("J"),
"J" -> Seq()
)
lazy val pairs =
expected.map { case (from,tos) =>
(toFile(from), tos.map(toFile))
}
lazy val expectedDeps = (Relation.empty[File,File] /: pairs) { case (r, (x,ys)) => r + (x,ys) }
def toFile(s: String) = file(s + ".java").getAbsoluteFile
def same[T](x: T, y: T): Unit = {
assert(x == y, s"\nActual: $x, \nExpected: $y")
}

View File

@ -1 +0,0 @@
> verifyDeps

View File

@ -1,22 +0,0 @@
val defaultSettings = Seq(
scalaVersion := "2.10.6",
libraryDependencies <+= scalaVersion("org.scala-lang" % "scala-reflect" % _ )//,
//incOptions := incOptions.value.withNameHashing(true)
)
lazy val root = (project in file(".")).
aggregate(macroProvider, macroClient).
settings(
defaultSettings
)
lazy val macroProvider = (project in file("macro-provider")).
settings(
defaultSettings
)
lazy val macroClient = (project in file("macro-client")).
dependsOn(macroProvider).
settings(
defaultSettings
)

View File

@ -1,7 +0,0 @@
package macro
object Client {
object RealClient extends Provider {
// Some comment...
}
}

View File

@ -1,9 +0,0 @@
// Check that a file has not been recompiled during last compilation
InputKey[Unit]("check-not-recompiled") <<= inputTask { (argTask: TaskKey[Seq[String]]) =>
(argTask, compile in Compile) map { case (args: Seq[String], a: Analysis) =>
assert(args.size == 1)
val fileCompilation = a.apis.internal.collect { case (file, src) if file.name.endsWith(args(0)) => src.compilation }.head
val lastCompilation = a.compilations.allCompilations.last
assert(fileCompilation.startTime != lastCompilation.startTime, "File has been recompiled during last compilation.")
}
}

View File

@ -1,7 +0,0 @@
package macro
object Client {
object RealClient extends Provider {
}
}

View File

@ -1,5 +0,0 @@
package macro
object Foo {
val c = Client.RealClient
}

View File

@ -1,7 +0,0 @@
package macro
import scala.language.experimental.macros
import scala.reflect.macros._
abstract class Provider {
def notImplementedMacro = macro ???
}

View File

@ -1,12 +0,0 @@
> macroProvider/compile
> macroClient/compile
# Introduce a comment in Client, which inherits a macro from Provider
$ copy-file changes/Client.scala macro-client/src/main/scala/Client.scala
> macroClient/compile
# Object Foo depends on Client via composition, thus a whitespace change to
# Client shouldn't trigger its recompilation
> check-not-recompiled Foo.scala