From 0a09fa62edf6216007ed7fd1bcc74ea97ccabd2f Mon Sep 17 00:00:00 2001 From: Eugene Yokota Date: Sun, 22 Sep 2019 18:07:28 -0400 Subject: [PATCH] SBT_ETC_FILE Travis CI adds `/etc/sbt/sbtopts` that prevents us from testing the out-of-box behavior. This allows us to override the location. --- .travis.yml | 4 ++++ src/universal/bin/sbt | 4 +++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 56fe99a41..a655dd166 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,6 +11,8 @@ env: - TRAVIS_JDK=adopt@1.8.212-04 - JABBA_HOME=$HOME/.jabba - TRAVIS_JDK11=openjdk@1.11.0 + ## ignore Travis CI's default /etc/sbt/sbtopts + - SBT_ETC_FILE=$HOME/etc/sbt/sbtopts matrix: include: @@ -41,6 +43,7 @@ matrix: install: - $JABBA_HOME/bin/jabba install $TRAVIS_JDK && export JAVA_HOME="$JABBA_HOME/jdk/$TRAVIS_JDK/Contents/Home" && export PATH="$JAVA_HOME/bin:$PATH" - java -Xmx32m -version + - unset SBT_OPTS script: - sbt -Dsbt.build.version=$SBT_VER universal:packageBin - cd citest && ./test.sh @@ -72,6 +75,7 @@ before_install: install: - $JABBA_HOME/bin/jabba install $TRAVIS_JDK && export JAVA_HOME="$JABBA_HOME/jdk/$TRAVIS_JDK" && export PATH="$JAVA_HOME/bin:$PATH" - java -Xmx32m -version + - unset SBT_OPTS cache: directories: diff --git a/src/universal/bin/sbt b/src/universal/bin/sbt index d72201d0a..4907c64c7 100755 --- a/src/universal/bin/sbt +++ b/src/universal/bin/sbt @@ -385,6 +385,8 @@ run() { declare -r noshare_opts="-Dsbt.global.base=project/.sbtboot -Dsbt.boot.directory=project/.boot -Dsbt.ivy.home=project/.ivy" declare -r sbt_opts_file=".sbtopts" declare -r etc_sbt_opts_file="/etc/sbt/sbtopts" +# this allows /etc/sbt/sbtopts location to be changed +declare -r etc_file="${SBT_ETC_FILE:-$etc_sbt_opts_file}" declare -r dist_sbt_opts_file="${sbt_home}/conf/sbtopts" declare -r win_sbt_opts_file="${sbt_home}/conf/sbtconfig.txt" @@ -546,7 +548,7 @@ loadConfigFile() { [[ -f "$dist_sbt_opts_file" ]] && set -- $(loadConfigFile "$dist_sbt_opts_file") "$@" # Here we pull in the global settings configuration. -[[ -f "$etc_sbt_opts_file" ]] && set -- $(loadConfigFile "$etc_sbt_opts_file") "$@" +[[ -f "$etc_file" ]] && set -- $(loadConfigFile "$etc_file") "$@" # Pull in the project-level config file, if it exists. [[ -f "$sbt_opts_file" ]] && set -- $(loadConfigFile "$sbt_opts_file") "$@"