Skip to content

Commit 53ef5de

Browse files
committed
Remove code duplication in scripts
1 parent e3a3f89 commit 53ef5de

File tree

3 files changed

+7
-23
lines changed

3 files changed

+7
-23
lines changed

project/scripts/genDocs

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,9 @@ fi
1616

1717
echo "Working directory: $PWD"
1818

19-
# get the ivy2 cache
20-
ln -s /var/cache/drone/ivy2 "$HOME/.ivy2"
21-
2219
# this command will generate docs in $PWD/docs/_site
23-
sbt -J-Xmx4096m \
24-
-J-XX:ReservedCodeCacheSize=512m \
25-
-J-XX:MaxMetaspaceSize=1024m \
26-
-Ddotty.drone.mem=4096m \
27-
-ivy /var/cache/drone/ivy2 \
28-
"genDocs"
20+
SBT="$(cd "$(dirname "${BASH_SOURCE[0]}")" >& /dev/null && pwd)/sbt"
21+
eval "$SBT" "genDocs"
2922

3023
# make sure that the previous command actually succeeded
3124
if [ ! -d "$PWD/docs/_site" ]; then

project/scripts/sbt

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,17 @@
33
# Usage:
44
# ./sbt <cmd>
55

6-
set -e
7-
86
CMD="$1"
97

108
if [ -z "$CMD" ]; then
119
echo "Error: missing sbt command"
1210
exit 1
1311
fi
1412

15-
# get the ivy2 cache
16-
ln -s /var/cache/drone/ivy2 "$HOME/.ivy2"
17-
1813
# run sbt with the supplied arg
1914
sbt -J-Xmx4096m \
2015
-J-XX:ReservedCodeCacheSize=512m \
2116
-J-XX:MaxMetaspaceSize=1024m \
22-
-Ddotty.drone.mem=4096m "$CMD"
17+
-Ddotty.drone.mem=4096m \
18+
-ivy /var/cache/drone/ivy2 \
19+
"$CMD"

project/scripts/sbtPublish

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,18 +23,12 @@ if [ -z "$RELEASE_CMD" ]; then
2323
exit 1
2424
fi
2525

26-
# get the ivy2 cache
27-
ln -s /var/cache/drone/ivy2 "$HOME/.ivy2"
28-
2926
CMD=" ;set credentials in ThisBuild := Seq(Credentials(\"Sonatype Nexus Repository Manager\", \"oss.sonatype.org\", \"$2\", \"$3\"))"
3027
CMD="$CMD ;set pgpPassphrase := Some(\"\"\"$4\"\"\".toCharArray)"
3128
CMD="$CMD ;set pgpSecretRing := file(\"/keys/secring.asc\")"
3229
CMD="$CMD ;set pgpPublicRing := file(\"/keys/pubring.asc\")"
3330
CMD="$CMD $RELEASE_CMD"
3431

3532
# run sbt with the supplied arg
36-
sbt -J-Xmx4096m \
37-
-J-XX:ReservedCodeCacheSize=512m \
38-
-J-XX:MaxMetaspaceSize=1024m \
39-
-Ddotty.drone.mem=4096m \
40-
"$CMD"
33+
SBT="$(cd "$(dirname "${BASH_SOURCE[0]}")" >& /dev/null && pwd)/sbt"
34+
eval "$SBT" "$CMD"

0 commit comments

Comments
 (0)