logging for packaging

This commit is contained in:
Mark Harrah 2011-03-22 20:42:21 -04:00
parent 0123351a8f
commit e0b453225e
2 changed files with 10 additions and 5 deletions

View File

@ -71,7 +71,9 @@ object Package
val sources :+: _ :+: manifest :+: HNil = inputs
outputChanged(cacheFile / "output") { (outChanged, jar: PlainFileInfo) =>
if(inChanged || outChanged)
makeJar(sources.toSeq, jar.file, manifest)
makeJar(sources.toSeq, jar.file, manifest, log)
else
log.debug("Jar uptodate: " + jar.file)
}
}
@ -85,13 +87,16 @@ object Package
if(main.getValue(version) eq null)
main.put(version, "1.0")
}
def makeJar(sources: Seq[(File, String)], jar: File, manifest: Manifest)
def makeJar(sources: Seq[(File, String)], jar: File, manifest: Manifest, log: Logger)
{
println("Packaging " + jar.getAbsolutePath + " ...")
log.info("Packaging " + jar.getAbsolutePath + " ...")
IO.delete(jar)
log.debug(sourcesDebugString(sources))
IO.jar(sources, jar, manifest)
println("Done packaging.")
log.info("Done packaging.")
}
def sourcesDebugString(sources: Seq[(File, String)]): String =
"Input file mappings:\n\t" + (sources map { case (f,s) => s + "\n\t " + f} mkString("\n\t") )
implicit def manifestEquiv: Equiv[Manifest] = defaultEquiv
implicit def manifestFormat: Format[Manifest] = streamFormat( _ write _, in => new Manifest(in))

View File

@ -18,6 +18,7 @@ package sbt
sealed trait TestOption
object Tests
{
// (overall result, individual results)
type Output = (TestResult.Value, Map[String,TestResult.Value])
final case class Setup(setup: ClassLoader => Unit) extends TestOption
@ -82,7 +83,6 @@ object Tests
testTask(frameworks.values.toSeq, testLoader, tests, setup.readOnly, cleanup.readOnly, log, testListeners.readOnly, arguments)
}
// (overall result, individual results)
def testTask(frameworks: Seq[Framework], loader: ClassLoader, tests: Seq[TestDefinition],
userSetup: Iterable[ClassLoader => Unit], userCleanup: Iterable[ClassLoader => Unit],
log: Logger, testListeners: Seq[TestReportListener], arguments: Map[Framework, Seq[String]]): Task[Output] =