Merge pull request #112 from fommil/lunix

add support for .jvmopts to the bash launcher
This commit is contained in:
eugene yokota 2016-08-25 16:46:47 -04:00 committed by GitHub
commit a1dfe86698
3 changed files with 19 additions and 9 deletions

View File

@ -72,10 +72,15 @@ add -X to sbt's scalacOptions (-S is stripped)
.RS
The user configuration file.
.RE
.I ".jvmopts"
.RS
if this file exists in the current directory, its contents are appended
to the JAVA_OPTS.
.RE
.I ".sbtopts"
.RS
if this file exists in the current directory, it is prepended to the
runner args.
if this file exists in the current directory, its contents are prepended
to the runner args.
.RE
.I "/etc/sbt/sbtopts"
.RS

View File

@ -94,9 +94,11 @@ Usage: $script_name [options]
# jvm options and output control
JAVA_OPTS environment variable, if unset uses "$java_opts"
.jvmopts if this file exists in the current directory, its contents
are appended to JAVA_OPTS
SBT_OPTS environment variable, if unset uses "$default_sbt_opts"
.sbtopts if this file exists in the current directory, it is
prepended to the runner args
.sbtopts if this file exists in the current directory, its contents
are prepended to the runner args
/etc/sbt/sbtopts if this file exists, it is prepended to the runner args
-Dkey=val pass -Dkey=val directly to the java runtime
-J-X pass option -X directly to the java runtime
@ -137,16 +139,14 @@ loadConfigFile() {
done
}
# TODO - Pull in config based on operating system... (MSYS + cygwin should pull in txt file).
# Here we pull in the global settings configuration.
[[ -f "$etc_sbt_opts_file" ]] && set -- $(loadConfigFile "$etc_sbt_opts_file") "$@"
# -- Windows behavior stub'd
# JAVA_OPTS=$(cat "$WDIR/sbtconfig.txt" | sed -e 's/\r//g' -e 's/^#.*$//g' | sed ':a;N;$!ba;s/\n/ /g')
# Pull in the project-level config file, if it exists.
[[ -f "$sbt_opts_file" ]] && set -- $(loadConfigFile "$sbt_opts_file") "$@"
# Pull in the project-level java config, if it exists.
[[ -f ".jvmopts" ]] && export JAVA_OPTS="$JAVA_OPTS $(loadConfigFile .jvmopts)"
run "$@"

View File

@ -128,7 +128,12 @@ process_args () {
-sbt-jar) require_arg path "$1" "$2" && sbt_jar="$2" && shift 2 ;;
-sbt-version) require_arg version "$1" "$2" && sbt_version="$2" && shift 2 ;;
-java-home) require_arg path "$1" "$2" && java_cmd="$2/bin/java" && shift 2 ;;
-java-home) require_arg path "$1" "$2" &&
java_cmd="$2/bin/java" &&
export JAVA_HOME="$2" &&
export JDK_HOME="$2" &&
export PATH="$2/bin:$PATH" &&
shift 2 ;;
-D*) addJava "$1" && shift ;;
-J*) addJava "${1:2}" && shift ;;