-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild
executable file
·92 lines (78 loc) · 1.76 KB
/
build
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
#!/usr/bin/env bash
basename=`basename $0`
dirname=`dirname $0`
dirname=`cd "$dirname" && pwd`
cd "$dirname"
source ./build.config
# load optional config
if [ -f ./build.rc ]; then
source ./build.rc
fi
# show message and exit
function die {
echo "$1"
exit 1
}
# show usage and exit
function usage {
if [[ -z "$1" ]]; then
echo "usage: $basename <command> [options]"
else
echo "usage: $basename $1"
fi
exit 2
}
# run self
function self {
$0 "$@"
}
if [[ -z "$mvn_options" ]]; then
mvn_options=""
fi
# run maven
function mvn {
./mvnw ${mvn_options} "$@"
}
command="$1"; shift
# complain if no command is given
if [ -z "$command" ]; then
usage
fi
case "$command" in
# change the version of the project
change-version)
newVersion="$1"
if [ -z "$newVersion" ]; then
usage "$command <version>"
fi
mvn org.eclipse.tycho:tycho-versions-plugin:1.2.0:set-version \
-Dartifacts=${project} \
-Dproperties=${project}.version \
-DnewVersion="$newVersion"
;;
# check license headers
license-check)
mvn -f ./pom.xml -N -P -include-private com.mycila:license-maven-plugin:check
if [ -f "private/pom.xml" ]; then
mvn -f private/pom.xml -N com.mycila:license-maven-plugin:check "$@"
fi
;;
# format license headers
license-format)
mvn -f ./pom.xml -N -P -include-private com.mycila:license-maven-plugin:format
if [ -f "private/pom.xml" ]; then
mvn -f private/pom.xml -N com.mycila:license-maven-plugin:format "$@"
fi
;;
*)
# attempt to lookup command function
fn="command_$command"
if [ "$(type -t $fn)" = 'function' ]; then
$fn "$@"
else
# complain about missing command function
echo "Unknown command: $command"
usage
fi
;;
esac