Added a default config file.

Added an /etc/sbt/sbtopts file that contains defaults.
Added a hook to the sbt script to pull in from /etc.
Allowed comments in sbtopts configuration.
This commit is contained in:
Josh Suereth 2011-12-06 22:37:02 -05:00
parent 34fed66022
commit 57dd8bc0ac
3 changed files with 58 additions and 3 deletions

View File

@ -84,7 +84,7 @@ object DebianPkg {
final val ControlFileContent = """Section: java
Priority: optional
Architecture: all
Depends: curl, java2-runtime, bash (>= 2.05a-11)
Depends: curl, java2-runtime, bash, sed
Recommends: git
Maintainer: Josh Suereth <joshua.suereth@typesafe.com>
Description: Simple Build Tool

10
sbt
View File

@ -46,6 +46,7 @@ declare -r default_sbt_opts="-XX:+CMSClassUnloadingEnabled"
declare -r default_sbt_mem=1536
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"
declare -r latest_28="2.8.2"
declare -r latest_29="2.9.1"
declare -r latest_210="2.10.0-SNAPSHOT"
@ -309,8 +310,13 @@ process_args ()
}
}
# if .sbtopts exists, prepend its contents to $@ so it can be processed by this runner
[[ -f "$sbt_opts_file" ]] && set -- $(cat "$sbt_opts_file") "$@"
loadConfigFile() {
cat "$1" | sed '/^\#/d'
}
# if sbtopts files exist, prepend their contents to $@ so it can be processed by this runner
[[ -f "$etc_sbt_opts_file" ]] && set -- $(loadConfigFile "$etc_sbt_opts_file") "$@"
[[ -f "$sbt_opts_file" ]] && set -- $(loadConfigFile "$sbt_opts_file") "$@"
# process the combined args, then reset "$@" to the residuals
process_args "$@"

View File

@ -0,0 +1,49 @@
# ------------------------------------------------ #
# The SBT Configuration file. #
# ------------------------------------------------ #
# Disable ANSI color codes
#
#-no-colors
# Starts sbt even if the current directory contains no sbt project.
#
-sbt-create
# Path to global settings/plugins directory (default: ~/.sbt)
#
#-sbt-dir /etc/sbt
# Path to shared boot directory (default: ~/.sbt/boot in 0.11 series)
#
#-sbt-boot ~/.sbt/boot
# Path to local Ivy repository (default: ~/.ivy2)
#
#-ivy ~/.ivy2
# set memory options
#
#-mem <integer>
# Use local caches for projects, no sharing.
#
#-no-share
# Put SBT in offline mode.
#
#-offline
# Sets the SBT version to use.
#-sbt-version 0.11.2
# Scala version (default: latest release)
#
#-scala-home <path>
#-scala-version <version>
# java version (default: java from PATH, currently $(java -version |& grep version))
#
#-java-home <path>