incremental tests, misc fixes

This commit is contained in:
Mark Harrah 2011-02-26 20:34:18 -05:00
parent a68e4c74f9
commit 83866ffb42
46 changed files with 35 additions and 147 deletions

View File

@ -11,7 +11,7 @@ import java.io.File
object Incremental
{
def println(s: String) = if(java.lang.Boolean.getBoolean("xsbt.inc.debug")) System.out.println(s) else ()
def println(s: => String) = if(java.lang.Boolean.getBoolean("xsbt.inc.debug")) System.out.println(s) else ()
def compile(sources: Set[File], entry: String => Option[File], previous: Analysis, current: ReadStamps, forEntry: File => Option[Analysis], doCompile: Set[File] => Analysis)(implicit equivS: Equiv[Stamp]): (Boolean, Analysis) =
{
val initialChanges = changedInitial(entry, sources, previous, current, forEntry)

View File

@ -220,7 +220,7 @@ object BuiltinCommands
val extracted = Project extract s
import extracted._
val result = session.currentEval().eval(arg, srcName = "<eval>", imports = autoImports(extracted))
log.info("ans: " + result.tpe + " = " + result.value.toString)
log.info("ans: " + result.tpe + " = " + result.value)
s
}
def sessionCommand = Command.make(SessionCommand, sessionBrief, SessionSettings.Help)(SessionSettings.command)

View File

@ -237,7 +237,7 @@ object SessionSettings
val project = Project.getProject(pref, structure).getOrElse(error("Invalid project reference " + pref))
val appendTo: File = BuildPaths.configurationSources(project.base).headOption.getOrElse(new File(project.base, "build.sbt"))
val baseAppend = settingStrings(settings).flatMap("" :: _ :: Nil)
val adjustedLines = if( hasTrailingBlank(IO.readLines(appendTo)) ) baseAppend else baseAppend
val adjustedLines = if(appendTo.isFile && hasTrailingBlank(IO.readLines(appendTo)) ) baseAppend else "" +: baseAppend
IO.writeLines(appendTo, adjustedLines, append = true)
}
def hasTrailingBlank(lines: Seq[String]) = lines.takeRight(1).exists(_.trim.isEmpty)

View File

@ -1,3 +0,0 @@
project.name=abstract-type
project.version=1.0
project.scratch=true

View File

@ -1,2 +0,0 @@
project.name=test
project.version=1.0

View File

@ -1,3 +0,0 @@
project.name=by-name
project.version=1.0
project.scratch=true

View File

@ -0,0 +1,4 @@
TaskKey("output-empty") <<= ClassDirectory in Configurations.Compile map { outputDirectory =>
def classes = (outputDirectory ** "*.class").get
if(!classes.isEmpty) error("Classes existed:\n\t" + classes.mkString("\n\t"))
}

View File

@ -1,2 +0,0 @@
project.name=Compactify Test
project.version=1.0

View File

@ -1,7 +0,0 @@
import sbt._
class CompactifyTest(info: ProjectInfo) extends DefaultProject(info)
{
def classes = (outputDirectory ** "*.class").get
lazy val outputEmpty = task { if(!classes.isEmpty) error("Classes existed:\n\t" + classes.mkString("\n\t")) }
}

View File

@ -1,3 +0,0 @@
project.name=default-params
project.version=1.0
project.scratch=true

View File

@ -1,4 +0,0 @@
#Project properties
#Tue Jan 27 07:55:42 EST 2009
project.name=Empty Source Test
project.version=1.0

View File

@ -1,3 +0,0 @@
project.name=erasure
project.version=1.0
project.scratch=true

View File

@ -1,3 +0,0 @@
project.name=no-false-error
project.version=1.0
project.scratch=true

View File

@ -1,3 +0,0 @@
project.name=implicit-params
project.version=1.0
project.scratch=true

View File

@ -0,0 +1,8 @@
Name :== "test"
TaskKey("check-same") <<= CompileTask in Configurations.Compile map { analysis =>
analysis.apis.internal foreach { case (_, api) =>
assert( xsbt.api.APIUtil.verifyTypeParameters(api) )
assert( xsbt.api.SameAPI(api, api) )
}
}

View File

@ -1,12 +0,0 @@
import sbt._
class P(info: ProjectInfo) extends DefaultProject(info)
{
override def name = "test"
lazy val checkSame = compile map { analysis =>
analysis.apis.internal foreach { case (_, api) =>
assert( xsbt.api.APIUtil.verifyTypeParameters(api) )
assert( xsbt.api.SameAPI(api, api) )
}
}
}

View File

@ -1,2 +0,0 @@
project.name=test
project.version=1.0

View File

@ -1,3 +0,0 @@
project.name=intermediate-error
project.version=1.0
project.scratch=true

View File

@ -1,2 +0,0 @@
project.name=Basic Java Dependency Test
project.version=1.0

View File

@ -1,5 +1,5 @@
# Basic test for Java dependency tracking
> set xsbt.inc.debug true
> 'eval System.setProperty("xsbt.inc.debug", "true")'
# A is a basic Java file with no dependencies. Just a basic check for Java compilation
$ copy-file changes/A.java src/main/java/a/A.java

View File

@ -1,2 +0,0 @@
project.name=Java static test
project.version=9.5.3

View File

@ -1,3 +0,0 @@
project.name=lazy-val
project.version=1.0
project.scratch=true

View File

@ -1,3 +0,0 @@
project.name=lazy-val
project.version=1.0
project.scratch=true

View File

@ -1,3 +0,0 @@
project.name=named
project.version=1.0
project.scratch=true

View File

@ -1,4 +0,0 @@
#Project properties
#Mon Feb 09 21:05:16 EST 2009
project.name=Test
project.version=1.0

View File

@ -1,3 +0,0 @@
project.name=parent-member
project.version=1.0
project.scratch=true

View File

@ -1,3 +0,0 @@
project.name=parent-member-change
project.version=1.0
project.scratch=true

View File

@ -1,3 +0,0 @@
project.name=qualified-access
project.version=1.0
project.scratch=true

View File

@ -1,4 +0,0 @@
#Project properties
#Fri Jan 23 22:29:49 EST 2009
project.name=Test Project A
project.version=1.0

View File

@ -1,4 +0,0 @@
#Project properties
#Sat Jan 24 19:12:23 EST 2009
project.name=Remove Test B
project.version=1.0

View File

@ -1,3 +0,0 @@
project.name=repeated-parameters
project.version=1.0
project.scratch=true

View File

@ -0,0 +1,19 @@
import sbt._
import Keys._
import java.net.URLClassLoader
object B extends Build
{
lazy val projects = Seq(root)
lazy val root = Project("root", file(".")) settings( ss : _*)
def ss = Seq(
TaskKey("check-first") <<= checkTask("First"),
TaskKey("check-second") <<= checkTask("Second")
)
private def checkTask(className: String) =
FullClasspath in Configurations.Runtime map { runClasspath =>
val cp = runClasspath.map(_.data.toURI.toURL).toArray
Class.forName(className, false, new URLClassLoader(cp))
}
}

View File

@ -1,2 +0,0 @@
project.name=Test
project.version=1.0

View File

@ -1,12 +0,0 @@
import sbt._
import java.net.URLClassLoader
class TestProject(info: ProjectInfo) extends DefaultProject(info)
{
lazy val checkFirst = checkTask("First")
lazy val checkSecond = checkTask("Second")
private def checkTask(className: String) =
fullClasspath(Configurations.Runtime) map { runClasspath =>
val cp = runClasspath.map(_.data.toURI.toURL).toArray
Class.forName(className, false, new URLClassLoader(cp))
}
}

View File

@ -1,3 +0,0 @@
project.name=sealed
project.version=1.0
project.scratch=true

View File

@ -1,3 +0,0 @@
project.name=specialized
project.version=1.0
project.scratch=true

View File

@ -1,7 +0,0 @@
import sbt._
class SpecializeTest(info: ProjectInfo) extends DefaultProject(info)
{
// now on by default in 2.8
// override def compileOptions = super.compileOptions ++ Seq(CompileOption("-Yspecialize"))
}

View File

@ -1,3 +0,0 @@
project.name=stability
project.version=1.0
project.scratch=true

View File

@ -1,3 +0,0 @@
project.name=struct-usage
project.version=1.0
project.scratch=true

View File

@ -1,3 +0,0 @@
project.name=struct
project.version=1.0
project.scratch=true

View File

@ -1,4 +0,0 @@
#Project properties
#Mon Jan 26 19:13:08 EST 2009
project.name=Transitive A
project.version=1.0

View File

@ -1,4 +0,0 @@
#Project properties
#Mon Jan 26 19:13:08 EST 2009
project.name=Transitive A
project.version=1.0

View File

@ -1,3 +0,0 @@
project.name=type-parameter
project.version=1.0
project.scratch=true

View File

@ -1,3 +0,0 @@
project.name=typeref-return
project.version=1.0
project.scratch=true

View File

@ -1,3 +0,0 @@
project.name=var
project.version=1.0
project.scratch=true

View File

@ -1,3 +0,0 @@
project.name=variance
project.version=1.0
project.scratch=true