author | wenzelm |
Sat, 05 Feb 2000 16:58:58 +0100 | |
changeset 8197 | baab8e487fad |
parent 7888 | 6e9669c311ae |
child 8218 | 6c4bec5cd2ac |
permissions | -rwxr-xr-x |
3007 | 1 |
#!/bin/bash |
2808 | 2 |
# |
3 |
# $Id$ |
|
4 |
# |
|
5 |
# DESCRIPTION: build object-logic or run examples |
|
6 |
||
7 |
||
8 |
## diagnostics |
|
9 |
||
10 |
PRG=$(basename $0) |
|
11 |
||
12 |
function usage() |
|
13 |
{ |
|
14 |
echo |
|
15 |
echo "Usage: $PRG LOGIC NAME" |
|
16 |
echo |
|
17 |
echo " Options are:" |
|
8197
baab8e487fad
-D PATH: dump generated document sources into PATH;
wenzelm
parents:
7888
diff
changeset
|
18 |
echo " -D PATH dump generated document sources into PATH" |
6940 | 19 |
echo " -P PATH set path for remote theory browsing information" |
6212 | 20 |
echo " -b build mode (output heap image, using current dir)" |
7737 | 21 |
echo " -d FORMAT build document as FORMAT (default false)" |
3747
cd9b6c86926c
There is now one single option -i for generating theory browsing
berghofe
parents:
3636
diff
changeset
|
22 |
echo " -i BOOL generate theory browsing information," |
cd9b6c86926c
There is now one single option -i for generating theory browsing
berghofe
parents:
3636
diff
changeset
|
23 |
echo " i.e. HTML / graph data (default false)" |
6212 | 24 |
echo " -r reset session path" |
2808 | 25 |
echo " -s NAME override session NAME" |
26 |
echo |
|
27 |
echo " Build object-logic or run examples. Also creates browsing" |
|
28 |
echo " information (HTML etc.) according to settings." |
|
29 |
echo |
|
7461 | 30 |
echo " ISABELLE_USEDIR_OPTIONS=$ISABELLE_USEDIR_OPTIONS" |
31 |
echo |
|
2808 | 32 |
exit 1 |
33 |
} |
|
34 |
||
35 |
||
36 |
## process command line |
|
37 |
||
38 |
# options |
|
39 |
||
8197
baab8e487fad
-D PATH: dump generated document sources into PATH;
wenzelm
parents:
7888
diff
changeset
|
40 |
DUMP="" |
baab8e487fad
-D PATH: dump generated document sources into PATH;
wenzelm
parents:
7888
diff
changeset
|
41 |
RPATH="" |
2808 | 42 |
BUILD="" |
7737 | 43 |
DOCUMENT=false |
3747
cd9b6c86926c
There is now one single option -i for generating theory browsing
berghofe
parents:
3636
diff
changeset
|
44 |
INFO=false |
6212 | 45 |
RESET=false |
2808 | 46 |
SESSION="" |
47 |
||
2917 | 48 |
function getoptions() |
49 |
{ |
|
50 |
OPTIND=1 |
|
8197
baab8e487fad
-D PATH: dump generated document sources into PATH;
wenzelm
parents:
7888
diff
changeset
|
51 |
while getopts "D:P:bc:d:i:rs:" OPT |
2917 | 52 |
do |
53 |
case "$OPT" in |
|
8197
baab8e487fad
-D PATH: dump generated document sources into PATH;
wenzelm
parents:
7888
diff
changeset
|
54 |
D) |
baab8e487fad
-D PATH: dump generated document sources into PATH;
wenzelm
parents:
7888
diff
changeset
|
55 |
DUMP="$OPTARG" |
baab8e487fad
-D PATH: dump generated document sources into PATH;
wenzelm
parents:
7888
diff
changeset
|
56 |
;; |
baab8e487fad
-D PATH: dump generated document sources into PATH;
wenzelm
parents:
7888
diff
changeset
|
57 |
P) |
baab8e487fad
-D PATH: dump generated document sources into PATH;
wenzelm
parents:
7888
diff
changeset
|
58 |
RPATH="$OPTARG" |
baab8e487fad
-D PATH: dump generated document sources into PATH;
wenzelm
parents:
7888
diff
changeset
|
59 |
;; |
2917 | 60 |
b) |
61 |
BUILD=true |
|
62 |
;; |
|
7737 | 63 |
d) |
64 |
DOCUMENT="$OPTARG" |
|
65 |
;; |
|
3747
cd9b6c86926c
There is now one single option -i for generating theory browsing
berghofe
parents:
3636
diff
changeset
|
66 |
i) |
cd9b6c86926c
There is now one single option -i for generating theory browsing
berghofe
parents:
3636
diff
changeset
|
67 |
INFO="$OPTARG" |
2917 | 68 |
;; |
6212 | 69 |
r) |
70 |
RESET=true |
|
71 |
;; |
|
2917 | 72 |
s) |
73 |
SESSION="$OPTARG" |
|
74 |
;; |
|
75 |
\?) |
|
76 |
usage |
|
77 |
;; |
|
78 |
esac |
|
79 |
done |
|
80 |
} |
|
2808 | 81 |
|
2917 | 82 |
getoptions $ISABELLE_USEDIR_OPTIONS |
83 |
||
84 |
getoptions "$@" |
|
2808 | 85 |
shift $(($OPTIND - 1)) |
86 |
||
87 |
||
88 |
# args |
|
89 |
||
90 |
[ $# -ne 2 ] && usage |
|
91 |
||
92 |
LOGIC="$1"; shift |
|
93 |
NAME="$1"; shift |
|
94 |
||
4419 | 95 |
[ -z "$SESSION" ] && SESSION=$(basename $NAME) |
2808 | 96 |
|
4419 | 97 |
|
98 |
||
99 |
## main |
|
3636
3f2e55e5bacc
Added some code for generating theory browsing data.
berghofe
parents:
3504
diff
changeset
|
100 |
|
4451 | 101 |
# prepare browser info dir |
4419 | 102 |
|
4586 | 103 |
if [ "$INFO" = "true" -a ! -f $ISABELLE_BROWSER_INFO/index.html ]; then |
4419 | 104 |
|
3747
cd9b6c86926c
There is now one single option -i for generating theory browsing
berghofe
parents:
3636
diff
changeset
|
105 |
mkdir -p $ISABELLE_BROWSER_INFO/gif |
3848 | 106 |
cp $ISABELLE_HOME/lib/logo/isabelle.gif $ISABELLE_BROWSER_INFO/gif/isabelle.gif |
3747
cd9b6c86926c
There is now one single option -i for generating theory browsing
berghofe
parents:
3636
diff
changeset
|
107 |
cp $ISABELLE_HOME/lib/html/index1.html $ISABELLE_BROWSER_INFO/index.html |
4419 | 108 |
|
3636
3f2e55e5bacc
Added some code for generating theory browsing data.
berghofe
parents:
3504
diff
changeset
|
109 |
mkdir -p $ISABELLE_BROWSER_INFO/graph |
3f2e55e5bacc
Added some code for generating theory browsing data.
berghofe
parents:
3504
diff
changeset
|
110 |
cp $ISABELLE_HOME/lib/html/index2.html $ISABELLE_BROWSER_INFO/graph/index.html |
3f2e55e5bacc
Added some code for generating theory browsing data.
berghofe
parents:
3504
diff
changeset
|
111 |
mkdir $ISABELLE_BROWSER_INFO/graph/GraphBrowser |
3f2e55e5bacc
Added some code for generating theory browsing data.
berghofe
parents:
3504
diff
changeset
|
112 |
mkdir $ISABELLE_BROWSER_INFO/graph/awtUtilities |
4419 | 113 |
cp $ISABELLE_HOME/lib/browser/GraphBrowser/*.class $ISABELLE_BROWSER_INFO/graph/GraphBrowser |
114 |
cp $ISABELLE_HOME/lib/browser/awtUtilities/*.class $ISABELLE_BROWSER_INFO/graph/awtUtilities |
|
115 |
||
3636
3f2e55e5bacc
Added some code for generating theory browsing data.
berghofe
parents:
3504
diff
changeset
|
116 |
fi |
3f2e55e5bacc
Added some code for generating theory browsing data.
berghofe
parents:
3504
diff
changeset
|
117 |
|
2808 | 118 |
|
4451 | 119 |
# prepare log dir |
120 |
||
121 |
LOGDIR="$ISABELLE_OUTPUT/log" |
|
122 |
mkdir -p "$LOGDIR" |
|
123 |
||
124 |
||
125 |
# run isabelle |
|
126 |
||
7737 | 127 |
PARENT=$(basename "$LOGIC") |
128 |
||
129 |
[ -z "$BUILD" ] && cd "$NAME" |
|
4451 | 130 |
|
7796 | 131 |
DOC="" |
132 |
[ "$DOCUMENT" != false -a -d document ] && DOC="$DOCUMENT" |
|
7737 | 133 |
|
134 |
||
135 |
SECONDS=0 |
|
6249 | 136 |
|
2808 | 137 |
if [ -n "$BUILD" ]; then |
4451 | 138 |
ITEM="$SESSION" |
7275 | 139 |
echo "Building $ITEM ..." |
4451 | 140 |
LOG="$LOGDIR/$ITEM" |
141 |
||
142 |
$ISABELLE \ |
|
8197
baab8e487fad
-D PATH: dump generated document sources into PATH;
wenzelm
parents:
7888
diff
changeset
|
143 |
-e "Session.use_dir $RESET $INFO \"$DOC\" \"$PARENT\" \"$SESSION\" \"$DUMP\" \"$RPATH\";" \ |
4492 | 144 |
-q -w $LOGIC $NAME > $LOG 2>&1 |
6249 | 145 |
RC=$? |
2808 | 146 |
else |
4451 | 147 |
ITEM=$(basename $LOGIC)-"$SESSION" |
7275 | 148 |
echo "Running $ITEM ..." |
4451 | 149 |
LOG="$LOGDIR/$ITEM" |
150 |
||
151 |
$ISABELLE \ |
|
8197
baab8e487fad
-D PATH: dump generated document sources into PATH;
wenzelm
parents:
7888
diff
changeset
|
152 |
-e "Session.use_dir $RESET $INFO \"$DOC\" \"$PARENT\" \"$SESSION\" \"$DUMP\" \"$RPATH\"; quit();" \ |
4492 | 153 |
-r -q $LOGIC > $LOG 2>&1 |
6249 | 154 |
RC=$? |
6212 | 155 |
cd .. |
2808 | 156 |
fi |
4451 | 157 |
|
158 |
ELAPSED=$($ISABELLE_HOME/lib/scripts/showtime $SECONDS) |
|
159 |
||
160 |
||
161 |
# exit status |
|
162 |
||
163 |
if [ $RC -eq 0 ]; then |
|
7275 | 164 |
echo "Finished $ITEM ($ELAPSED elapsed time)" |
4451 | 165 |
gzip --force "$LOG" |
166 |
else |
|
7259 | 167 |
echo "$ITEM FAILED" |
4451 | 168 |
echo "(see also $LOG)" |
169 |
echo; tail $LOG; echo |
|
170 |
fi |
|
171 |
||
172 |
exit $RC |