mirror of https://github.com/sbt/sbt.git
fix scripted tests
This commit is contained in:
parent
769ecbace5
commit
a3047acc20
|
|
@ -5,20 +5,23 @@ object ExcludeScala extends Build
|
|||
{
|
||||
lazy val root = Project("root", file(".")) settings(
|
||||
libraryDependencies <++= baseDirectory(dependencies),
|
||||
scalaVersion := "2.8.1",
|
||||
scalaVersion := "2.9.2",
|
||||
autoScalaLibrary <<= baseDirectory(base => !(base / "noscala").exists ),
|
||||
scalaOverride <<= fullClasspath in Compile map { cp =>
|
||||
val existing = cp.files.filter(_.getName contains "scala-library")
|
||||
val loader = classpath.ClasspathUtilities.toLoader(existing)
|
||||
// check that the 2.8.1 scala-library is on the classpath and not 2.7.7
|
||||
Class.forName("scala.collection.immutable.List", false, loader)
|
||||
}
|
||||
scalaOverride <<= check("scala.App")
|
||||
)
|
||||
lazy val scalaOverride = TaskKey[Unit]("scala-override")
|
||||
def check(className: String): Def.Initialize[Task[Unit]] = fullClasspath in Compile map { cp =>
|
||||
val existing = cp.files.filter(_.getName contains "scala-library")
|
||||
println("Full classpath: " + cp.mkString("\n\t", "\n\t", ""))
|
||||
println("scala-library.jar: " + existing.mkString("\n\t", "\n\t", ""))
|
||||
val loader = classpath.ClasspathUtilities.toLoader(existing)
|
||||
Class.forName(className, false, loader)
|
||||
}
|
||||
|
||||
lazy val scalaOverride = taskKey[Unit]("Check that the proper version of Scala is on the classpath.")
|
||||
|
||||
def dependencies(base: File) =
|
||||
if( ( base / "sbinary").exists )
|
||||
("org.scala-tools.sbinary" % "sbinary_2.7.7" % "0.3") :: Nil
|
||||
if( ( base / "stm").exists )
|
||||
("org.scala-tools" % "scala-stm_2.8.2" % "0.6") :: Nil
|
||||
else
|
||||
Nil
|
||||
}
|
||||
|
|
@ -1,2 +0,0 @@
|
|||
project.name=Test
|
||||
project.version=1.0
|
||||
|
|
@ -1,15 +0,0 @@
|
|||
import sbt._
|
||||
|
||||
class ExcludeScala(info: ProjectInfo) extends DefaultProject(info)
|
||||
{
|
||||
lazy val noScala = task { checkNoScala }
|
||||
|
||||
def checkNoScala =
|
||||
{
|
||||
val existing = compileClasspath.filter(isScalaLibrary _).get
|
||||
if(existing.isEmpty) None else Some("Scala library was incorrectly retrieved: " + existing)
|
||||
}
|
||||
def isScalaLibrary(p: Path) = p.name contains "scala-library"
|
||||
|
||||
val sbinary = "org.scala-tools.sbinary" % "sbinary_2.7.7" % "0.3"
|
||||
}
|
||||
|
|
@ -1,13 +1,13 @@
|
|||
> scala-override
|
||||
> scalaOverride
|
||||
|
||||
$ touch sbinary
|
||||
$ touch stm
|
||||
> reload
|
||||
> scala-override
|
||||
> scalaOverride
|
||||
|
||||
$ touch noscala
|
||||
> reload
|
||||
> scala-override
|
||||
> scalaOverride
|
||||
|
||||
$ delete sbinary
|
||||
$ delete stm
|
||||
> reload
|
||||
-> scala-override
|
||||
-> scalaOverride
|
||||
|
|
@ -7,7 +7,7 @@ object InfoTest extends Build
|
|||
lazy val root = Project("root", file(".")) settings(
|
||||
ivyPaths <<= (baseDirectory, target)( (dir, t) => new IvyPaths(dir, Some(t / "ivy-cache"))),
|
||||
ivyXML <<= (customInfo, organization, moduleName, version) apply inlineXML,
|
||||
scalaVersion := "2.9.0",
|
||||
scalaVersion := "2.9.1",
|
||||
projectID ~= (_ cross false),
|
||||
customInfo <<= baseDirectory{_ / "info" exists },
|
||||
TaskKey[Unit]("check-download") <<= checkDownload,
|
||||
|
|
@ -25,9 +25,9 @@ object InfoTest extends Build
|
|||
ScalaQuery is a type-safe database query API for Scala.
|
||||
</description>
|
||||
</info>
|
||||
<dependency org="org.scala-tools.testing" name="scalacheck_2.9.0" rev="1.9"/>)
|
||||
<dependency org="org.scala-tools.testing" name="scalacheck_2.9.1" rev="1.9"/>)
|
||||
else
|
||||
<dependency org="org.scala-tools.testing" name="scalacheck_2.9.0" rev="1.9"/>
|
||||
<dependency org="org.scala-tools.testing" name="scalacheck_2.9.1" rev="1.9"/>
|
||||
|
||||
def checkDownload = (dependencyClasspath in Compile) map { cp => if(cp.isEmpty) error("Dependency not downloaded"); () }
|
||||
def checkInfo = (customInfo, delivered) map { (addInfo, d) =>
|
||||
|
|
|
|||
|
|
@ -3,10 +3,12 @@
|
|||
|
||||
object TestProject extends Build
|
||||
{
|
||||
override lazy val settings = super.settings :+
|
||||
(externalResolvers := Nil) :+
|
||||
(autoScalaLibrary := false) :+
|
||||
( ivyPaths <<= baseDirectory( dir => new IvyPaths(dir, Some(dir / "ivy-home"))) )
|
||||
override lazy val settings = super.settings ++ Seq(
|
||||
externalResolvers := Nil,
|
||||
autoScalaLibrary := false,
|
||||
ivyScala := None,
|
||||
ivyPaths <<= baseDirectory( dir => new IvyPaths(dir, Some(dir / "ivy-home")))
|
||||
)
|
||||
|
||||
lazy val root = Project("root", file(".")) aggregate(a, b)
|
||||
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ object B extends Build
|
|||
)
|
||||
lazy val baseSettings = Seq(
|
||||
autoScalaLibrary := false,
|
||||
ivyScala := None,
|
||||
unmanagedJars in Compile <++= scalaInstance map (_.jars),
|
||||
publishArtifact in packageSrc := false,
|
||||
publishArtifact in packageDoc := false,
|
||||
|
|
|
|||
|
|
@ -7,4 +7,4 @@
|
|||
<artifact pattern="${ivy.settings.dir}/../repo/[organisation]/[module]/[revision]/[type]s/[artifact].[ext]"/>
|
||||
</filesystem>
|
||||
</resolvers>
|
||||
</ivysettings>
|
||||
</ivysettings>
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
> check test scalatest scala-library.jar servlet-api
|
||||
> check test scalatest scala-library servlet-api
|
||||
> check runtime scala-library
|
||||
> check compile scala-library servlet-api
|
||||
|
|
@ -6,6 +6,7 @@ object Test extends Build
|
|||
lazy val root = Project("root", file(".")) settings(
|
||||
libraryDependencies += "net.liftweb" % "lift-webkit" % "1.0" intransitive(),
|
||||
libraryDependencies += "org.scalacheck" % "scalacheck" % "1.5" intransitive(),
|
||||
autoScalaLibrary := false,
|
||||
transitiveClassifiers := Seq("sources"),
|
||||
TaskKey[Unit]("check-sources") <<= updateClassifiers map checkSources,
|
||||
TaskKey[Unit]("check-binaries") <<= update map checkBinaries
|
||||
|
|
@ -16,7 +17,7 @@ object Test extends Build
|
|||
val srcs = getSources(report)
|
||||
if(srcs.isEmpty)
|
||||
error("No sources retrieved")
|
||||
else if(srcs.size != 3)
|
||||
else if(srcs.size != 2)
|
||||
error("Incorrect sources retrieved:\n\t" + srcs.mkString("\n\t"))
|
||||
else
|
||||
()
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
resolvers += Resolver.url("sbt-plugin-snapshots", url("http://scalasbt.artifactoryonline.com/scalasbt/sbt-plugin-snapshots/"))(Resolver.ivyStylePatterns)
|
||||
resolvers += Resolver.url("sbt-plugin-snapshots", url("http://scalasbt.artifactoryonline.com/scalasbt/sbt-plugin-releases/"))(Resolver.ivyStylePatterns)
|
||||
|
||||
addSbtPlugin("com.eed3si9n" % "sbt-twt" % "0.2.1", sbtVersion = "0.12")
|
||||
addSbtPlugin("com.eed3si9n" % "sbt-twt" % "0.2.1", sbtVersion = "0.12", scalaVersion = "2.9.2")
|
||||
Loading…
Reference in New Issue