mirror of https://github.com/sbt/sbt.git
Merge branch 'master' into deb-etc
This commit is contained in:
commit
77c327de8c
78
README.md
78
README.md
|
|
@ -2,63 +2,40 @@ sbt: the rebel cut
|
||||||
==================
|
==================
|
||||||
|
|
||||||
An alternative script for running [sbt](https://github.com/harrah/xsbt).
|
An alternative script for running [sbt](https://github.com/harrah/xsbt).
|
||||||
It works with sbt 0.7x projects as well as 0.10+. If you're in an sbt
|
It works with sbt 0.7.x projects as well as 0.10+. If you're in an sbt
|
||||||
project directory, the runner will figure out the versions of sbt
|
project directory, the runner will figure out the versions of sbt and
|
||||||
and scala required by the project and download them if necessary.
|
scala required by the project and download them if necessary.
|
||||||
|
|
||||||
There's also a template project sbt coming together, but it's unfinished.
|
Sample usage: create a new project using a snapshot version of sbt as
|
||||||
See below for how to pull the template project in as a plugin.
|
well as a snapshot version of scala, then run the sbt "about" command.
|
||||||
However the runner is quite useful already.
|
|
||||||
|
|
||||||
Here's a sample use of the runner: it creates a new project using a
|
% sbt -v -sbt-snapshot -210 -sbt-create about
|
||||||
snapshot version of sbt as well as a snapshot version of scala, then
|
Detected sbt version 0.11.3-SNAPSHOT
|
||||||
runs the sbt "about" command.
|
sbt snapshot is 0.11.3-20111207-052114
|
||||||
|
|
||||||
% sbt -d -sbt-snapshot -210 -sbt-create about
|
|
||||||
# Executing command line:
|
# Executing command line:
|
||||||
java
|
java
|
||||||
-Xss2m
|
|
||||||
-Xms256M
|
|
||||||
-Xmx1536M
|
|
||||||
-XX:MaxPermSize=256M
|
|
||||||
-XX:+CMSClassUnloadingEnabled
|
-XX:+CMSClassUnloadingEnabled
|
||||||
-XX:MaxPermSize=512m
|
-Xms1536m
|
||||||
-Xmx2g
|
-Xmx1536m
|
||||||
-Xss2m
|
-XX:MaxPermSize=384m
|
||||||
|
-XX:ReservedCodeCacheSize=192m
|
||||||
|
-Dfile.encoding=UTF8
|
||||||
-jar
|
-jar
|
||||||
/r/sbt-extras/.lib/0.11.0-20110825-052147/sbt-launch.jar
|
/r/sbt-extras/.lib/0.11.3-SNAPSHOT/sbt-launch.jar
|
||||||
"set logLevel in Global := Level.Debug"
|
"set resolvers in ThisBuild += ScalaToolsSnapshots"
|
||||||
"++ 2.10.0-SNAPSHOT"
|
"++ 2.10.0-SNAPSHOT"
|
||||||
"iflast shell"
|
|
||||||
about
|
about
|
||||||
|
|
||||||
Getting net.java.dev.jna jna 3.2.3 ...
|
[info] Loading global plugins from /Users/paulp/.sbt/plugins
|
||||||
:: retrieving :: org.scala-tools.sbt#boot-app
|
[info] Set current project to default-71999b (in build file:/Users/paulp/Desktop/new/)
|
||||||
confs: [default]
|
|
||||||
1 artifacts copied, 0 already retrieved (838kB/12ms)
|
|
||||||
Getting Scala 2.9.1.RC4 (for sbt)...
|
|
||||||
:: retrieving :: org.scala-tools.sbt#boot-scala
|
|
||||||
confs: [default]
|
|
||||||
4 artifacts copied, 0 already retrieved (19939kB/32ms)
|
|
||||||
Getting org.scala-tools.sbt sbt_2.9.1.RC4 0.11.0-20110825-052147 ...
|
|
||||||
:: retrieving :: org.scala-tools.sbt#boot-app
|
|
||||||
confs: [default]
|
|
||||||
38 artifacts copied, 0 already retrieved (6948kB/45ms)
|
|
||||||
[info] Set current project to default-30ae78 (in build file:/private/var/folders/1w/zm_1vksn3y7gn127bkwt841w0000gn/T/abc.h9FdreF1/)
|
|
||||||
[info] Reapplying settings...
|
[info] Reapplying settings...
|
||||||
[info] Set current project to default-30ae78 (in build file:/private/var/folders/1w/zm_1vksn3y7gn127bkwt841w0000gn/T/abc.h9FdreF1/)
|
[info] Set current project to default-71999b (in build file:/Users/paulp/Desktop/new/)
|
||||||
Setting version to 2.10.0-SNAPSHOT
|
Setting version to 2.10.0-SNAPSHOT
|
||||||
[info] Set current project to default-30ae78 (in build file:/private/var/folders/1w/zm_1vksn3y7gn127bkwt841w0000gn/T/abc.h9FdreF1/)
|
[info] Set current project to default-71999b (in build file:/Users/paulp/Desktop/new/)
|
||||||
Getting Scala 2.10.0-SNAPSHOT ...
|
[info] This is sbt 0.11.3-20111207-052114
|
||||||
:: retrieving :: org.scala-tools.sbt#boot-scala
|
[info] The current project is {file:/Users/paulp/Desktop/new/}default-71999b
|
||||||
confs: [default]
|
|
||||||
4 artifacts copied, 0 already retrieved (20650kB/58ms)
|
|
||||||
[info] This is sbt 0.11.0-20110825-052147
|
|
||||||
[info] The current project is {file:/private/var/folders/1w/zm_1vksn3y7gn127bkwt841w0000gn/T/abc.h9FdreF1/}default-30ae78
|
|
||||||
[info] The current project is built against Scala 2.10.0-SNAPSHOT
|
[info] The current project is built against Scala 2.10.0-SNAPSHOT
|
||||||
[info] sbt, sbt plugins, and build definitions are using Scala 2.9.1.RC4
|
[info] sbt, sbt plugins, and build definitions are using Scala 2.9.1
|
||||||
[info] All logging output for this session is available at /var/folders/1w/zm_1vksn3y7gn127bkwt841w0000gn/T/sbt8625229869994477318.log
|
|
||||||
|
|
||||||
|
|
||||||
Current -help output:
|
Current -help output:
|
||||||
|
|
||||||
|
|
@ -72,6 +49,10 @@ Current -help output:
|
||||||
-sbt-dir <path> path to global settings/plugins directory (default: ~/.sbt)
|
-sbt-dir <path> path to global settings/plugins directory (default: ~/.sbt)
|
||||||
-sbt-boot <path> path to shared boot directory (default: ~/.sbt/boot in 0.11 series)
|
-sbt-boot <path> path to shared boot directory (default: ~/.sbt/boot in 0.11 series)
|
||||||
-ivy <path> path to local Ivy repository (default: ~/.ivy2)
|
-ivy <path> path to local Ivy repository (default: ~/.ivy2)
|
||||||
|
-mem <integer> set memory options (default: 1536, which is -Xms1536m -Xmx1536m -XX:MaxPermSize=384m -XX:ReservedCodeCacheSize=192m)
|
||||||
|
-no-share use all local caches; no sharing
|
||||||
|
-offline put sbt in offline mode
|
||||||
|
-jvm-debug <port> Turn on JVM debugging, open at the given port.
|
||||||
|
|
||||||
# sbt version (default: from project/build.properties if present, else latest release)
|
# sbt version (default: from project/build.properties if present, else latest release)
|
||||||
-sbt-version <version> use the specified version of sbt
|
-sbt-version <version> use the specified version of sbt
|
||||||
|
|
@ -80,18 +61,18 @@ Current -help output:
|
||||||
-sbt-snapshot use a snapshot version of sbt
|
-sbt-snapshot use a snapshot version of sbt
|
||||||
|
|
||||||
# scala version (default: latest release)
|
# scala version (default: latest release)
|
||||||
-28 use 2.8.1
|
-28 use 2.8.2
|
||||||
-29 use 2.9.1
|
-29 use 2.9.1
|
||||||
-210 use 2.10.0-SNAPSHOT
|
-210 use 2.10.0-SNAPSHOT
|
||||||
-scala-home <path> use the scala build at the specified directory
|
-scala-home <path> use the scala build at the specified directory
|
||||||
-scala-version <version> use the specified version of scala
|
-scala-version <version> use the specified version of scala
|
||||||
|
|
||||||
# java version (default: java from PATH, currently java version "1.6.0_26")
|
# java version (default: java from PATH, currently java version "1.6.0_29")
|
||||||
-java-home <path> alternate JAVA_HOME
|
-java-home <path> alternate JAVA_HOME
|
||||||
|
|
||||||
# jvm options and output control
|
# jvm options and output control
|
||||||
JAVA_OPTS environment variable, if unset uses "-Dfile.encoding=UTF8"
|
JAVA_OPTS environment variable, if unset uses "-Dfile.encoding=UTF8"
|
||||||
SBT_OPTS environment variable, if unset uses "-XX:+CMSClassUnloadingEnabled -XX:MaxPermSize=512m -Xms1536m -Xmx1536m -Xss2m"
|
SBT_OPTS environment variable, if unset uses "-XX:+CMSClassUnloadingEnabled"
|
||||||
.sbtopts if this file exists in the sbt root, it is prepended to the runner args
|
.sbtopts if this file exists in the sbt root, it is prepended to the runner args
|
||||||
-Dkey=val pass -Dkey=val directly to the java runtime
|
-Dkey=val pass -Dkey=val directly to the java runtime
|
||||||
-J-X pass option -X directly to the java runtime (-J is stripped)
|
-J-X pass option -X directly to the java runtime (-J is stripped)
|
||||||
|
|
@ -99,7 +80,6 @@ Current -help output:
|
||||||
In the case of duplicated or conflicting options, the order above
|
In the case of duplicated or conflicting options, the order above
|
||||||
shows precedence: JAVA_OPTS lowest, command line options highest.
|
shows precedence: JAVA_OPTS lowest, command line options highest.
|
||||||
|
|
||||||
|
|
||||||
## SBT Extra plugin
|
## SBT Extra plugin
|
||||||
|
|
||||||
To see the plugin in action, including the thrilling custom sbt command "help-names":
|
To see the plugin in action, including the thrilling custom sbt command "help-names":
|
||||||
|
|
|
||||||
82
sbt
82
sbt
|
|
@ -75,6 +75,7 @@ unset verbose debug
|
||||||
# pull -J and -D options to give to java.
|
# pull -J and -D options to give to java.
|
||||||
declare -a residual_args
|
declare -a residual_args
|
||||||
declare -a java_args
|
declare -a java_args
|
||||||
|
declare -a scalac_args
|
||||||
declare -a sbt_commands
|
declare -a sbt_commands
|
||||||
|
|
||||||
build_props_sbt () {
|
build_props_sbt () {
|
||||||
|
|
@ -118,9 +119,12 @@ execRunner () {
|
||||||
echoerr () {
|
echoerr () {
|
||||||
echo 1>&2 "$@"
|
echo 1>&2 "$@"
|
||||||
}
|
}
|
||||||
dlog () {
|
vlog () {
|
||||||
[[ $verbose || $debug ]] && echoerr "$@"
|
[[ $verbose || $debug ]] && echoerr "$@"
|
||||||
}
|
}
|
||||||
|
dlog () {
|
||||||
|
[[ $debug ]] && echoerr "$@"
|
||||||
|
}
|
||||||
|
|
||||||
sbtjar_07_url () {
|
sbtjar_07_url () {
|
||||||
echo "http://simple-build-tool.googlecode.com/files/sbt-launch-${1}.jar"
|
echo "http://simple-build-tool.googlecode.com/files/sbt-launch-${1}.jar"
|
||||||
|
|
@ -225,6 +229,7 @@ Usage: $script_name [options]
|
||||||
-mem <integer> set memory options (default: $sbt_mem, which is $(get_mem_opts $sbt_mem))
|
-mem <integer> set memory options (default: $sbt_mem, which is $(get_mem_opts $sbt_mem))
|
||||||
-no-share use all local caches; no sharing
|
-no-share use all local caches; no sharing
|
||||||
-offline put sbt in offline mode
|
-offline put sbt in offline mode
|
||||||
|
-jvm-debug <port> Turn on JVM debugging, open at the given port.
|
||||||
|
|
||||||
# sbt version (default: from project/build.properties if present, else latest release)
|
# sbt version (default: from project/build.properties if present, else latest release)
|
||||||
-sbt-version <version> use the specified version of sbt
|
-sbt-version <version> use the specified version of sbt
|
||||||
|
|
@ -248,6 +253,7 @@ Usage: $script_name [options]
|
||||||
.sbtopts if this file exists in the sbt root, it is prepended to the runner args
|
.sbtopts if this file exists in the sbt root, it is prepended to the runner args
|
||||||
-Dkey=val pass -Dkey=val directly to the java runtime
|
-Dkey=val pass -Dkey=val directly to the java runtime
|
||||||
-J-X pass option -X directly to the java runtime (-J is stripped)
|
-J-X pass option -X directly to the java runtime (-J is stripped)
|
||||||
|
-S-X add -X to sbt's scalacOptions (-J is stripped)
|
||||||
|
|
||||||
In the case of duplicated or conflicting options, the order above
|
In the case of duplicated or conflicting options, the order above
|
||||||
shows precedence: JAVA_OPTS lowest, command line options highest.
|
shows precedence: JAVA_OPTS lowest, command line options highest.
|
||||||
|
|
@ -262,6 +268,10 @@ addSbt () {
|
||||||
dlog "[addSbt] arg = '$1'"
|
dlog "[addSbt] arg = '$1'"
|
||||||
sbt_commands=( "${sbt_commands[@]}" "$1" )
|
sbt_commands=( "${sbt_commands[@]}" "$1" )
|
||||||
}
|
}
|
||||||
|
addScalac () {
|
||||||
|
dlog "[addScalac] arg = '$1'"
|
||||||
|
scalac_args=( "${scalac_args[@]}" "$1" )
|
||||||
|
}
|
||||||
addResidual () {
|
addResidual () {
|
||||||
dlog "[residual] arg = '$1'"
|
dlog "[residual] arg = '$1'"
|
||||||
residual_args=( "${residual_args[@]}" "$1" )
|
residual_args=( "${residual_args[@]}" "$1" )
|
||||||
|
|
@ -269,44 +279,59 @@ addResidual () {
|
||||||
addResolver () {
|
addResolver () {
|
||||||
addSbt "set resolvers in ThisBuild += $1"
|
addSbt "set resolvers in ThisBuild += $1"
|
||||||
}
|
}
|
||||||
|
unset addedSnapshotRepo
|
||||||
addSnapshotRepo () {
|
addSnapshotRepo () {
|
||||||
addResolver "ScalaToolsSnapshots"
|
[[ -n "$addedSnapshotRepo" ]] || addResolver "ScalaToolsSnapshots" && addedSnapshotRepo=true
|
||||||
|
}
|
||||||
|
addDebugger () {
|
||||||
|
addJava "-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=$1"
|
||||||
}
|
}
|
||||||
|
|
||||||
process_args ()
|
process_args ()
|
||||||
{
|
{
|
||||||
|
require_arg () {
|
||||||
|
local type="$1"
|
||||||
|
local opt="$2"
|
||||||
|
local arg="$3"
|
||||||
|
|
||||||
|
if [[ -z "$arg" ]] || [[ "${arg:0:1}" == "-" ]]; then
|
||||||
|
die "$opt requires <$type> argument"
|
||||||
|
fi
|
||||||
|
}
|
||||||
while [[ $# -gt 0 ]]; do
|
while [[ $# -gt 0 ]]; do
|
||||||
case "$1" in
|
case "$1" in
|
||||||
-h|-help) usage; exit 1 ;;
|
-h|-help) usage; exit 1 ;;
|
||||||
-v|-verbose) verbose=1; shift ;;
|
-v|-verbose) verbose=1 && shift ;;
|
||||||
-d|-debug) debug=1; shift ;;
|
-d|-debug) debug=1 && shift ;;
|
||||||
# -u|-upgrade) addSbt 'set sbt.version 0.7.7' ; addSbt reload ; shift ;;
|
# -u|-upgrade) addSbt 'set sbt.version 0.7.7' ; addSbt reload && shift ;;
|
||||||
|
|
||||||
-ivy) addJava "-Dsbt.ivy.home=$2"; shift 2 ;;
|
-ivy) require_arg path "$1" "$2" && addJava "-Dsbt.ivy.home=$2" && shift 2 ;;
|
||||||
-mem) sbt_mem="$2"; shift 2 ;;
|
-mem) require_arg integer "$1" "$2" && sbt_mem="$2" && shift 2 ;;
|
||||||
-no-colors) addJava "-Dsbt.log.noformat=true"; shift ;;
|
-no-colors) addJava "-Dsbt.log.noformat=true" && shift ;;
|
||||||
-no-share) addJava "$noshare_opts"; shift ;;
|
-no-share) addJava "$noshare_opts" && shift ;;
|
||||||
-sbt-boot) addJava "-Dsbt.boot.directory=$2"; shift 2 ;;
|
-sbt-boot) require_arg path "$1" "$2" && addJava "-Dsbt.boot.directory=$2" && shift 2 ;;
|
||||||
-sbt-dir) addJava "-Dsbt.global.base=$2"; shift 2 ;;
|
-sbt-dir) require_arg path "$1" "$2" && addJava "-Dsbt.global.base=$2" && shift 2 ;;
|
||||||
-debug-inc) addJava "-Dxsbt.inc.debug=true"; shift ;;
|
-debug-inc) addJava "-Dxsbt.inc.debug=true" && shift ;;
|
||||||
-offline) addSbt "set offline := true"; shift ;;
|
-offline) addSbt "set offline := true" && shift ;;
|
||||||
|
-jvm-debug) require_arg port "$1" "$2" && addDebugger $2 && shift 2 ;;
|
||||||
|
|
||||||
-sbt-create) sbt_create=true; shift ;;
|
-sbt-create) sbt_create=true && shift ;;
|
||||||
-sbt-rc) [[ -n "$sbt_rc_version" ]] || die "no sbt RC candidate defined."; sbt_version=$sbt_rc_version; shift ;;
|
-sbt-rc) [[ -n "$sbt_rc_version" ]] || die "no sbt RC candidate defined."; sbt_version=$sbt_rc_version && shift ;;
|
||||||
-sbt-snapshot) addSnapshotRepo ; sbt_version=$sbt_snapshot_version; shift ;;
|
-sbt-snapshot) addSnapshotRepo ; sbt_version=$sbt_snapshot_version && shift ;;
|
||||||
-sbt-jar) sbt_jar="$2"; shift 2 ;;
|
-sbt-jar) require_arg path "$1" "$2" && sbt_jar="$2" && shift 2 ;;
|
||||||
-sbt-version) sbt_version="$2"; shift 2 ;;
|
-sbt-version) require_arg version "$1" "$2" && sbt_version="$2" && shift 2 ;;
|
||||||
-scala-version) addSbt "++ $2"; shift 2 ;;
|
-scala-version) require_arg version "$1" "$2" && addSbt "++ $2" && shift 2 ;;
|
||||||
-scala-home) addSbt "set scalaHome in ThisBuild := Some(file(\"$2\"))"; shift 2 ;;
|
-scala-home) require_arg path "$1" "$2" && addSbt "set scalaHome in ThisBuild := Some(file(\"$2\"))" && shift 2 ;;
|
||||||
-java-home) java_cmd="$2/bin/java"; shift 2 ;;
|
-java-home) require_arg path "$1" "$2" && java_cmd="$2/bin/java" && shift 2 ;;
|
||||||
|
|
||||||
-D*) addJava "$1"; shift ;;
|
-D*) addJava "$1" && shift ;;
|
||||||
-J*) addJava "${1:2}"; shift ;;
|
-J*) addJava "${1:2}" && shift ;;
|
||||||
-28) addSbt "++ $latest_28"; shift ;;
|
-S*) addScalac "${1:2}" && shift ;;
|
||||||
-29) addSbt "++ $latest_29"; shift ;;
|
-28) addSbt "++ $latest_28" && shift ;;
|
||||||
-210) addSnapshotRepo ; addSbt "++ $latest_210"; shift ;;
|
-29) addSbt "++ $latest_29" && shift ;;
|
||||||
|
-210) addSnapshotRepo ; addSbt "++ $latest_210" && shift ;;
|
||||||
|
|
||||||
*) addResidual "$1"; shift ;;
|
*) addResidual "$1" && shift ;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
@ -331,6 +356,9 @@ process_args "$@"
|
||||||
set -- "${residual_args[@]}"
|
set -- "${residual_args[@]}"
|
||||||
argumentCount=$#
|
argumentCount=$#
|
||||||
|
|
||||||
|
# set scalacOptions if we were given any -S opts
|
||||||
|
[[ ${#scalac_args[@]} -eq 0 ]] || addSbt "set scalacOptions in ThisBuild += \"${scalac_args[@]}\""
|
||||||
|
|
||||||
# figure out the version
|
# figure out the version
|
||||||
[[ "$sbt_version" ]] || sbt_version=$(build_props_sbt)
|
[[ "$sbt_version" ]] || sbt_version=$(build_props_sbt)
|
||||||
[[ "$sbt_version" = *-SNAPSHOT* || "$sbt_version" = *-RC* ]] && sbt_snapshot=1
|
[[ "$sbt_version" = *-SNAPSHOT* || "$sbt_version" = *-RC* ]] && sbt_snapshot=1
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue