From a47004e01e7409f73c45ebd18bcc09f52fddd63b Mon Sep 17 00:00:00 2001 From: Eugene Yokota Date: Fri, 5 Apr 2019 11:30:59 -0400 Subject: [PATCH] add options for timings, traces, supershell, and color `--supershell=*` will pass on to `-Dsbt.supershell=*`. --- .../src/test/scala/RunnerTest.scala | 18 ++++++++++++++++++ src/universal/bin/sbt | 14 +++++++++++++- 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/integration-test/src/test/scala/RunnerTest.scala b/integration-test/src/test/scala/RunnerTest.scala index 0b9d63787..074d75c04 100644 --- a/integration-test/src/test/scala/RunnerTest.scala +++ b/integration-test/src/test/scala/RunnerTest.scala @@ -34,6 +34,24 @@ object SbtRunnerTest extends SimpleTestSuite with PowerAssertions { () } + test("sbt --color=false") { + val out = sbtProcess("compile --color=false -v").!!.linesIterator.toList + assert(out.contains[String]("-Dsbt.color=false")) + () + } + + test("sbt --supershell=never") { + val out = sbtProcess("compile --supershell=never -v").!!.linesIterator.toList + assert(out.contains[String]("-Dsbt.supershell=never")) + () + } + + test("sbt --timings") { + val out = sbtProcess("compile --timings -v").!!.linesIterator.toList + assert(out.contains[String]("-Dsbt.task.timings=true")) + () + } + test("sbt -mem 503") { val out = sbtProcess("compile -mem 503 -v").!!.linesIterator.toList assert(out.contains[String]("-Xmx503m")) diff --git a/src/universal/bin/sbt b/src/universal/bin/sbt index c426ff9ea..688b6b6e4 100755 --- a/src/universal/bin/sbt +++ b/src/universal/bin/sbt @@ -425,6 +425,12 @@ Usage: `basename "$0"` [options] -v | --verbose this runner is chattier -d | --debug set sbt log level to debug --no-colors disable ANSI color codes + --color=auto|always|true|false|never + enable or disable ANSI color codes (sbt 1.3 and above) + --supershell=auto|always|true|false|never + enable or disable supershell (sbt 1.3 and above) + --traces generate Trace Event report on shutdown (sbt 1.3 and above) + --timings display task timings report on shutdown --sbt-create start sbt even if current directory contains no sbt project --sbt-dir path to global settings/plugins directory (default: ~/.sbt) --sbt-boot path to shared boot directory (default: ~/.sbt/boot in 0.11 series) @@ -433,7 +439,7 @@ Usage: `basename "$0"` [options] --no-share use all local caches; no sharing --no-global uses global caches, but does not use global ~/.sbt directory. --jvm-debug Turn on JVM debugging, open at the given port. - --batch Disable interactive mode + --batch disable interactive mode # sbt version (default: from project/build.properties if present, else latest release) --sbt-version use the specified version of sbt @@ -468,6 +474,12 @@ process_my_args () { while [[ $# -gt 0 ]]; do case "$1" in -no-colors|--no-colors) addJava "-Dsbt.log.noformat=true" && shift ;; + -timings|--timings) addJava "-Dsbt.task.timings=true" && addJava "-Dsbt.task.timings.on.shutdown=true" && shift ;; + -traces|--traces) addJava "-Dsbt.traces=true" && shift ;; + --supershell=*) addJava "-Dsbt.supershell=${1:13}" && shift ;; + -supershell=*) addJava "-Dsbt.supershell=${1:12}" && shift ;; + --color=*) addJava "-Dsbt.color=${1:8}" && shift ;; + -color=*) addJava "-Dsbt.color=${1:7}" && shift ;; -no-share|--no-share) addJava "$noshare_opts" && shift ;; -no-global|--no-global) addJava "-Dsbt.global.base=$(pwd)/project/.sbtboot" && shift ;; -sbt-boot|--sbt-boot) require_arg path "$1" "$2" && addJava "-Dsbt.boot.directory=$2" && shift 2 ;;