mirror of https://github.com/sbt/sbt.git
Update scripted tests
This commit is contained in:
parent
c903e7ca28
commit
2c02285778
|
|
@ -7,6 +7,8 @@ Migration notes
|
|||
- `sbt.Plugin` is also gone. Use auto plugins.
|
||||
- The incremental compiler, called Zinc, uses class-based name hashing.
|
||||
- Zinc drops support for Scala 2.8.x and 2.9.x.
|
||||
- Removed the pre-0.13.7 *.sbt file parser (previously available under `-Dsbt.parser.simple=true`)
|
||||
- Removed old, hypher-separated key names (use `publishLocal` instead of `publish-local`)
|
||||
|
||||
#### Additional import required
|
||||
|
||||
|
|
|
|||
|
|
@ -2,24 +2,24 @@
|
|||
|
||||
lazy val root = (project in file(".")).
|
||||
settings(
|
||||
a <<= baseDirectory map (b => if( (b / "succeed").exists) () else sys.error("fail")),
|
||||
b <<= a.task(at => nop dependsOn(at) ),
|
||||
a <<= baseDirectory map (b => if ((b / "succeed").exists) () else sys.error("fail")),
|
||||
b <<= a.task(at => nop dependsOn(at)),
|
||||
c <<= a map { _ => () },
|
||||
d <<= a flatMap { _ => task { () } }
|
||||
)
|
||||
lazy val a = TaskKey[Unit]("a")
|
||||
lazy val b = TaskKey[Unit]("b")
|
||||
lazy val c = TaskKey[Unit]("c")
|
||||
lazy val d = TaskKey[Unit]("d")
|
||||
lazy val a = taskKey[Unit]("")
|
||||
lazy val b = taskKey[Unit]("")
|
||||
lazy val c = taskKey[Unit]("")
|
||||
lazy val d = taskKey[Unit]("")
|
||||
|
||||
lazy val input = (project in file("input")).
|
||||
settings(
|
||||
f <<= inputTask { _ map { args => if(args(0) == "succeed") () else sys.error("fail") } },
|
||||
f <<= inputTask { _ map { args => if (args(0) == "succeed") () else sys.error("fail") } },
|
||||
j := sys.error("j"),
|
||||
g <<= f dependsOn(j),
|
||||
h <<= f map { _ => IO.touch(file("h")) }
|
||||
)
|
||||
lazy val f = InputKey[Unit]("f")
|
||||
lazy val g = InputKey[Unit]("g")
|
||||
lazy val h = InputKey[Unit]("h")
|
||||
lazy val j = TaskKey[Unit]("j")
|
||||
lazy val f = inputKey[Unit]("")
|
||||
lazy val g = inputKey[Unit]("")
|
||||
lazy val h = inputKey[Unit]("")
|
||||
lazy val j = taskKey[Unit]("")
|
||||
|
|
|
|||
|
|
@ -6,8 +6,8 @@ lazy val root = (project in file(".")).
|
|||
myIn
|
||||
)
|
||||
|
||||
lazy val demoIn = InputKey[Unit]("demo-in", "Demo run input task", demo)
|
||||
lazy val demo = TaskKey[Unit]("demo", "Demo run task")
|
||||
lazy val demoIn = InputKey[Unit]("demoIn", "Demo run input task", demo)
|
||||
lazy val demo = taskKey[Unit]("Demo run task")
|
||||
|
||||
def myRun = fullRunTask( demo, Compile, "A", "1", "1")
|
||||
def myIn = fullRunInputTask( demoIn, Compile, "A", "1")
|
||||
def myRun = fullRunTask(demo, Compile, "A", "1", "1")
|
||||
def myIn = fullRunInputTask(demoIn, Compile, "A", "1")
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
> demo
|
||||
-> demo 1
|
||||
> demo-in 1
|
||||
-> demo-in 2
|
||||
> demo-in 1 2
|
||||
> demoIn 1
|
||||
-> demoIn 2
|
||||
> demoIn 1 2
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
> helloWorldTest
|
||||
> buildSbtTest
|
||||
> evil-clear-logger
|
||||
> set version := { sLog.value.info("yo"); version.value }
|
||||
> evilClearLogger
|
||||
> set version := { sLog.value.info("yo"); version.value }
|
||||
|
|
|
|||
|
|
@ -3,13 +3,13 @@ import complete.DefaultParsers._
|
|||
import sbinary.DefaultProtocol._
|
||||
import Def.Initialize
|
||||
|
||||
val keep = TaskKey[Int]("keep")
|
||||
val persisted = TaskKey[Int]("persist")
|
||||
val checkKeep = InputKey[Unit]("check-keep")
|
||||
val checkPersisted = InputKey[Unit]("check-persist")
|
||||
val keep = taskKey[Int]("")
|
||||
val persist = taskKey[Int]("")
|
||||
val checkKeep = inputKey[Unit]("")
|
||||
val checkPersist = inputKey[Unit]("")
|
||||
|
||||
val updateDemo = TaskKey[Int]("demo")
|
||||
val check = InputKey[Unit]("check")
|
||||
val updateDemo = taskKey[Int]("")
|
||||
val check = inputKey[Unit]("")
|
||||
val sample = AttributeKey[Int]("demo-key")
|
||||
|
||||
def updateDemoInit = state map { s => (s get sample getOrElse 9) + 1 }
|
||||
|
|
@ -34,11 +34,11 @@ def checkInit: Initialize[InputTask[Unit]] = InputTask( (_: State) => token(Spac
|
|||
}
|
||||
}
|
||||
|
||||
def inMemorySetting = keep <<= getPrevious(keep) map { case None => 3; case Some(x) => x + 1} keepAs(keep)
|
||||
def persistedSetting = persisted <<= loadPrevious(persisted) map { case None => 17; case Some(x) => x + 1} storeAs(persisted)
|
||||
def inMemorySetting = keep <<= getPrevious(keep) map { case None => 3; case Some(x) => x + 1} keepAs(keep)
|
||||
def persistedSetting = persist <<= loadPrevious(persist) map { case None => 17; case Some(x) => x + 1} storeAs(persist)
|
||||
|
||||
def inMemoryCheck = checkKeep <<= inputCheck( (ctx, s) => Space ~> str(getFromContext(keep, ctx, s)) )
|
||||
def persistedCheck = checkPersisted <<= inputCheck( (ctx, s) => Space ~> str(loadFromContext(persisted, ctx, s)) )
|
||||
def inMemoryCheck = checkKeep <<= inputCheck( (ctx, s) => Space ~> str( getFromContext( keep, ctx, s)) )
|
||||
def persistedCheck = checkPersist <<= inputCheck( (ctx, s) => Space ~> str(loadFromContext(persist, ctx, s)) )
|
||||
|
||||
def inputCheck[T](f: (ScopedKey[_], State) => Parser[T]): Initialize[InputTask[Unit]] =
|
||||
InputTask( resolvedScoped(ctx => (s: State) => f(ctx, s)) )( dummyTask )
|
||||
|
|
|
|||
|
|
@ -5,35 +5,35 @@
|
|||
> check 16 15
|
||||
|
||||
|
||||
-> check-keep 3
|
||||
> check-keep blue
|
||||
-> checkKeep 3
|
||||
> checkKeep blue
|
||||
|
||||
> keep
|
||||
> check-keep 3
|
||||
-> check-keep 4
|
||||
> check-keep 3
|
||||
> checkKeep 3
|
||||
-> checkKeep 4
|
||||
> checkKeep 3
|
||||
|
||||
> keep
|
||||
-> check-keep 3
|
||||
> check-keep 4
|
||||
> check-keep 4
|
||||
-> checkKeep 3
|
||||
> checkKeep 4
|
||||
> checkKeep 4
|
||||
|
||||
> reload
|
||||
> check-keep blue
|
||||
> checkKeep blue
|
||||
> keep
|
||||
> check-keep 3
|
||||
> checkKeep 3
|
||||
|
||||
|
||||
-> check-persist 17
|
||||
> check-persist blue
|
||||
-> checkPersist 17
|
||||
> checkPersist blue
|
||||
|
||||
> persist
|
||||
> check-persist 17
|
||||
-> check-persist blue
|
||||
> checkPersist 17
|
||||
-> checkPersist blue
|
||||
|
||||
> persist
|
||||
> check-persist 18
|
||||
> checkPersist 18
|
||||
> reload
|
||||
> check-persist 18
|
||||
> checkPersist 18
|
||||
> persist
|
||||
> check-persist 19
|
||||
> checkPersist 19
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
lazy val akey = AttributeKey[Int]("TestKey")
|
||||
lazy val t = TaskKey[String]("test-task")
|
||||
lazy val check = InputKey[Unit]("check")
|
||||
lazy val testTask = taskKey[String]("")
|
||||
lazy val check = inputKey[Unit]("")
|
||||
|
||||
lazy val root = (project in file(".")).
|
||||
aggregate(a, b).
|
||||
|
|
@ -10,12 +10,12 @@ lazy val root = (project in file(".")).
|
|||
|
||||
lazy val a = project.
|
||||
settings(
|
||||
t := sys.error("Failing")
|
||||
testTask := sys.error("Failing")
|
||||
)
|
||||
|
||||
lazy val b = project.
|
||||
settings(
|
||||
t <<= Def.task("").updateState(updater)
|
||||
testTask <<= Def.task("").updateState(updater)
|
||||
)
|
||||
|
||||
def checkState(runs: Int, s: State): Unit = {
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
> check 0
|
||||
-> test-task
|
||||
-> testTask
|
||||
> check 1
|
||||
-> test-task
|
||||
-> testTask
|
||||
> check 2
|
||||
> b/test-task
|
||||
> b/testTask
|
||||
> check 3
|
||||
-> a/testTask
|
||||
> check 3
|
||||
-> a/test-task
|
||||
> check 3
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
# test case for http://github.com/sbt/sbt/issues/676
|
||||
> compile
|
||||
# fails with StackOverflowException
|
||||
> show-apis
|
||||
> showApis
|
||||
|
|
|
|||
|
|
@ -9,4 +9,4 @@ $ copy-file changes/Foo1.scala src/main/scala/Foo.scala
|
|||
# second iteration
|
||||
> compile
|
||||
# check if there are only two compile iterations being performed
|
||||
> check-number-of-compiler-iterations 2
|
||||
> checkNumberOfCompilerIterations 2
|
||||
|
|
|
|||
|
|
@ -4,4 +4,4 @@
|
|||
> compile
|
||||
# verifies that there's no dependency on a class file corresponding
|
||||
# to a package
|
||||
> verify-binary-deps
|
||||
> verifyBinaryDeps
|
||||
|
|
|
|||
|
|
@ -9,4 +9,4 @@ $ copy-file changes/B1.scala src/main/scala/B.scala
|
|||
# second iteration
|
||||
> compile
|
||||
# check if there are only two compile iterations being performed
|
||||
> check-number-of-compiler-iterations 2
|
||||
> checkNumberOfCompilerIterations 2
|
||||
|
|
|
|||
|
|
@ -11,4 +11,4 @@ $ copy-file changes/Impl1.scala src/main/scala/Impl.scala
|
|||
# second iteration
|
||||
> compile
|
||||
# check if there are only two compile iterations performed
|
||||
> check-number-of-compiler-iterations 2
|
||||
> checkNumberOfCompilerIterations 2
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import sbt.internal.inc.classpath.ClasspathUtilities
|
||||
|
||||
lazy val checkFull = TaskKey[Unit]("check-full")
|
||||
lazy val check = TaskKey[Unit]("check")
|
||||
lazy val checkFull = taskKey[Unit]("")
|
||||
lazy val check = taskKey[Unit]("")
|
||||
|
||||
lazy val root = (project in file(".")).
|
||||
settings(
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
-> check
|
||||
|
||||
# verify that check-full succeeds
|
||||
> check-full
|
||||
> checkFull
|
||||
|
||||
# publish test jar to test repository
|
||||
> publish
|
||||
|
|
@ -16,4 +16,4 @@ $ touch retrieve
|
|||
> reload
|
||||
|
||||
# verify that artifact with extension, type, and classifier can be retreieved
|
||||
> check
|
||||
> check
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
$ copy-file changes/def.sbt build.sbt
|
||||
$ copy-file changes/resolver.sbt resolver.sbt
|
||||
> reload
|
||||
> publish-local
|
||||
> publishLocal
|
||||
> publish
|
||||
|
||||
$ delete build.sbt
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
$ copy-file changes/def/build.sbt build.sbt
|
||||
$ copy-file changes/def/Def.java b/Def.java
|
||||
> reload
|
||||
> publish-local
|
||||
> publishLocal
|
||||
> clean
|
||||
|
||||
|
||||
|
|
@ -27,7 +27,7 @@ $ delete build.sbt
|
|||
$ copy-file changes/both/build.sbt build.sbt
|
||||
$ copy-file changes/def/Def.java b/Def.java
|
||||
> reload
|
||||
> publish-local
|
||||
> publishLocal
|
||||
> clean
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
> a/publish-local
|
||||
> a/publishLocal
|
||||
> b/update
|
||||
# verify that A's artifact was published and available for B to compile/run against
|
||||
> b/run
|
||||
> b/run
|
||||
|
|
|
|||
|
|
@ -2,8 +2,8 @@ lazy val root = (project in file(".")).
|
|||
settings(
|
||||
ivyPaths <<= (baseDirectory, target)( (dir, t) => new IvyPaths(dir, Some(t / "ivy-cache"))),
|
||||
libraryDependencies <+= baseDirectory(transitive("javax.mail" % "mail" % "1.4.1")),
|
||||
TaskKey[Unit]("check-transitive") <<= check(true),
|
||||
TaskKey[Unit]("check-intransitive") <<= check(false)
|
||||
TaskKey[Unit]("checkTransitive") <<= check(true),
|
||||
TaskKey[Unit]("checkIntransitive") <<= check(false)
|
||||
)
|
||||
|
||||
def transitive(dep: ModuleID)(base: File) =
|
||||
|
|
|
|||
|
|
@ -8,8 +8,8 @@ $ touch transitive
|
|||
> reload
|
||||
#$ pause
|
||||
|
||||
> check-transitive
|
||||
-> check-intransitive
|
||||
> checkTransitive
|
||||
-> checkIntransitive
|
||||
|
||||
|
||||
# load the project definition with transitive dependencies disabled
|
||||
|
|
@ -19,5 +19,5 @@ $ delete ivy-cache
|
|||
$ delete transitive
|
||||
> reload
|
||||
|
||||
-> check-transitive
|
||||
> check-intransitive
|
||||
-> checkTransitive
|
||||
> checkIntransitive
|
||||
|
|
|
|||
|
|
@ -2,8 +2,8 @@ lazy val root = (project in file(".")).
|
|||
settings(
|
||||
ivyPaths <<= (baseDirectory, target)( (dir, t) => new IvyPaths(dir, Some(t / "ivy-cache"))),
|
||||
libraryDependencies <++= baseDirectory (libraryDeps),
|
||||
TaskKey[Unit]("check-forced") <<= check("1.2.14"),
|
||||
TaskKey[Unit]("check-depend") <<= check("1.2.13")
|
||||
TaskKey[Unit]("checkForced") <<= check("1.2.14"),
|
||||
TaskKey[Unit]("checkDepend") <<= check("1.2.13")
|
||||
)
|
||||
|
||||
def libraryDeps(base: File) = {
|
||||
|
|
|
|||
|
|
@ -2,11 +2,11 @@ $ touch force
|
|||
|
||||
> reload
|
||||
|
||||
> check-forced
|
||||
-> check-depend
|
||||
> checkForced
|
||||
-> checkDepend
|
||||
|
||||
$ delete force
|
||||
> reload
|
||||
|
||||
-> check-forced
|
||||
> check-depend
|
||||
-> checkForced
|
||||
> checkDepend
|
||||
|
|
|
|||
|
|
@ -12,8 +12,8 @@ lazy val root = (project in file(".")).
|
|||
TaskKey[Unit]("check-info") <<= checkInfo
|
||||
)
|
||||
|
||||
lazy val delivered = TaskKey[NodeSeq]("delivered")
|
||||
lazy val customInfo = SettingKey[Boolean]("custom-info")
|
||||
lazy val delivered = taskKey[NodeSeq]("")
|
||||
lazy val customInfo = settingKey[Boolean]("")
|
||||
|
||||
def inlineXML(addInfo: Boolean, organization: String, moduleID: String, version: String): NodeSeq =
|
||||
if(addInfo)
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
> check-download
|
||||
> check-info
|
||||
> checkDownload
|
||||
> checkInfo
|
||||
|
||||
> clean
|
||||
$ touch info
|
||||
> reload
|
||||
|
||||
> show custom-info
|
||||
> check-download
|
||||
> show custom-info
|
||||
> check-info
|
||||
> show customInfo
|
||||
> checkDownload
|
||||
> show customInfo
|
||||
> checkInfo
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ lazy val expectedInter =
|
|||
<version>1.0</version>
|
||||
</dependency>
|
||||
|
||||
def checkTask(expectedDep: xml.Elem) = TaskKey[Unit]("check-pom") <<= makePom map { file =>
|
||||
def checkTask(expectedDep: xml.Elem) = TaskKey[Unit]("checkPom") <<= makePom map { file =>
|
||||
val pom = xml.XML.loadFile(file)
|
||||
val actual = pom \\ "dependencies"
|
||||
val expected = <d>
|
||||
|
|
|
|||
|
|
@ -1,2 +1,2 @@
|
|||
> p1/check-pom
|
||||
> p2/check-pom
|
||||
> p1/checkPom
|
||||
> p2/checkPom
|
||||
|
|
|
|||
|
|
@ -3,9 +3,9 @@ import scala.xml._
|
|||
lazy val root = (project in file(".")).
|
||||
settings(
|
||||
readPom <<= makePom map XML.loadFile,
|
||||
TaskKey[Unit]("check-pom") <<= checkPom,
|
||||
TaskKey[Unit]("check-extra") <<= checkExtra,
|
||||
TaskKey[Unit]("check-version-plus-mapping") <<= checkVersionPlusMapping,
|
||||
TaskKey[Unit]("checkPom") <<= checkPom,
|
||||
TaskKey[Unit]("checkExtra") <<= checkExtra,
|
||||
TaskKey[Unit]("checkVersionPlusMapping") <<= checkVersionPlusMapping,
|
||||
resolvers += Resolver.sonatypeRepo("snapshots"),
|
||||
makePomConfiguration ~= { _.copy(extra = <extra-tag/>) },
|
||||
libraryDependencies += "com.google.code.findbugs" % "jsr305" % "1.3.+"
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
> check-pom
|
||||
> check-extra
|
||||
> check-version-plus-mapping
|
||||
> checkPom
|
||||
> checkExtra
|
||||
> checkVersionPlusMapping
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ moduleName := "asdf"
|
|||
|
||||
crossPaths := false
|
||||
|
||||
TaskKey[Unit]("check-name") <<= (moduleName, name, packageBin in Compile) map { (module, n, f) =>
|
||||
TaskKey[Unit]("checkName") <<= (moduleName, name, packageBin in Compile) map { (module, n, f) =>
|
||||
val path = f.getAbsolutePath
|
||||
assert(path contains module, "Path " + path + " did not contain module name " + module)
|
||||
assert(!path.contains(n), "Path " + path + " contained " + n)
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
> check-name
|
||||
> checkName
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ TaskKey[Unit]("check") <<= dependencyClasspath in Compile map { cp =>
|
|||
assert(cp.size == 3, "Expected 3 jars, got: " + cp.files.mkString("(", ", ", ")"))
|
||||
}
|
||||
|
||||
TaskKey[Unit]("check-pom") <<= makePom map { file =>
|
||||
TaskKey[Unit]("checkPom") <<= makePom map { file =>
|
||||
val pom = xml.XML.loadFile(file)
|
||||
val actual = pom \\ "dependencies"
|
||||
def depSection(classifier: String) =
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
> check
|
||||
|
||||
> check-pom
|
||||
> checkPom
|
||||
|
||||
$ delete build.sbt
|
||||
$ copy-file changes/non-mergeable.sbt build.sbt
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
-> publish-local
|
||||
-> publishLocal
|
||||
|
||||
$ touch topublish.txt
|
||||
> publish-local
|
||||
> publishLocal
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
> publish-local
|
||||
> publishLocal
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ import complete.DefaultParsers._
|
|||
lazy val root = (project in file(".")).
|
||||
settings(
|
||||
resolvers ++= Seq(local, Resolver.sonatypeRepo("releases"), Resolver.sonatypeRepo("snapshots")),
|
||||
InputKey[Unit]("check-pom") <<= InputTask(_ => spaceDelimited("<args>")) { result => (makePom, result, streams) map checkPomRepositories },
|
||||
InputKey[Unit]("checkPom") <<= InputTask(_ => spaceDelimited("<args>")) { result => (makePom, result, streams) map checkPomRepositories },
|
||||
makePomConfiguration <<= (makePomConfiguration, baseDirectory) { (conf, base) =>
|
||||
conf.copy(filterRepositories = pomIncludeRepository(base, conf.filterRepositories) )
|
||||
},
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
# write the default pom. The only repositories should be Scala Tools Releases and Snapshots
|
||||
> check-pom https://oss.sonatype.org/content/repositories/releases/ https://oss.sonatype.org/content/repositories/snapshots/
|
||||
> checkPom https://oss.sonatype.org/content/repositories/releases/ https://oss.sonatype.org/content/repositories/snapshots/
|
||||
|
||||
# include file:// repositories. The generated repositories section should include the local Maven repository as well
|
||||
$ touch repo.all
|
||||
> check-pom https://oss.sonatype.org/content/repositories/releases/ https://oss.sonatype.org/content/repositories/snapshots/ file://*.m2/repository/
|
||||
> checkPom https://oss.sonatype.org/content/repositories/releases/ https://oss.sonatype.org/content/repositories/snapshots/ file://*.m2/repository/
|
||||
|
||||
# include file:// repositories. The generated repositories section should include the local Maven repository as well
|
||||
$ delete repo.all
|
||||
$ touch repo.none
|
||||
> check-pom
|
||||
> checkPom
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ lazy val custom = config("custom")
|
|||
lazy val root = (project in file(".")).
|
||||
configs(custom).
|
||||
settings(
|
||||
TaskKey[Unit]("check-pom") <<= checkPom,
|
||||
TaskKey[Unit]("checkPom") <<= checkPom,
|
||||
libraryDependencies ++= Seq(
|
||||
"a" % "a" % "1.0",
|
||||
"b" % "b" % "1.0" % "runtime,optional",
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
> check-pom
|
||||
> checkPom
|
||||
|
|
|
|||
|
|
@ -7,8 +7,8 @@ lazy val root = (project in file(".")).
|
|||
autoScalaLibrary := false,
|
||||
managedScalaInstance := false,
|
||||
transitiveClassifiers := Seq("sources"),
|
||||
TaskKey[Unit]("check-sources") <<= updateClassifiers map checkSources,
|
||||
TaskKey[Unit]("check-binaries") <<= update map checkBinaries
|
||||
TaskKey[Unit]("checkSources") <<= updateClassifiers map checkSources,
|
||||
TaskKey[Unit]("checkBinaries") <<= update map checkBinaries
|
||||
)
|
||||
|
||||
def getSources(report: UpdateReport) = report.matching(artifactFilter(`classifier` = "sources") )
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
> check-binaries
|
||||
> show update-classifiers
|
||||
> check-sources
|
||||
> checkBinaries
|
||||
> show updateClassifiers
|
||||
> checkSources
|
||||
|
|
|
|||
|
|
@ -7,17 +7,17 @@ libraryDependencies ++= Seq(
|
|||
"org.sat4j" % "org.sat4j.core" % "2.3.1"
|
||||
)
|
||||
|
||||
TaskKey[Unit]("check-update") <<= update map { report =>
|
||||
TaskKey[Unit]("checkUpdate") <<= update map { report =>
|
||||
val mods = report.configuration(Compile.name).get.allModules.map(_.name).toSet
|
||||
val expected = Set("org.sat4j.pb", "org.sat4j.core")
|
||||
if(mods != expected)
|
||||
error("Expected modules " + expected + ", got: " + mods)
|
||||
}
|
||||
|
||||
TaskKey[Unit]("check-classpath") <<= dependencyClasspath in Compile map { cp =>
|
||||
TaskKey[Unit]("checkClasspath") <<= dependencyClasspath in Compile map { cp =>
|
||||
val jars = cp.files.map(_.getName).toSet
|
||||
// Note: pb depends on tests artifact in core for no good reason. Previously this was not correctly added to the classpath.
|
||||
val expected = Set("org.sat4j.pb-2.3.1.jar", "org.sat4j.core-2.3.1.jar", "org.sat4j.core-2.3.1-tests.jar")
|
||||
if(jars != expected)
|
||||
error("Expected jars " + expected + ", got: " + jars)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,2 +1,2 @@
|
|||
> check-update
|
||||
> check-classpath
|
||||
> checkUpdate
|
||||
> checkClasspath
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
$ copy-file changes/def/build.sbt build.sbt
|
||||
$ copy-file changes/def/Def.java src/test/java/Def.java
|
||||
> reload
|
||||
> publish-local
|
||||
> publishLocal
|
||||
> publish
|
||||
> clean
|
||||
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
> update-sbt-classifiers
|
||||
> updateSbtClassifiers
|
||||
|
|
|
|||
|
|
@ -5,8 +5,8 @@ lazy val root = (project in file(".")).
|
|||
ivyPaths <<= (baseDirectory, target)( (dir, t) => new IvyPaths(dir, Some(t / "ivy-cache"))),
|
||||
libraryDependencies += "org.jsoup" % "jsoup" % "1.9.1" % Test from "http://jsoup.org/packages/jsoup-1.9.1.jar",
|
||||
ivyLoggingLevel := UpdateLogging.Full,
|
||||
TaskKey[Unit]("check-in-test") <<= checkClasspath(Test),
|
||||
TaskKey[Unit]("check-in-compile") <<= checkClasspath(Compile)
|
||||
TaskKey[Unit]("checkInTest") <<= checkClasspath(Test),
|
||||
TaskKey[Unit]("checkInCompile") <<= checkClasspath(Compile)
|
||||
)
|
||||
|
||||
def checkClasspath(conf: Configuration) =
|
||||
|
|
|
|||
|
|
@ -1,2 +1,2 @@
|
|||
> check-in-test
|
||||
-> check-in-compile
|
||||
> checkInTest
|
||||
-> checkInCompile
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
import complete.DefaultParsers._
|
||||
val parser = token(Space ~> ( ("exists" ^^^ true) | ("absent" ^^^ false) ) )
|
||||
InputKey[Unit]("check-output") := {
|
||||
InputKey[Unit]("checkOutput") := {
|
||||
val shouldExist = parser.parsed
|
||||
val dir = (classDirectory in Compile).value
|
||||
if((dir / "Anon.class").exists != shouldExist)
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
$ copy-file changes/Anon.java src/main/java/Anon.java
|
||||
> compile
|
||||
> check-output exists
|
||||
> checkOutput exists
|
||||
$ delete src/main/java/Anon.java
|
||||
> compile
|
||||
> check-output absent
|
||||
> checkOutput absent
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
crossPaths := false
|
||||
|
||||
TaskKey[Unit]("use-jar") := { injar.Test.other; () }
|
||||
TaskKey[Unit]("useJar") := { injar.Test.other; () }
|
||||
|
|
|
|||
|
|
@ -11,4 +11,4 @@ $ copy-file changes/build2.sbt build.sbt
|
|||
|
||||
# The project definition uses the class in test.jar and will fail here if sbt did not put the
|
||||
# jars in project/lib on the runtime classpath
|
||||
> use-jar
|
||||
> useJar
|
||||
|
|
|
|||
|
|
@ -16,8 +16,8 @@ package name.example {
|
|||
|
||||
object autoImport {
|
||||
val xyz = 3
|
||||
val checkMaxErrors = TaskKey[Unit]("check-max-errors")
|
||||
val checkName = TaskKey[Unit]("check-name")
|
||||
val checkMaxErrors = taskKey[Unit]("")
|
||||
val checkName = taskKey[Unit]("")
|
||||
}
|
||||
|
||||
import autoImport._
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
-> check-name
|
||||
-> check-max-errors
|
||||
-> checkName
|
||||
-> checkMaxErrors
|
||||
|
||||
$ copy-file changes/build.sbt build.sbt
|
||||
> reload
|
||||
|
||||
> check-name
|
||||
> check-max-errors
|
||||
> checkName
|
||||
> checkMaxErrors
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
$ mkdir sub3 sub1 sub2
|
||||
> console-project
|
||||
> 'sub3/console-project'
|
||||
> 'sub1/console-project'
|
||||
> consoleProject
|
||||
> 'sub3/consoleProject'
|
||||
> 'sub1/consoleProject'
|
||||
|
||||
> project sub2
|
||||
# This can't actually fail, unfortunately. The repl traps the exception and continues normally.
|
||||
> 'set initialCommands := """assert((name in currentRef get structure.data) == Some("sub2")) """ '
|
||||
> console-project
|
||||
> consoleProject
|
||||
|
|
|
|||
|
|
@ -7,8 +7,8 @@
|
|||
|
||||
# This part verifies that the package-src action works properly under a flattened/merged source hierarchy
|
||||
|
||||
> package-src
|
||||
> test:package-src
|
||||
> packageSrc
|
||||
> test:packageSrc
|
||||
|
||||
$ delete src
|
||||
$ delete test-src
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
crossPaths := false
|
||||
|
||||
TaskKey[Option[String]]("use-jar") := { injar.Test.foo }
|
||||
TaskKey[Option[String]]("useJar") := { injar.Test.foo }
|
||||
|
|
|
|||
|
|
@ -11,4 +11,4 @@ $ copy-file changes/build2.sbt build.sbt
|
|||
|
||||
# The project definition uses the class in test.jar and will fail here if sbt did not put the
|
||||
# jar in project/lib on the runtime classpath
|
||||
> use-jar
|
||||
> useJar
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@
|
|||
)
|
||||
}
|
||||
|
||||
InputKey[Unit]("check-count") <<= inputTask { argsTask =>
|
||||
InputKey[Unit]("checkCount") <<= inputTask { argsTask =>
|
||||
(argsTask, state) map { (args, s) =>
|
||||
def get(label: String) = s get AttributeKey[Int](label) getOrElse 0
|
||||
val loadCount = get("load-count")
|
||||
|
|
@ -23,4 +23,4 @@ InputKey[Unit]("check-count") <<= inputTask { argsTask =>
|
|||
assert(expectedLoad == loadCount, "Expected load count: " + expectedLoad + ", got: " + loadCount)
|
||||
assert(expectedUnload == unloadCount, "Expected unload count: " + expectedUnload + ", got: " + unloadCount)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
> check-count 1 0
|
||||
> check-count 1 0
|
||||
> checkCount 1 0
|
||||
> checkCount 1 0
|
||||
> reload
|
||||
> check-count 2 1
|
||||
> checkCount 2 1
|
||||
> set maxErrors := 1
|
||||
> check-count 3 2
|
||||
> checkCount 3 2
|
||||
> reboot
|
||||
> check-count 1 0
|
||||
> checkCount 1 0
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ lazy val sub = project
|
|||
|
||||
lazy val rootRef = LocalProject("root")
|
||||
|
||||
def rootSettings = Defaults.defaultSettings :+ ( TaskKey[Unit]("check") <<= checkTask )
|
||||
def rootSettings = (TaskKey[Unit]("check") <<= checkTask)
|
||||
def checkTask = (fullClasspath in (rootRef, Compile), fullClasspath in (rootRef, Runtime), fullClasspath in (rootRef, Test), fullClasspath in (sub, Test), fullClasspath in (superRoot, Compile)) map { (rc, rr, rt, st, pr) =>
|
||||
check0(st, "sub test", true)
|
||||
check0(pr, "superRoot main", false)
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
lazy val checkLoader = TaskKey[Unit]("check-loaders")
|
||||
lazy val checkLoaders = taskKey[Unit]("")
|
||||
|
||||
def checkTask = subs.map(sub => scalaInstance in LocalProject(sub.id)).join.map { sis =>
|
||||
assert(sis.sliding(2).forall{ case Seq(x,y) => x.loader == y.loader }, "Not all ScalaInstances had the same class loader.")
|
||||
|
|
@ -6,7 +6,7 @@ def checkTask = subs.map(sub => scalaInstance in LocalProject(sub.id)).join.map
|
|||
|
||||
lazy val root = (project in file(".")).
|
||||
settings(
|
||||
checkLoader <<= checkTask,
|
||||
checkLoaders <<= checkTask,
|
||||
concurrentRestrictions := Nil
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -4,4 +4,4 @@
|
|||
# problems in practice due to the different approach that substantially
|
||||
# reduces the probability of simultaneous access. The better test for 0.13+
|
||||
# is the unit test on ClassLoaderCache
|
||||
> check-loaders
|
||||
> checkLoaders
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import sbt.internal.inc.Analysis
|
||||
|
||||
InputKey[Unit]("check-number-of-compiler-iterations") <<= inputTask { (argTask: TaskKey[Seq[String]]) =>
|
||||
InputKey[Unit]("checkNumberOfCompilerIterations") <<= inputTask { (argTask: TaskKey[Seq[String]]) =>
|
||||
(argTask, compile in Compile) map { case (args: Seq[String], a: Analysis) =>
|
||||
assert(args.size == 1)
|
||||
val expectedIterationsNumber = args(0).toInt
|
||||
|
|
|
|||
|
|
@ -11,4 +11,4 @@ $ copy-file changes/Bar1.scala src/main/scala/Bar.scala
|
|||
# second iteration
|
||||
#> compile
|
||||
# check if there are only two compile iterations performed
|
||||
> check-number-of-compiler-iterations 2
|
||||
> checkNumberOfCompilerIterations 2
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
TaskKey[Unit]("output-empty") <<= classDirectory in Configurations.Compile map { outputDirectory =>
|
||||
TaskKey[Unit]("outputEmpty") <<= classDirectory in Configurations.Compile map { outputDirectory =>
|
||||
def classes = (outputDirectory ** "*.class").get
|
||||
if(!classes.isEmpty) sys.error("Classes existed:\n\t" + classes.mkString("\n\t")) else ()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
# Marked pending due to https://github.com/sbt/sbt/issues/1553
|
||||
|
||||
> output-empty
|
||||
> outputEmpty
|
||||
> compile
|
||||
-> output-empty
|
||||
-> outputEmpty
|
||||
$ delete src/main/scala/For.scala src/main/scala/Nested.scala
|
||||
> compile
|
||||
> output-empty
|
||||
> outputEmpty
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
import sbt.internal.inc.Analysis
|
||||
name := "test"
|
||||
|
||||
TaskKey[Unit]("check-same") <<= compile in Configurations.Compile map { case analysis: Analysis =>
|
||||
TaskKey[Unit]("checkSame") <<= compile in Configurations.Compile map { case analysis: Analysis =>
|
||||
analysis.apis.internal foreach { case (_, api) =>
|
||||
assert( xsbt.api.SameAPI(api.api, api.api) )
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
> check-same
|
||||
> checkSame
|
||||
|
|
|
|||
|
|
@ -2,8 +2,8 @@ import java.net.URLClassLoader
|
|||
|
||||
lazy val root = (project in file(".")).
|
||||
settings(
|
||||
TaskKey[Unit]("check-first") <<= checkTask("First"),
|
||||
TaskKey[Unit]("check-second") <<= checkTask("Second")
|
||||
TaskKey[Unit]("checkFirst") <<= checkTask("First"),
|
||||
TaskKey[Unit]("checkSecond") <<= checkTask("Second")
|
||||
)
|
||||
|
||||
def checkTask(className: String) =
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
$ copy-file changes/first.scala src/main/scala/A.scala
|
||||
> compile
|
||||
> check-first
|
||||
-> check-second
|
||||
> checkFirst
|
||||
-> checkSecond
|
||||
|
||||
$ copy-file changes/second.scala src/main/scala/A.scala
|
||||
> compile
|
||||
-> check-first
|
||||
> check-second
|
||||
-> checkFirst
|
||||
> checkSecond
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import sbt.internal.inc.Analysis
|
|||
* a) checks in which compilation given set of files was recompiled
|
||||
* b) checks overall number of compilations performed
|
||||
*/
|
||||
TaskKey[Unit]("check-compilations") := {
|
||||
TaskKey[Unit]("checkCompilations") := {
|
||||
val analysis = (compile in Compile).value match { case a: Analysis => a }
|
||||
val srcDir = (scalaSource in Compile).value
|
||||
def relative(f: java.io.File): java.io.File = f.relativeTo(srcDir) getOrElse f
|
||||
|
|
|
|||
|
|
@ -6,4 +6,4 @@ $ copy-file changes/A1.scala src/main/scala/A.scala
|
|||
# only A.scala should be recompiled
|
||||
> compile
|
||||
# check if there are only two compile iterations performed
|
||||
> check-compilations
|
||||
> checkCompilations
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ incOptions := incOptions.value.withRecompileAllFraction(1.0)
|
|||
* a) checks in which compilation given set of files was recompiled
|
||||
* b) checks overall number of compilations performed
|
||||
*/
|
||||
TaskKey[Unit]("check-compilations") := {
|
||||
TaskKey[Unit]("checkCompilations") := {
|
||||
val analysis = (compile in Compile).value match { case a: Analysis => a }
|
||||
val srcDir = (scalaSource in Compile).value
|
||||
def relative(f: java.io.File): java.io.File = f.relativeTo(srcDir) getOrElse f
|
||||
|
|
|
|||
|
|
@ -8,4 +8,4 @@ $ copy-file changes/A1.scala src/main/scala/A.scala
|
|||
# second iteration
|
||||
> compile
|
||||
# check in which compile iteration given source file got recompiled
|
||||
> check-compilations
|
||||
> checkCompilations
|
||||
|
|
|
|||
|
|
@ -3,12 +3,12 @@
|
|||
$ copy-file changes/Success.scala src/test/scala/Success.scala
|
||||
> test
|
||||
|
||||
> test-only com.foo.junit.test.blah.Success
|
||||
> testOnly com.foo.junit.test.blah.Success
|
||||
|
||||
$ copy-file changes/Failure.scala src/test/scala/Failure.scala
|
||||
-> test
|
||||
-> test-only com.foo.junit.test.blah.Failure
|
||||
> test-only com.foo.junit.test.blah.Success
|
||||
-> testOnly com.foo.junit.test.blah.Failure
|
||||
> testOnly com.foo.junit.test.blah.Success
|
||||
|
||||
> set fork in Test := true
|
||||
> test-only com.foo.junit.test.blah.Success
|
||||
> testOnly com.foo.junit.test.blah.Success
|
||||
|
|
|
|||
|
|
@ -1,2 +1,2 @@
|
|||
-> test-only A B
|
||||
> test-only B A
|
||||
-> testOnly A B
|
||||
> testOnly B A
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
# Test1 & Test2 create files Test1.run & Test2.run respectively
|
||||
|
||||
# no parameters
|
||||
> test-only
|
||||
> testOnly
|
||||
$ exists target/Test1.run
|
||||
$ exists target/Test2.run
|
||||
|
||||
|
|
@ -10,7 +10,7 @@ $ delete target/Test2.run
|
|||
|
||||
|
||||
# with explicit match
|
||||
> test-only Test1*
|
||||
> testOnly Test1*
|
||||
$ exists target/Test1.run
|
||||
-$ exists target/Test2.run
|
||||
|
||||
|
|
@ -18,7 +18,7 @@ $ delete target/Test1.run
|
|||
|
||||
|
||||
# with explicit match and exclusion
|
||||
> test-only Test* -Test1
|
||||
> testOnly Test* -Test1
|
||||
-$ exists target/Test1.run
|
||||
$ exists target/Test2.run
|
||||
|
||||
|
|
@ -26,7 +26,7 @@ $ delete target/Test2.run
|
|||
|
||||
|
||||
# with explicit match and exclusion
|
||||
> test-only Test* -Test2
|
||||
> testOnly Test* -Test2
|
||||
$ exists target/Test1.run
|
||||
-$ exists target/Test2.run
|
||||
|
||||
|
|
@ -34,7 +34,7 @@ $ delete target/Test1.run
|
|||
|
||||
|
||||
# with only exclusion
|
||||
> test-only -Test2
|
||||
> testOnly -Test2
|
||||
$ exists target/Test1.run
|
||||
-$ exists target/Test2.run
|
||||
|
||||
|
|
@ -42,7 +42,7 @@ $ delete target/Test1.run
|
|||
|
||||
|
||||
# with only exclusion
|
||||
> test-only -Test1
|
||||
> testOnly -Test1
|
||||
-$ exists target/Test1.run
|
||||
$ exists target/Test2.run
|
||||
|
||||
|
|
@ -50,12 +50,12 @@ $ delete target/Test2.run
|
|||
|
||||
|
||||
# with only glob exclusion
|
||||
> test-only -Test*
|
||||
> testOnly -Test*
|
||||
-$ exists target/Test1.run
|
||||
-$ exists target/Test2.run
|
||||
|
||||
|
||||
# with only glob exclusion
|
||||
> test-only -T*1 -T*2
|
||||
> testOnly -T*1 -T*2
|
||||
-$ exists target/Test1.run
|
||||
-$ exists target/Test2.run
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue