mirror of https://github.com/sbt/sbt.git
Merge pull request #5290 from eatkins/scripted-log
Use logger in scripted instead of println
This commit is contained in:
commit
c933a1923d
|
|
@ -1115,7 +1115,8 @@ def scriptedTask: Def.Initialize[InputTask[Unit]] = Def.inputTask {
|
|||
scriptedBufferLog.value,
|
||||
Def.setting(Scripted.scriptedParser(scriptedSource.value)).parsed,
|
||||
scriptedPrescripted.value,
|
||||
scriptedLaunchOpts.value
|
||||
scriptedLaunchOpts.value,
|
||||
streams.value.log
|
||||
)
|
||||
}
|
||||
|
||||
|
|
@ -1128,7 +1129,8 @@ def scriptedUnpublishedTask: Def.Initialize[InputTask[Unit]] = Def.inputTask {
|
|||
scriptedBufferLog.value,
|
||||
Def.setting(Scripted.scriptedParser(scriptedSource.value)).parsed,
|
||||
scriptedPrescripted.value,
|
||||
scriptedLaunchOpts.value
|
||||
scriptedLaunchOpts.value,
|
||||
streams.value.log
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -5,6 +5,8 @@ import java.lang.reflect.InvocationTargetException
|
|||
import sbt._
|
||||
import sbt.internal.inc.ScalaInstance
|
||||
import sbt.internal.inc.classpath.{ ClasspathUtilities, FilteredLoader }
|
||||
import sbt.ScriptedPlugin.autoImport._
|
||||
import sbt.util.Level
|
||||
|
||||
object LocalScriptedPlugin extends AutoPlugin {
|
||||
override def requires = plugins.JvmPlugin
|
||||
|
|
@ -99,8 +101,10 @@ object Scripted {
|
|||
args: Seq[String],
|
||||
prescripted: File => Unit,
|
||||
launchOpts: Seq[String],
|
||||
logger: Logger
|
||||
): Unit = {
|
||||
System.err.println(s"About to run tests: ${args.mkString("\n * ", "\n * ", "\n")}")
|
||||
logger.info(s"About to run tests: ${args.mkString("\n * ", "\n * ", "\n")}")
|
||||
logger.info("")
|
||||
|
||||
// Force Log4J to not use a thread context classloader otherwise it throws a CCE
|
||||
sys.props(org.apache.logging.log4j.util.LoaderUtil.IGNORE_TCCL_PROPERTY) = "true"
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ final class ScriptedTests(
|
|||
val n = nme.getName
|
||||
val label = s"$g / $n"
|
||||
() => {
|
||||
println(s"Running $label")
|
||||
log.info(s"Running $label")
|
||||
val result = testResources.readWriteResourceDirectory(g, n) { testDirectory =>
|
||||
val buffer = new BufferedLogger(new FullLogger(log))
|
||||
val singleTestRunner = () => {
|
||||
|
|
@ -326,7 +326,7 @@ final class ScriptedTests(
|
|||
groupedTests.map {
|
||||
case ((group, name), originalDir) =>
|
||||
val label = s"$group/$name"
|
||||
println(s"Running $label")
|
||||
log.info(s"Running $label")
|
||||
// Copy test's contents and reload the sbt instance to pick them up
|
||||
IO.copyDirectory(originalDir, tempTestDir)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue