From 91b71b39d34967bb87fa17d409f481c4109bbb64 Mon Sep 17 00:00:00 2001 From: Eugene Yokota Date: Thu, 5 Sep 2019 17:51:59 -0400 Subject: [PATCH] Reproduce JDK 11 warning Ref https://github.com/sbt/sbt/issues/5031 --- citest/build.sbt | 9 ++++++++- citest/test.sh | 11 +++++++---- src/universal/bin/sbt | 12 +++++++----- 3 files changed, 22 insertions(+), 10 deletions(-) diff --git a/citest/build.sbt b/citest/build.sbt index d860bffb1..19f66a715 100644 --- a/citest/build.sbt +++ b/citest/build.sbt @@ -1,4 +1,5 @@ lazy val check = taskKey[Unit]("") +lazy val check2 = taskKey[Unit]("") lazy val root = (project in file(".")) .settings( @@ -8,7 +9,6 @@ lazy val root = (project in file(".")) val xs = IO.readLines(file("output.txt")).toVector println(xs) - assert(xs(0) startsWith "[info] Loading project definition") assert(xs(1) startsWith "[info] Loading settings") assert(xs(2) startsWith "[info] Set current project to Hello") @@ -18,5 +18,12 @@ lazy val root = (project in file(".")) val ys = IO.readLines(file("err.txt")).toVector.distinct assert(ys.isEmpty, s"there's an stderr: $ys") + }, + + check2 := { + val xs = IO.readLines(file("output.txt")).toVector + println(xs) + val ys = IO.readLines(file("err.txt")).toVector.distinct + assert(!ys.exists(_.contains("Ignoring option MaxPermSize; support was removed in 8.0")), s"there's an stderr: $ys") } ) diff --git a/citest/test.sh b/citest/test.sh index 499669739..2dc2870b9 100755 --- a/citest/test.sh +++ b/citest/test.sh @@ -1,7 +1,11 @@ #!/bin/bash +# exit when something fails +set -e + ## https://github.com/travis-ci/travis-ci/issues/8408 unset _JAVA_OPTIONS +unset SBT_OPTS java -version ## end of Java switching @@ -9,12 +13,12 @@ java -version mkdir -p freshly-baked unzip -qo ../target/universal/sbt.zip -d ./freshly-baked -export SBT_OPTS=-Dfile.encoding=UTF-8 +./freshly-baked/sbt/bin/sbt -Dsbt.no.format=true about +./freshly-baked/sbt/bin/sbt -Dsbt.no.format=true about 1> output.txt 2> err.txt +./freshly-baked/sbt/bin/sbt check2 ./freshly-baked/sbt/bin/sbt about run -v -export SBT_OPTS="-Dfile.encoding=UTF-8 -Xms2048M -Xmx2048M -Xss4M" - ./freshly-baked/sbt/bin/sbt about run fail() { @@ -33,4 +37,3 @@ test -d ./target/home3/alternate-preloaded/org/scala-sbt || fail "expected to fi env HOME=./target/home4 ./freshly-baked/sbt/bin/sbt -J-Dsbt.global.base=./target/home4/global-base about test -d ./target/home4/global-base/preloaded/org/scala-sbt || fail "expected to find preloaded in ./target/home4/global-base" - diff --git a/src/universal/bin/sbt b/src/universal/bin/sbt index a630386ee..81811da46 100755 --- a/src/universal/bin/sbt +++ b/src/universal/bin/sbt @@ -13,6 +13,8 @@ declare init_sbt_version=_to_be_replaced declare sbt_default_mem=1024 declare -r default_sbt_opts="" declare -r default_java_opts="-Dfile.encoding=UTF-8" +declare sbt_verbose=0 +declare sbt_debug=0 ### ------------------------------- ### ### Helper methods for BASH scripts ### @@ -78,10 +80,10 @@ echoerr () { echo 1>&2 "$@" } vlog () { - [[ $verbose || $debug ]] && echoerr "$@" + [[ $sbt_verbose || $sbt_debug ]] && echoerr "$@" } dlog () { - [[ $debug ]] && echoerr "$@" + [[ $sbt_debug ]] && echoerr "$@" } jar_file () { @@ -103,7 +105,7 @@ rt_export_file () { execRunner () { # print the arguments one to a line, quoting any containing spaces - [[ $verbose || $debug ]] && echo "# Executing command line:" && { + [[ $sbt_verbose || $sbt_debug ]] && echo "# Executing command line:" && { for arg; do if printf "%s\n" "$arg" | grep -q ' '; then printf "\"%s\"\n" "$arg" @@ -518,9 +520,9 @@ process_args () { while [[ $# -gt 0 ]]; do case "$1" in -h|-help) usage; exit 1 ;; - -v|-verbose) verbose=1 && shift ;; + -v|-verbose) sbt_verbose=1 && shift ;; -V|-version) print_sbt_version=1 && shift ;; - -d|-debug) debug=1 && addSbt "-debug" && shift ;; + -d|-debug) sbt_debug=1 && addSbt "-debug" && shift ;; -ivy) require_arg path "$1" "$2" && addJava "-Dsbt.ivy.home=$2" && shift 2 ;; -mem) require_arg integer "$1" "$2" && addMemory "$2" && shift 2 ;;