|
3 | 3 | # A more capable sbt runner, coincidentally also called sbt.
|
4 | 4 | # Author: Paul Phillips <[email protected]>
|
5 | 5 | # https://github.com/paulp/sbt-extras
|
| 6 | +# |
| 7 | +# Generated from http://www.opensource.org/licenses/bsd-license.php |
| 8 | +# Copyright (c) 2011, Paul Phillips. All rights reserved. |
| 9 | +# |
| 10 | +# Redistribution and use in source and binary forms, with or without |
| 11 | +# modification, are permitted provided that the following conditions are |
| 12 | +# met: |
| 13 | +# |
| 14 | +# * Redistributions of source code must retain the above copyright |
| 15 | +# notice, this list of conditions and the following disclaimer. |
| 16 | +# * Redistributions in binary form must reproduce the above copyright |
| 17 | +# notice, this list of conditions and the following disclaimer in the |
| 18 | +# documentation and/or other materials provided with the distribution. |
| 19 | +# * Neither the name of the author nor the names of its contributors |
| 20 | +# may be used to endorse or promote products derived from this software |
| 21 | +# without specific prior written permission. |
| 22 | +# |
| 23 | +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 24 | +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 25 | +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 26 | +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 27 | +# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 28 | +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED |
| 29 | +# TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
| 30 | +# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF |
| 31 | +# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
| 32 | +# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
| 33 | +# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
6 | 34 |
|
7 | 35 | set -o pipefail
|
8 | 36 |
|
9 |
| -declare -r sbt_release_version="1.3.10" |
10 |
| -declare -r sbt_unreleased_version="1.3.10" |
| 37 | +declare -r sbt_release_version="1.3.13" |
| 38 | +declare -r sbt_unreleased_version="1.4.0-RC1" |
11 | 39 |
|
12 |
| -declare -r latest_213="2.13.2" |
13 |
| -declare -r latest_212="2.12.10" |
| 40 | +declare -r latest_213="2.13.3" |
| 41 | +declare -r latest_212="2.12.12" |
14 | 42 | declare -r latest_211="2.11.12"
|
15 | 43 | declare -r latest_210="2.10.7"
|
16 | 44 | declare -r latest_29="2.9.3"
|
@@ -99,6 +127,7 @@ init_default_option_file() {
|
99 | 127 | }
|
100 | 128 |
|
101 | 129 | sbt_opts_file="$(init_default_option_file SBT_OPTS .sbtopts)"
|
| 130 | +sbtx_opts_file="$(init_default_option_file SBTX_OPTS .sbtxopts)" |
102 | 131 | jvm_opts_file="$(init_default_option_file JVM_OPTS .jvmopts)"
|
103 | 132 |
|
104 | 133 | build_props_sbt() {
|
@@ -411,6 +440,12 @@ are not special.
|
411 | 440 | Note: "@"-file is overridden by local '.sbtopts' or '-sbt-opts' argument.
|
412 | 441 | -sbt-opts <path> file containing sbt args (if not given, .sbtopts in project root is used if present)
|
413 | 442 | -S-X add -X to sbt's scalacOptions (-S is stripped)
|
| 443 | +
|
| 444 | + # passing options exclusively to this runner |
| 445 | + SBTX_OPTS environment variable holding either the sbt-extras args directly, or |
| 446 | + the reference to a file containing sbt-extras args if given path is prepended by '@' (e.g. '@/etc/sbtxopts') |
| 447 | + Note: "@"-file is overridden by local '.sbtxopts' or '-sbtx-opts' argument. |
| 448 | + -sbtx-opts <path> file containing sbt-extras args (if not given, .sbtxopts in project root is used if present) |
414 | 449 | EOM
|
415 | 450 | exit 0
|
416 | 451 | }
|
@@ -467,6 +502,7 @@ process_args() {
|
467 | 502 | -scala-home) require_arg path "$1" "$2" && setThisBuild scalaHome "_root_.scala.Some(file(\"$2\"))" && shift 2 ;;
|
468 | 503 | -java-home) require_arg path "$1" "$2" && setJavaHome "$2" && shift 2 ;;
|
469 | 504 | -sbt-opts) require_arg path "$1" "$2" && sbt_opts_file="$2" && shift 2 ;;
|
| 505 | + -sbtx-opts) require_arg path "$1" "$2" && sbtx_opts_file="$2" && shift 2 ;; |
470 | 506 | -jvm-opts) require_arg path "$1" "$2" && jvm_opts_file="$2" && shift 2 ;;
|
471 | 507 |
|
472 | 508 | -D*) addJava "$1" && shift ;;
|
@@ -504,6 +540,18 @@ else
|
504 | 540 | vlog "No extra sbt options have been defined"
|
505 | 541 | fi
|
506 | 542 |
|
| 543 | +# if there are file/environment sbtx_opts, process again so we |
| 544 | +# can supply args to this runner |
| 545 | +if [[ -r "$sbtx_opts_file" ]]; then |
| 546 | + vlog "Using sbt options defined in file $sbtx_opts_file" |
| 547 | + while read -r opt; do extra_sbt_opts+=("$opt"); done < <(readConfigFile "$sbtx_opts_file") |
| 548 | +elif [[ -n "$SBTX_OPTS" && ! ("$SBTX_OPTS" =~ ^@.*) ]]; then |
| 549 | + vlog "Using sbt options defined in variable \$SBTX_OPTS" |
| 550 | + IFS=" " read -r -a extra_sbt_opts <<<"$SBTX_OPTS" |
| 551 | +else |
| 552 | + vlog "No extra sbt options have been defined" |
| 553 | +fi |
| 554 | + |
507 | 555 | [[ -n "${extra_sbt_opts[*]}" ]] && process_args "${extra_sbt_opts[@]}"
|
508 | 556 |
|
509 | 557 | # reset "$@" to the residual args
|
|
0 commit comments