mirror of https://github.com/sbt/sbt.git
Tweak tests
Most of those adjustments are required when using the coursier-based sbt launcher.
This commit is contained in:
parent
dab476ab93
commit
d852209172
|
|
@ -1,3 +1,4 @@
|
|||
> clean
|
||||
> checkEmpty
|
||||
> update
|
||||
> checkNotEmpty
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ coursierCache := baseDirectory.value / "cache"
|
|||
logFile := baseDirectory.value / "log"
|
||||
|
||||
coursierLogger := {
|
||||
val logStream = new java.io.PrintStream(logFile.value)
|
||||
var logStream: java.io.PrintStream = null
|
||||
def log(msg: String): Unit = {
|
||||
println(msg)
|
||||
logStream.println(msg)
|
||||
|
|
@ -16,6 +16,9 @@ coursierLogger := {
|
|||
|
||||
val logger = new coursier.cache.CacheLogger {
|
||||
override def init(sizeHint: Option[Int]): Unit = {
|
||||
logStream = new java.io.PrintStream(
|
||||
new java.io.FileOutputStream(logFile.value, true)
|
||||
)
|
||||
log("init")
|
||||
}
|
||||
override def foundLocally(url: String): Unit = {
|
||||
|
|
@ -29,6 +32,9 @@ coursierLogger := {
|
|||
}
|
||||
override def stop(): Unit = {
|
||||
log("stop")
|
||||
logStream.flush()
|
||||
logStream.close()
|
||||
logStream = null
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -26,7 +26,10 @@ object Main extends App {
|
|||
"sbt.global.base",
|
||||
sys.props("user.home") + "/.sbt"
|
||||
))
|
||||
val prefix = new File(sbtBase, "boot").getAbsolutePath
|
||||
val prefixes = Seq(new File(sbtBase, "boot").getAbsolutePath) ++
|
||||
Seq("coursier.sbt-launcher.dirs.scala-jars", "coursier.sbt-launcher.dirs.base")
|
||||
.flatMap(sys.props.get(_))
|
||||
.map(new File(_).getAbsolutePath)
|
||||
|
||||
def fromBootAndUnique(name: String): Unit = {
|
||||
val jars = cp.filter(_.getName.startsWith(name)).distinct
|
||||
|
|
@ -34,7 +37,7 @@ object Main extends App {
|
|||
|
||||
val Seq(jar) = jars
|
||||
|
||||
assert(jar.getAbsolutePath.startsWith(prefix), s"JAR for $name ($jar) not under $prefix")
|
||||
assert(prefixes.exists(jar.getAbsolutePath.startsWith), s"JAR for $name ($jar) not under any of ${prefixes.mkString(", ")}")
|
||||
}
|
||||
|
||||
val props = Thread.currentThread()
|
||||
|
|
|
|||
Loading…
Reference in New Issue