forked from deeplearning4j/deeplearning4j
-
Notifications
You must be signed in to change notification settings - Fork 0
/
buildmultiplescalaversions.sh
executable file
·63 lines (57 loc) · 1.79 KB
/
buildmultiplescalaversions.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#! /bin/bash
BASEDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
function echoError() {
(>&2 echo "$1")
}
function sparkError() {
echoError "Changing Spark major version to 2 in the build did not change the state of your working copy, is Spark 1.x still the default ?"
exit 2
}
function scalaError() {
echoError "Changing Scala major version to 2.10 in the build did not change the state of your working copy, is Scala 2.11 still the default ?"
exit 2
}
function whatchanged() {
cd "$BASEDIR"
for i in $(git status -s --porcelain -- $(find ./ -mindepth 2 -name pom.xml)|awk '{print $2}'); do
echo "$(dirname $i)"
cd "$BASEDIR"
done
}
function beep(){ echo -e '\a';}
set -eu
./change-scala-versions.sh 2.11
./change-spark-versions.sh 1 # should be idempotent, this is the default
mvn "$@"
./change-spark-versions.sh 2
if [ -z "$(whatchanged)" ]; then
sparkError;
else
if [[ "${@#-pl}" = "$@" ]]; then
mvn -Dmaven.clean.skip=true -pl $(whatchanged| tr '\n' ',') -amd "$@"
else
# the arguments already tweak the project list ! don't tweak them more
# as this can lead to conflicts (excluding a project that's not part of
# the reactor)
mvn "$@"
fi
fi
./change-scala-versions.sh 2.10
./change-spark-versions.sh 1
if [ -z "$(whatchanged)" ]; then
scalaError;
else
if [[ "${@#-pl}" = "$@" ]]; then
mvn -Dmaven.clean.skip=true -pl $(whatchanged| tr '\n' ',') -amd "$@"
else
# the arguments already tweak the project list ! don't tweak them more
# as this can lead to conflicts (excluding a project that's not part of
# the reactor)
mvn "$@"
fi
fi
./change-scala-versions.sh 2.11 # back to the default
# notify user the build is done
beep
sleep 1; beep
sleep 1; beep