-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathsequence.sh
executable file
·35 lines (33 loc) · 973 Bytes
/
sequence.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
#!/bin/bash
# Extract SequenceTracer from a log and generate a plant uml sequence graph
# See https://jira.nuxeo.com/browse/NXP-11698 for more info
SEQ_IMG=/tmp/sequence.png
SEQ_LOG=/tmp/sequence.log
PLANT_VERSION=8033
PLANT=~/.m2/repository/net/sourceforge/plantuml/plantuml/$PLANT_VERSION/plantuml-$PLANT_VERSION.jar
if [ $# -eq 0 ]; then
echo >&2 "Expecting a log file"
exit 2
fi
if [ ! -f $1 ]; then
echo >&2 "Invalid log file"
exit 2
fi
set -e
if [ ! -f $PLANT ]; then
echo "Downloading plantuml jar"
mvn -DgroupId=net.sourceforge.plantuml -DartifactId=plantuml -Dversion=$PLANT_VERSION dependency:get
fi
echo "Extracting sequence $LOG from log $1"
rm -f $SEQ_IMG $SEQ_LOG
grep "@@" $1 | sed -u "s/.*\@\@ //" | sed -e '1 i \@startuml' -e '$s@$@\n\@enduml@' > $SEQ_LOG
java -jar $PLANT $SEQ_LOG
if [ -f $SEQ_IMG ]; then
echo "Image created: $SEQ_IMG"
else
echo >&2 "No image generated"
exit 2
fi
if which eog >/dev/null; then
eog $SEQ_IMG
fi