-
Notifications
You must be signed in to change notification settings - Fork 0
/
run_infer_merge.sh
executable file
·65 lines (54 loc) · 1.21 KB
/
run_infer_merge.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
64
65
#!/bin/bash
readonly CLASSPATH_FILE='classpath.out'
readonly TARGET_CLASS='edu.ucsc.linqs.psl.example.infer_merge.InferMerge'
FETCH_COMMAND=''
function err() {
echo "[$(date +'%Y-%m-%dT%H:%M:%S%z')]: $@" >&2
}
# Check for:
# - maven
# - java
function check_requirements() {
type mvn > /dev/null 2> /dev/null
if [[ "$?" -ne 0 ]]; then
err 'maven required to build project'
exit 12
fi
type java > /dev/null 2> /dev/null
if [[ "$?" -ne 0 ]]; then
err 'java required to run project'
exit 13
fi
}
function compile() {
mvn compile
if [[ "$?" -ne 0 ]]; then
err 'Failed to compile'
exit 40
fi
}
function buildClasspath() {
if [ -e "${CLASSPATH_FILE}" ]; then
echo "Classpath found cached, skipping classpath build."
return
fi
mvn dependency:build-classpath -Dmdep.outputFile="${CLASSPATH_FILE}"
if [[ "$?" -ne 0 ]]; then
err 'Failed to build classpath'
exit 50
fi
}
function run() {
java -Xmx57g -d64 -cp ./target/classes:$(cat ${CLASSPATH_FILE}) ${TARGET_CLASS}
if [[ "$?" -ne 0 ]]; then
err 'Failed to run'
exit 60
fi
}
function main() {
check_requirements
compile
buildClasspath
run
}
main "$@"