forked from Shoury/aesop
-
Notifications
You must be signed in to change notification settings - Fork 0
/
run
executable file
·77 lines (68 loc) · 2.05 KB
/
run
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
#!/bin/bash
function info() {
echo -e "\033[1;34m[INFO] \033[0m$@"
}
function warn() {
echo -e "\033[1;33m[WARN] \033[0m$@"
}
function error() {
echo -e "\033[0;31m[ERROR] \033[0m$@"
popd &> /dev/null || true
exit 1
}
while getopts "b:m:v:j:" opt; do
case $opt in
b) build_modules=$OPTARG;;
m) run_module=$OPTARG;;
v) version=$OPTARG;;
j) jmx_port=$OPTARG;;
?) error "Invalid option: $OPTARG";;
esac
done
if [ -z "$run_module" ]; then
error "Usage: $0 -m <module-to-run> [-b <modules-to-build> -v <version> -j <jmx-port>]"
fi
if [ ! -d "$run_module" ]; then
error "Invalid module specified: $run_module"
fi
# determine version
if [ -z "$version" ]; then
version=$(cat $run_module/pom.xml | grep '<version>' | head -1 | egrep -o "[0-9.]+")
fi
if [ -z "$version" ]; then
error "Could not determine version"
else
info "Version is $version"
fi
# build the build modules
if [ ! -z "$build_modules" ]; then
for module in $(echo $build_modules | tr ',' ' '); do
if [ ! -d "$module" ]; then
warn "Invalid module specified for build: $module"
else
info "Building module $module ..."
pushd $module &> /dev/null
mvn clean install> /tmp/aesop_${module}_build.log
if [ $? -ne 0 ]; then
cat /tmp/aesop_${module}_build.log | grep ERROR
error "Build failed for module: $module (Full log at /tmp/aesop_${module}_build.log)"
fi
popd &> /dev/null
if [ "$module" != "$run_module" ]; then
cp $module/target/*.jar $run_module/target/lib/
fi
info "DONE"
fi
done
fi
# determine jmx port
if [ ! -z "$jmx_port" ]; then
info "JMX port is $jmx_port"
JMX_PARAMS='-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=9010 -Dcom.sun.management.jmxremote.local.only=false -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false'
else
JMX_PARAMS=''
fi
# run command
info "Running module $run_module"
java $JMX_PARAMS -cp "$run_module/target/*:$run_module/target/lib/*" org.trpr.platform.runtime.impl.bootstrap.BootstrapLauncher $run_module/src/main/resources/external/bootstrap.xml
info "Exiting"