-
Notifications
You must be signed in to change notification settings - Fork 0
/
start.sh
executable file
·43 lines (33 loc) · 1.06 KB
/
start.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
#!/usr/bin/env bash
set -euo pipefail
function getSandboxPid(){
ss -lptn 'sport = :7575' | grep -P -o '(?<=pid=)([0-9]+)'
}
function cleanup(){
sandboxPID=$(ss -lptn 'sport = :7575' | grep -P -o '(?<=pid=)([0-9]+)')
if [[ $sandboxPID ]]; then
# kill the sandbox which is running in the background
kill $sandboxPID
fi
}
trap cleanup ERR EXIT
echo "Compiling daml"
daml build
packageId=$(daml damlc inspect-dar --json .daml/dist/ex-java-bindings-0.0.2.dar | jq '.main_package_id' -r)
echo "Generating java code"
daml codegen java
echo "Compiling code"
mvn compile
# Could also run this manually in another terminal without the redirects
echo "Starting sandbox"
daml start --start-navigator false \
--sandbox-port 7600 \
--sandbox-option="-C" \
--sandbox-option="canton.monitoring.tracing.tracer.exporter.type=jaeger" \
> sandbox.log 2>&1 & PID=$!
while [[ "$(getSandboxPid)" -eq '' ]]
do
sleep 1
done
# Run java program
mvn exec:java -Dexec.mainClass=examples.pingpong.codegen.PingPongMain -Dexec.args="localhost 7600"