Merge etc branch into SBT script, so we operate more like a linux package.

This commit is contained in:
Josh Suereth 2011-12-21 14:20:16 -05:00
commit b299acd858
3 changed files with 76 additions and 3 deletions

View File

@ -31,6 +31,16 @@ object Packaging {
(bd / "usr/share/doc/sbt") -> "/usr/share/doc/sbt"
) asDocs()
},
linuxPackageMappings <+= (sourceDirectory in Linux) map { bd =>
packageMapping(
(bd / "etc/sbt") -> "/etc/sbt"
) withConfig()
},
linuxPackageMappings <+= (sourceDirectory in Linux) map { bd =>
packageMapping(
(bd / "etc/sbt/sbtopts") -> "/etc/sbt/sbtopts"
) withPerms "0644" withConfig()
},
// DEBIAN SPECIFIC
name in Debian := "sbt",

20
sbt
View File

@ -29,6 +29,10 @@ get_mem_opts () {
echo "-Xms${mem}m -Xmx${mem}m -XX:MaxPermSize=${perm}m -XX:ReservedCodeCacheSize=${codecache}m"
}
is_owned_by_user () {
[[ "$(stat --printf='%U' $1)" == "$(USER)" ]] && { echo "OK" ; return; }
}
die() {
echo "Aborting: $@"
exit 1
@ -46,12 +50,17 @@ 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"
declare -r script_path=$(get_script_path "$BASH_SOURCE")
declare -r script_dir="$(dirname $script_path)"
if test -z "$HOME"; then
declare -r script_dir="$(dirname $script_path)"
else
declare -r script_dir="$HOME/.sbt"
fi
declare -r script_name="$(basename $script_path)"
declare java_cmd=java
@ -334,8 +343,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 "$@"

49
src/linux/etc/sbt/sbtopts Normal file
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>