author | wenzelm |
Tue, 08 Sep 2015 17:34:46 +0200 | |
changeset 61135 | 8f7d802b7a71 |
parent 61131 | 83459eb76fe3 |
child 62589 | b5783412bfed |
permissions | -rwxr-xr-x |
48276 | 1 |
#!/usr/bin/env bash |
2 |
# |
|
3 |
# Author: Makarius |
|
4 |
# |
|
5 |
# DESCRIPTION: build and manage Isabelle sessions |
|
6 |
||
61135
8f7d802b7a71
clarified Java runtime options (NB: ISABELLE_JAVA_PLATFORM is determined later via component);
wenzelm
parents:
61131
diff
changeset
|
7 |
## settings |
8f7d802b7a71
clarified Java runtime options (NB: ISABELLE_JAVA_PLATFORM is determined later via component);
wenzelm
parents:
61131
diff
changeset
|
8 |
|
8f7d802b7a71
clarified Java runtime options (NB: ISABELLE_JAVA_PLATFORM is determined later via component);
wenzelm
parents:
61131
diff
changeset
|
9 |
case "$ISABELLE_JAVA_PLATFORM" in |
8f7d802b7a71
clarified Java runtime options (NB: ISABELLE_JAVA_PLATFORM is determined later via component);
wenzelm
parents:
61131
diff
changeset
|
10 |
x86-*) |
8f7d802b7a71
clarified Java runtime options (NB: ISABELLE_JAVA_PLATFORM is determined later via component);
wenzelm
parents:
61131
diff
changeset
|
11 |
ISABELLE_BUILD_JAVA_OPTIONS="$ISABELLE_BUILD_JAVA_OPTIONS32" |
8f7d802b7a71
clarified Java runtime options (NB: ISABELLE_JAVA_PLATFORM is determined later via component);
wenzelm
parents:
61131
diff
changeset
|
12 |
;; |
8f7d802b7a71
clarified Java runtime options (NB: ISABELLE_JAVA_PLATFORM is determined later via component);
wenzelm
parents:
61131
diff
changeset
|
13 |
x86_64-*) |
8f7d802b7a71
clarified Java runtime options (NB: ISABELLE_JAVA_PLATFORM is determined later via component);
wenzelm
parents:
61131
diff
changeset
|
14 |
ISABELLE_BUILD_JAVA_OPTIONS="$ISABELLE_BUILD_JAVA_OPTIONS64" |
8f7d802b7a71
clarified Java runtime options (NB: ISABELLE_JAVA_PLATFORM is determined later via component);
wenzelm
parents:
61131
diff
changeset
|
15 |
;; |
8f7d802b7a71
clarified Java runtime options (NB: ISABELLE_JAVA_PLATFORM is determined later via component);
wenzelm
parents:
61131
diff
changeset
|
16 |
esac |
8f7d802b7a71
clarified Java runtime options (NB: ISABELLE_JAVA_PLATFORM is determined later via component);
wenzelm
parents:
61131
diff
changeset
|
17 |
|
48276 | 18 |
|
19 |
## diagnostics |
|
20 |
||
21 |
PRG="$(basename "$0")" |
|
22 |
||
48474 | 23 |
function show_settings() |
24 |
{ |
|
25 |
local PREFIX="$1" |
|
26 |
echo "${PREFIX}ISABELLE_BUILD_OPTIONS=\"$ISABELLE_BUILD_OPTIONS\"" |
|
27 |
echo |
|
61131 | 28 |
echo "${PREFIX}ISABELLE_BUILD_JAVA_OPTIONS=\"$ISABELLE_BUILD_JAVA_OPTIONS\"" |
29 |
echo |
|
48474 | 30 |
echo "${PREFIX}ML_PLATFORM=\"$ML_PLATFORM\"" |
31 |
echo "${PREFIX}ML_HOME=\"$ML_HOME\"" |
|
32 |
echo "${PREFIX}ML_SYSTEM=\"$ML_SYSTEM\"" |
|
33 |
echo "${PREFIX}ML_OPTIONS=\"$ML_OPTIONS\"" |
|
34 |
} |
|
35 |
||
48276 | 36 |
function usage() |
37 |
{ |
|
38 |
echo |
|
39 |
echo "Usage: isabelle $PRG [OPTIONS] [SESSIONS ...]" |
|
40 |
echo |
|
41 |
echo " Options are:" |
|
48737
f3bbb9ca57d6
added build option -D: include session directory and select its sessions;
wenzelm
parents:
48601
diff
changeset
|
42 |
echo " -D DIR include session directory and select its sessions" |
49131 | 43 |
echo " -R operate on requirements of selected sessions" |
60106 | 44 |
echo " -X NAME exclude sessions from group NAME and all descendants" |
48570 | 45 |
echo " -a select all sessions" |
48511
37999ee01156
remove old output heaps, to ensure that result is valid wrt. check_stamps;
wenzelm
parents:
48509
diff
changeset
|
46 |
echo " -b build heap images" |
48595 | 47 |
echo " -c clean build" |
48737
f3bbb9ca57d6
added build option -D: include session directory and select its sessions;
wenzelm
parents:
48601
diff
changeset
|
48 |
echo " -d DIR include session directory" |
48570 | 49 |
echo " -g NAME select session group NAME" |
48578 | 50 |
echo " -j INT maximum number of parallel jobs (default 1)" |
59891
9ce697050455
added isabelle build option -k, for fast off-line checking of theory sources;
wenzelm
parents:
59565
diff
changeset
|
51 |
echo " -k KEYWORD check theory sources for conflicts with proposed keywords" |
48903 | 52 |
echo " -l list session source files" |
48469 | 53 |
echo " -n no build -- test dependencies only" |
52056 | 54 |
echo " -o OPTION override Isabelle system OPTION (via NAME=VAL or NAME)" |
48447
ef600ce4559c
added system build mode: produce output in ISABELLE_HOME;
wenzelm
parents:
48425
diff
changeset
|
55 |
echo " -s system build mode: produce output in ISABELLE_HOME" |
48425 | 56 |
echo " -v verbose" |
60106 | 57 |
echo " -x NAME exclude session NAME and all descendants" |
48276 | 58 |
echo |
59 |
echo " Build and manage Isabelle sessions, depending on implicit" |
|
48474 | 60 |
show_settings " " |
48276 | 61 |
echo |
62 |
exit 1 |
|
63 |
} |
|
64 |
||
65 |
function fail() |
|
66 |
{ |
|
67 |
echo "$1" >&2 |
|
68 |
exit 2 |
|
69 |
} |
|
70 |
||
48425 | 71 |
function check_number() |
72 |
{ |
|
73 |
[ -n "$1" -a -z "$(echo "$1" | tr -d '[0-9]')" ] || fail "Bad number: \"$1\"" |
|
74 |
} |
|
75 |
||
48276 | 76 |
|
77 |
## process command line |
|
78 |
||
48737
f3bbb9ca57d6
added build option -D: include session directory and select its sessions;
wenzelm
parents:
48601
diff
changeset
|
79 |
declare -a SELECT_DIRS=() |
49131 | 80 |
REQUIREMENTS=false |
60106 | 81 |
declare -a EXCLUDE_SESSION_GROUPS=() |
48276 | 82 |
ALL_SESSIONS=false |
48511
37999ee01156
remove old output heaps, to ensure that result is valid wrt. check_stamps;
wenzelm
parents:
48509
diff
changeset
|
83 |
BUILD_HEAP=false |
48595 | 84 |
CLEAN_BUILD=false |
48737
f3bbb9ca57d6
added build option -D: include session directory and select its sessions;
wenzelm
parents:
48601
diff
changeset
|
85 |
declare -a INCLUDE_DIRS=() |
48509 | 86 |
declare -a SESSION_GROUPS=() |
48425 | 87 |
MAX_JOBS=1 |
59891
9ce697050455
added isabelle build option -k, for fast off-line checking of theory sources;
wenzelm
parents:
59565
diff
changeset
|
88 |
declare -a CHECK_KEYWORDS=() |
48903 | 89 |
LIST_FILES=false |
48469 | 90 |
NO_BUILD=false |
48509 | 91 |
eval "declare -a BUILD_OPTIONS=($ISABELLE_BUILD_OPTIONS)" |
48447
ef600ce4559c
added system build mode: produce output in ISABELLE_HOME;
wenzelm
parents:
48425
diff
changeset
|
92 |
SYSTEM_MODE=false |
48425 | 93 |
VERBOSE=false |
59892
2a616319c171
added isabelle build option -x, to exclude sessions;
wenzelm
parents:
59891
diff
changeset
|
94 |
declare -a EXCLUDE_SESSIONS=() |
48276 | 95 |
|
60106 | 96 |
while getopts "D:RX:abcd:g:j:k:lno:svx:" OPT |
48276 | 97 |
do |
98 |
case "$OPT" in |
|
48737
f3bbb9ca57d6
added build option -D: include session directory and select its sessions;
wenzelm
parents:
48601
diff
changeset
|
99 |
D) |
f3bbb9ca57d6
added build option -D: include session directory and select its sessions;
wenzelm
parents:
48601
diff
changeset
|
100 |
SELECT_DIRS["${#SELECT_DIRS[@]}"]="$OPTARG" |
f3bbb9ca57d6
added build option -D: include session directory and select its sessions;
wenzelm
parents:
48601
diff
changeset
|
101 |
;; |
49131 | 102 |
R) |
103 |
REQUIREMENTS="true" |
|
104 |
;; |
|
60106 | 105 |
X) |
106 |
EXCLUDE_SESSION_GROUPS["${#EXCLUDE_SESSION_GROUPS[@]}"]="$OPTARG" |
|
107 |
;; |
|
48276 | 108 |
a) |
109 |
ALL_SESSIONS="true" |
|
110 |
;; |
|
111 |
b) |
|
48511
37999ee01156
remove old output heaps, to ensure that result is valid wrt. check_stamps;
wenzelm
parents:
48509
diff
changeset
|
112 |
BUILD_HEAP="true" |
48276 | 113 |
;; |
48595 | 114 |
c) |
115 |
CLEAN_BUILD="true" |
|
116 |
;; |
|
48340
6f4fc030882a
allow explicit specification of additional session directories;
wenzelm
parents:
48276
diff
changeset
|
117 |
d) |
48737
f3bbb9ca57d6
added build option -D: include session directory and select its sessions;
wenzelm
parents:
48601
diff
changeset
|
118 |
INCLUDE_DIRS["${#INCLUDE_DIRS[@]}"]="$OPTARG" |
48340
6f4fc030882a
allow explicit specification of additional session directories;
wenzelm
parents:
48276
diff
changeset
|
119 |
;; |
48509 | 120 |
g) |
121 |
SESSION_GROUPS["${#SESSION_GROUPS[@]}"]="$OPTARG" |
|
122 |
;; |
|
48425 | 123 |
j) |
124 |
check_number "$OPTARG" |
|
125 |
MAX_JOBS="$OPTARG" |
|
126 |
;; |
|
59891
9ce697050455
added isabelle build option -k, for fast off-line checking of theory sources;
wenzelm
parents:
59565
diff
changeset
|
127 |
k) |
9ce697050455
added isabelle build option -k, for fast off-line checking of theory sources;
wenzelm
parents:
59565
diff
changeset
|
128 |
CHECK_KEYWORDS["${#CHECK_KEYWORDS[@]}"]="$OPTARG" |
9ce697050455
added isabelle build option -k, for fast off-line checking of theory sources;
wenzelm
parents:
59565
diff
changeset
|
129 |
;; |
48903 | 130 |
l) |
131 |
LIST_FILES="true" |
|
132 |
;; |
|
48469 | 133 |
n) |
134 |
NO_BUILD="true" |
|
48276 | 135 |
;; |
136 |
o) |
|
137 |
BUILD_OPTIONS["${#BUILD_OPTIONS[@]}"]="$OPTARG" |
|
138 |
;; |
|
48447
ef600ce4559c
added system build mode: produce output in ISABELLE_HOME;
wenzelm
parents:
48425
diff
changeset
|
139 |
s) |
ef600ce4559c
added system build mode: produce output in ISABELLE_HOME;
wenzelm
parents:
48425
diff
changeset
|
140 |
SYSTEM_MODE="true" |
ef600ce4559c
added system build mode: produce output in ISABELLE_HOME;
wenzelm
parents:
48425
diff
changeset
|
141 |
;; |
48425 | 142 |
v) |
143 |
VERBOSE="true" |
|
144 |
;; |
|
59892
2a616319c171
added isabelle build option -x, to exclude sessions;
wenzelm
parents:
59891
diff
changeset
|
145 |
x) |
2a616319c171
added isabelle build option -x, to exclude sessions;
wenzelm
parents:
59891
diff
changeset
|
146 |
EXCLUDE_SESSIONS["${#EXCLUDE_SESSIONS[@]}"]="$OPTARG" |
2a616319c171
added isabelle build option -x, to exclude sessions;
wenzelm
parents:
59891
diff
changeset
|
147 |
;; |
48276 | 148 |
\?) |
149 |
usage |
|
150 |
;; |
|
151 |
esac |
|
152 |
done |
|
153 |
||
154 |
shift $(($OPTIND - 1)) |
|
155 |
||
156 |
||
157 |
## main |
|
158 |
||
52443 | 159 |
isabelle_admin_build jars || exit $? |
48276 | 160 |
|
48601 | 161 |
if [ "$NO_BUILD" = false -a "$VERBOSE" = true ]; then |
48474 | 162 |
echo "Started at $(date) ($ML_IDENTIFIER on $(hostname))" |
163 |
||
48601 | 164 |
show_settings "" |
165 |
echo |
|
48474 | 166 |
fi |
167 |
||
59565
96e860a17b9a
more uniform headless mode for all derivatives of "build" (amending df5dc24ca712);
wenzelm
parents:
59464
diff
changeset
|
168 |
declare -a JAVA_ARGS; eval "JAVA_ARGS=($ISABELLE_BUILD_JAVA_OPTIONS)" |
51977
b55f90655328
more generous java resources via ISABELLE_BUILD_JAVA_OPTIONS;
wenzelm
parents:
50364
diff
changeset
|
169 |
|
48780
49a965020394
always show some timing information, to reduce the need for explicit -v;
wenzelm
parents:
48737
diff
changeset
|
170 |
. "$ISABELLE_HOME/lib/scripts/timestart.bash" |
49a965020394
always show some timing information, to reduce the need for explicit -v;
wenzelm
parents:
48737
diff
changeset
|
171 |
|
51977
b55f90655328
more generous java resources via ISABELLE_BUILD_JAVA_OPTIONS;
wenzelm
parents:
50364
diff
changeset
|
172 |
"$ISABELLE_TOOL" java "${JAVA_ARGS[@]}" isabelle.Build \ |
49131 | 173 |
"$REQUIREMENTS" "$ALL_SESSIONS" "$BUILD_HEAP" "$CLEAN_BUILD" "$MAX_JOBS" \ |
48903 | 174 |
"$LIST_FILES" "$NO_BUILD" "$SYSTEM_MODE" "$VERBOSE" \ |
56890 | 175 |
"${INCLUDE_DIRS[@]}" $'\n' "${SELECT_DIRS[@]}" $'\n' \ |
59891
9ce697050455
added isabelle build option -k, for fast off-line checking of theory sources;
wenzelm
parents:
59565
diff
changeset
|
176 |
"${SESSION_GROUPS[@]}" $'\n' "${CHECK_KEYWORDS[@]}" $'\n' \ |
60106 | 177 |
"${BUILD_OPTIONS[@]}" $'\n' "${EXCLUDE_SESSION_GROUPS[@]}" $'\n' \ |
178 |
"${EXCLUDE_SESSIONS[@]}" $'\n' "$@" |
|
48474 | 179 |
RC="$?" |
180 |
||
48601 | 181 |
if [ "$NO_BUILD" = false -a "$VERBOSE" = true ]; then |
48474 | 182 |
echo -n "Finished at "; date |
183 |
fi |
|
184 |
||
48780
49a965020394
always show some timing information, to reduce the need for explicit -v;
wenzelm
parents:
48737
diff
changeset
|
185 |
. "$ISABELLE_HOME/lib/scripts/timestop.bash" |
49a965020394
always show some timing information, to reduce the need for explicit -v;
wenzelm
parents:
48737
diff
changeset
|
186 |
echo "$TIMES_REPORT" |
49a965020394
always show some timing information, to reduce the need for explicit -v;
wenzelm
parents:
48737
diff
changeset
|
187 |
|
48474 | 188 |
exit "$RC" |