Merge pull request #4805 from eatkins/watch-start-message

Use project watchStartMessage for multi commands
This commit is contained in:
eugene yokota
2019-06-14 01:08:38 +02:00
committed by GitHub
@@ -469,7 +469,8 @@ private[sbt] object Continuous extends DeprecatedContinuous {
val project = extracted.currentRef val project = extracted.currentRef
val logger = setLevel(rawLogger, configs.map(_.watchSettings.logLevel).min, state) val logger = setLevel(rawLogger, configs.map(_.watchSettings.logLevel).min, state)
val beforeCommand = () => configs.foreach(_.watchSettings.beforeCommand()) val beforeCommand = () => configs.foreach(_.watchSettings.beforeCommand())
val onStart: () => Watch.Action = getOnStart(project, commands, configs, rawLogger, count) val onStart: () => Watch.Action =
getOnStart(project, commands, configs, rawLogger, count, extracted)
val nextInputEvent: () => Watch.Action = parseInputEvents(configs, state, inputStream, logger) val nextInputEvent: () => Watch.Action = parseInputEvents(configs, state, inputStream, logger)
val (nextFileEvent, cleanupFileMonitor): (() => Option[(Watch.Event, Watch.Action)], () => Unit) = val (nextFileEvent, cleanupFileMonitor): (() => Option[(Watch.Event, Watch.Action)], () => Unit) =
getFileEvents(configs, rawLogger, state, count, commands, fileStampCache) getFileEvents(configs, rawLogger, state, count, commands, fileStampCache)
@@ -501,7 +502,8 @@ private[sbt] object Continuous extends DeprecatedContinuous {
commands: Seq[String], commands: Seq[String],
configs: Seq[Config], configs: Seq[Config],
logger: Logger, logger: Logger,
count: AtomicInteger count: AtomicInteger,
extracted: Extracted,
): () => Watch.Action = { ): () => Watch.Action = {
val f: () => Seq[Watch.Action] = () => { val f: () => Seq[Watch.Action] = () => {
configs.map { params => configs.map { params =>
@@ -522,8 +524,11 @@ private[sbt] object Continuous extends DeprecatedContinuous {
() => { () => {
val res = f().min val res = f().min
// Print the default watch message if there are multiple tasks // Print the default watch message if there are multiple tasks
if (configs.size > 1) if (configs.size > 1) {
Watch.defaultStartWatch(count.get(), project, commands).foreach(logger.info(_)) val onStartWatch =
extracted.getOpt(watchStartMessage in project).getOrElse(Watch.defaultStartWatch)
onStartWatch(count.get(), project, commands).foreach(logger.info(_))
}
res res
} }
} }