author | wenzelm |
Tue, 24 Jul 2012 12:28:20 +0200 | |
changeset 48469 | 826a771cff33 |
parent 48459 | 375e45df6fdf |
child 48474 | 5b9d79c6323b |
permissions | -rwxr-xr-x |
48276 | 1 |
#!/usr/bin/env bash |
2 |
# |
|
3 |
# Author: Makarius |
|
4 |
# |
|
5 |
# DESCRIPTION: build and manage Isabelle sessions |
|
6 |
||
7 |
||
8 |
## diagnostics |
|
9 |
||
10 |
PRG="$(basename "$0")" |
|
11 |
||
12 |
function usage() |
|
13 |
{ |
|
14 |
echo |
|
15 |
echo "Usage: isabelle $PRG [OPTIONS] [SESSIONS ...]" |
|
16 |
echo |
|
17 |
echo " Options are:" |
|
18 |
echo " -a all sessions" |
|
19 |
echo " -b build target images" |
|
48340
6f4fc030882a
allow explicit specification of additional session directories;
wenzelm
parents:
48276
diff
changeset
|
20 |
echo " -d DIR additional session directory with ROOT file" |
48425 | 21 |
echo " -j INT maximum number of jobs (default 1)" |
48469 | 22 |
echo " -n no build -- test dependencies only" |
48276 | 23 |
echo " -o OPTION override session configuration OPTION (via NAME=VAL or NAME)" |
48447
ef600ce4559c
added system build mode: produce output in ISABELLE_HOME;
wenzelm
parents:
48425
diff
changeset
|
24 |
echo " -s system build mode: produce output in ISABELLE_HOME" |
48459
375e45df6fdf
timing is command line options, not system option;
wenzelm
parents:
48447
diff
changeset
|
25 |
echo " -t inner session timing" |
48425 | 26 |
echo " -v verbose" |
48276 | 27 |
echo |
28 |
echo " Build and manage Isabelle sessions, depending on implicit" |
|
29 |
echo " ISABELLE_BUILD_OPTIONS=\"$ISABELLE_BUILD_OPTIONS\"" |
|
30 |
echo |
|
31 |
echo " ML_PLATFORM=\"$ML_PLATFORM\"" |
|
32 |
echo " ML_HOME=\"$ML_HOME\"" |
|
33 |
echo " ML_SYSTEM=\"$ML_SYSTEM\"" |
|
34 |
echo " ML_OPTIONS=\"$ML_OPTIONS\"" |
|
35 |
echo |
|
36 |
exit 1 |
|
37 |
} |
|
38 |
||
39 |
function fail() |
|
40 |
{ |
|
41 |
echo "$1" >&2 |
|
42 |
exit 2 |
|
43 |
} |
|
44 |
||
48425 | 45 |
function check_number() |
46 |
{ |
|
47 |
[ -n "$1" -a -z "$(echo "$1" | tr -d '[0-9]')" ] || fail "Bad number: \"$1\"" |
|
48 |
} |
|
49 |
||
48276 | 50 |
|
51 |
## process command line |
|
52 |
||
53 |
ALL_SESSIONS=false |
|
54 |
BUILD_IMAGES=false |
|
48425 | 55 |
MAX_JOBS=1 |
48469 | 56 |
NO_BUILD=false |
48447
ef600ce4559c
added system build mode: produce output in ISABELLE_HOME;
wenzelm
parents:
48425
diff
changeset
|
57 |
SYSTEM_MODE=false |
48459
375e45df6fdf
timing is command line options, not system option;
wenzelm
parents:
48447
diff
changeset
|
58 |
TIMING=false |
48425 | 59 |
VERBOSE=false |
48276 | 60 |
|
48340
6f4fc030882a
allow explicit specification of additional session directories;
wenzelm
parents:
48276
diff
changeset
|
61 |
declare -a MORE_DIRS=() |
48276 | 62 |
eval "declare -a BUILD_OPTIONS=($ISABELLE_BUILD_OPTIONS)" |
63 |
||
48469 | 64 |
while getopts "abd:j:no:stv" OPT |
48276 | 65 |
do |
66 |
case "$OPT" in |
|
67 |
a) |
|
68 |
ALL_SESSIONS="true" |
|
69 |
;; |
|
70 |
b) |
|
71 |
BUILD_IMAGES="true" |
|
72 |
;; |
|
48340
6f4fc030882a
allow explicit specification of additional session directories;
wenzelm
parents:
48276
diff
changeset
|
73 |
d) |
6f4fc030882a
allow explicit specification of additional session directories;
wenzelm
parents:
48276
diff
changeset
|
74 |
MORE_DIRS["${#MORE_DIRS[@]}"]="$OPTARG" |
6f4fc030882a
allow explicit specification of additional session directories;
wenzelm
parents:
48276
diff
changeset
|
75 |
;; |
48425 | 76 |
j) |
77 |
check_number "$OPTARG" |
|
78 |
MAX_JOBS="$OPTARG" |
|
79 |
;; |
|
48469 | 80 |
n) |
81 |
NO_BUILD="true" |
|
48276 | 82 |
;; |
83 |
o) |
|
84 |
BUILD_OPTIONS["${#BUILD_OPTIONS[@]}"]="$OPTARG" |
|
85 |
;; |
|
48447
ef600ce4559c
added system build mode: produce output in ISABELLE_HOME;
wenzelm
parents:
48425
diff
changeset
|
86 |
s) |
ef600ce4559c
added system build mode: produce output in ISABELLE_HOME;
wenzelm
parents:
48425
diff
changeset
|
87 |
SYSTEM_MODE="true" |
ef600ce4559c
added system build mode: produce output in ISABELLE_HOME;
wenzelm
parents:
48425
diff
changeset
|
88 |
;; |
48459
375e45df6fdf
timing is command line options, not system option;
wenzelm
parents:
48447
diff
changeset
|
89 |
t) |
375e45df6fdf
timing is command line options, not system option;
wenzelm
parents:
48447
diff
changeset
|
90 |
TIMING="true" |
375e45df6fdf
timing is command line options, not system option;
wenzelm
parents:
48447
diff
changeset
|
91 |
;; |
48425 | 92 |
v) |
93 |
VERBOSE="true" |
|
94 |
;; |
|
48276 | 95 |
\?) |
96 |
usage |
|
97 |
;; |
|
98 |
esac |
|
99 |
done |
|
100 |
||
101 |
shift $(($OPTIND - 1)) |
|
102 |
||
103 |
||
104 |
## main |
|
105 |
||
106 |
[ -e "$ISABELLE_HOME/Admin/build" ] && { "$ISABELLE_HOME/Admin/build" jars || exit $?; } |
|
107 |
||
108 |
exec "$ISABELLE_TOOL" java isabelle.Build \ |
|
48469 | 109 |
"$ALL_SESSIONS" "$BUILD_IMAGES" "$MAX_JOBS" "$NO_BUILD" "$SYSTEM_MODE" "$TIMING" \ |
48459
375e45df6fdf
timing is command line options, not system option;
wenzelm
parents:
48447
diff
changeset
|
110 |
"$VERBOSE" "${MORE_DIRS[@]}" $'\n' "${BUILD_OPTIONS[@]}" $'\n' "$@" |