author | wenzelm |
Sun, 24 Feb 2013 14:14:07 +0100 | |
changeset 51267 | c68c1b89a0f1 |
parent 51250 | ca13a14cc52e |
child 51504 | 18095684c5a6 |
permissions | -rwxr-xr-x |
34282
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
1 |
#!/usr/bin/env bash |
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
2 |
# |
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
3 |
# Author: Makarius |
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
4 |
# |
42899 | 5 |
# build-jars - build Isabelle/Scala |
34282
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
6 |
# |
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
7 |
# Requires proper Isabelle settings environment. |
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
8 |
|
43320 | 9 |
## sources |
10 |
||
11 |
declare -a SOURCES=( |
|
43660 | 12 |
Concurrent/counter.scala |
43320 | 13 |
Concurrent/future.scala |
14 |
Concurrent/simple_thread.scala |
|
15 |
Concurrent/volatile.scala |
|
16 |
General/exn.scala |
|
48411
5b3440850d36
more abstract file system operations in Scala, corresponding to ML version;
wenzelm
parents:
48410
diff
changeset
|
17 |
General/file.scala |
46611 | 18 |
General/graph.scala |
51098 | 19 |
General/graphics_file.scala |
43320 | 20 |
General/linear_set.scala |
43600
4ac04bf9ff89
abstract algebra of file paths in Scala (cf. path.ML);
wenzelm
parents:
43523
diff
changeset
|
21 |
General/path.scala |
43320 | 22 |
General/position.scala |
23 |
General/pretty.scala |
|
43780 | 24 |
General/properties.scala |
43320 | 25 |
General/scan.scala |
26 |
General/sha1.scala |
|
27 |
General/symbol.scala |
|
45674 | 28 |
General/time.scala |
45666 | 29 |
General/timing.scala |
43320 | 30 |
Isar/keyword.scala |
31 |
Isar/outer_syntax.scala |
|
32 |
Isar/parse.scala |
|
33 |
Isar/token.scala |
|
34 |
PIDE/command.scala |
|
35 |
PIDE/document.scala |
|
45670 | 36 |
PIDE/markup.scala |
43320 | 37 |
PIDE/markup_tree.scala |
45709
87017fcbad83
clarified modules (again) -- NB: both Document and Protocol are specific to this particular prover;
wenzelm
parents:
45674
diff
changeset
|
38 |
PIDE/protocol.scala |
43320 | 39 |
PIDE/text.scala |
44698 | 40 |
PIDE/xml.scala |
41 |
PIDE/yxml.scala |
|
49294 | 42 |
System/color_value.scala |
48346
e2382bede914
more general support for Isabelle/Scala command line tools;
wenzelm
parents:
48276
diff
changeset
|
43 |
System/command_line.scala |
43320 | 44 |
System/event_bus.scala |
45 |
System/gui_setup.scala |
|
49066 | 46 |
System/html5_panel.scala |
51250
ca13a14cc52e
support for POSIX interrupts (bypassed on Windows);
wenzelm
parents:
51098
diff
changeset
|
47 |
System/interrupt.scala |
43744
2c7e1565b4a3
some support to invoke Scala methods under program control;
wenzelm
parents:
43730
diff
changeset
|
48 |
System/invoke_scala.scala |
43517 | 49 |
System/isabelle_charset.scala |
43320 | 50 |
System/isabelle_process.scala |
51 |
System/isabelle_system.scala |
|
49065 | 52 |
System/jfx_thread.scala |
48365
d88aefda01c4
basic support for stand-alone options with external string representation;
wenzelm
parents:
48346
diff
changeset
|
53 |
System/options.scala |
43320 | 54 |
System/platform.scala |
55 |
System/session.scala |
|
56 |
System/swing_thread.scala |
|
45027
f459e93a038e
more abstract wrapping of fifos as System_Channel;
wenzelm
parents:
44698
diff
changeset
|
57 |
System/system_channel.scala |
50203 | 58 |
System/utf8.scala |
43320 | 59 |
Thy/completion.scala |
60 |
Thy/html.scala |
|
50707
5b2bf7611662
maintain session index on Scala side, for more determistic results;
wenzelm
parents:
50689
diff
changeset
|
61 |
Thy/present.scala |
43320 | 62 |
Thy/thy_header.scala |
43651
511df47bcadc
some support for theory files within Isabelle/Scala session;
wenzelm
parents:
43600
diff
changeset
|
63 |
Thy/thy_info.scala |
511df47bcadc
some support for theory files within Isabelle/Scala session;
wenzelm
parents:
43600
diff
changeset
|
64 |
Thy/thy_load.scala |
43320 | 65 |
Thy/thy_syntax.scala |
50686 | 66 |
Tools/build.scala |
67 |
Tools/build_dialog.scala |
|
50687 | 68 |
Tools/main.scala |
50981 | 69 |
Tools/ml_statistics.scala |
50980 | 70 |
Tools/task_statistics.scala |
43320 | 71 |
library.scala |
72 |
package.scala |
|
43730
a0ed7bc688b5
lambda terms with XML data representation in Scala;
wenzelm
parents:
43715
diff
changeset
|
73 |
term.scala |
43779 | 74 |
term_xml.scala |
43320 | 75 |
) |
76 |
||
34282
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
77 |
|
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
78 |
## diagnostics |
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
79 |
|
43280 | 80 |
PRG="$(basename "$0")" |
81 |
||
82 |
function usage() |
|
83 |
{ |
|
84 |
echo |
|
85 |
echo "Usage: isabelle $PRG [OPTIONS]" |
|
86 |
echo |
|
87 |
echo " Options are:" |
|
88 |
echo " -f fresh build" |
|
47408
63c05991882e
slightly faster default compilation of Isabelle/Scala;
wenzelm
parents:
47115
diff
changeset
|
89 |
echo " -t test separate compilation of PIDE" |
43280 | 90 |
echo |
91 |
exit 1 |
|
92 |
} |
|
93 |
||
34282
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
94 |
function fail() |
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
95 |
{ |
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
96 |
echo "$1" >&2 |
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
97 |
exit 2 |
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
98 |
} |
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
99 |
|
42899 | 100 |
[ -z "$ISABELLE_HOME" ] && fail "Missing Isabelle settings environment" |
34282
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
101 |
|
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
102 |
|
43280 | 103 |
## process command line |
104 |
||
105 |
# options |
|
106 |
||
107 |
FRESH="" |
|
47408
63c05991882e
slightly faster default compilation of Isabelle/Scala;
wenzelm
parents:
47115
diff
changeset
|
108 |
TEST_PIDE="" |
43280 | 109 |
|
47408
63c05991882e
slightly faster default compilation of Isabelle/Scala;
wenzelm
parents:
47115
diff
changeset
|
110 |
while getopts "ft" OPT |
43280 | 111 |
do |
112 |
case "$OPT" in |
|
113 |
f) |
|
114 |
FRESH=true |
|
115 |
;; |
|
47408
63c05991882e
slightly faster default compilation of Isabelle/Scala;
wenzelm
parents:
47115
diff
changeset
|
116 |
t) |
63c05991882e
slightly faster default compilation of Isabelle/Scala;
wenzelm
parents:
47115
diff
changeset
|
117 |
TEST_PIDE=true |
63c05991882e
slightly faster default compilation of Isabelle/Scala;
wenzelm
parents:
47115
diff
changeset
|
118 |
;; |
43280 | 119 |
\?) |
120 |
usage |
|
121 |
;; |
|
122 |
esac |
|
123 |
done |
|
124 |
||
125 |
shift $(($OPTIND - 1)) |
|
126 |
||
127 |
||
128 |
# args |
|
129 |
||
130 |
[ "$#" -ne 0 ] && usage |
|
131 |
||
132 |
||
50689 | 133 |
## dependencies |
134 |
||
135 |
declare -a JFREECHART_JARS=() |
|
136 |
for NAME in $JFREECHART_JAR_NAMES |
|
137 |
do |
|
138 |
JFREECHART_JARS["${#JFREECHART_JARS[@]}"]="$JFREECHART_HOME/lib/$NAME" |
|
139 |
done |
|
140 |
||
141 |
||
49558 | 142 |
## build |
34282
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
143 |
|
34284 | 144 |
TARGET_DIR="$ISABELLE_HOME/lib/classes" |
43523 | 145 |
TARGET="$TARGET_DIR/ext/Pure.jar" |
34282
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
146 |
|
45673
cd41e3903fbf
separate compilation of PIDE vs. Pure sources, which enables independent Scala library;
wenzelm
parents:
45672
diff
changeset
|
147 |
declare -a PIDE_SOURCES=() |
cd41e3903fbf
separate compilation of PIDE vs. Pure sources, which enables independent Scala library;
wenzelm
parents:
45672
diff
changeset
|
148 |
declare -a PURE_SOURCES=() |
cd41e3903fbf
separate compilation of PIDE vs. Pure sources, which enables independent Scala library;
wenzelm
parents:
45672
diff
changeset
|
149 |
|
cd41e3903fbf
separate compilation of PIDE vs. Pure sources, which enables independent Scala library;
wenzelm
parents:
45672
diff
changeset
|
150 |
for DEP in "${SOURCES[@]}" |
cd41e3903fbf
separate compilation of PIDE vs. Pure sources, which enables independent Scala library;
wenzelm
parents:
45672
diff
changeset
|
151 |
do |
cd41e3903fbf
separate compilation of PIDE vs. Pure sources, which enables independent Scala library;
wenzelm
parents:
45672
diff
changeset
|
152 |
if grep "Module:.*PIDE" "$DEP" >/dev/null |
cd41e3903fbf
separate compilation of PIDE vs. Pure sources, which enables independent Scala library;
wenzelm
parents:
45672
diff
changeset
|
153 |
then |
cd41e3903fbf
separate compilation of PIDE vs. Pure sources, which enables independent Scala library;
wenzelm
parents:
45672
diff
changeset
|
154 |
PIDE_SOURCES["${#PIDE_SOURCES[@]}"]="$DEP" |
cd41e3903fbf
separate compilation of PIDE vs. Pure sources, which enables independent Scala library;
wenzelm
parents:
45672
diff
changeset
|
155 |
else |
cd41e3903fbf
separate compilation of PIDE vs. Pure sources, which enables independent Scala library;
wenzelm
parents:
45672
diff
changeset
|
156 |
PURE_SOURCES["${#PURE_SOURCES[@]}"]="$DEP" |
cd41e3903fbf
separate compilation of PIDE vs. Pure sources, which enables independent Scala library;
wenzelm
parents:
45672
diff
changeset
|
157 |
fi |
cd41e3903fbf
separate compilation of PIDE vs. Pure sources, which enables independent Scala library;
wenzelm
parents:
45672
diff
changeset
|
158 |
done |
cd41e3903fbf
separate compilation of PIDE vs. Pure sources, which enables independent Scala library;
wenzelm
parents:
45672
diff
changeset
|
159 |
|
43405 | 160 |
declare -a UPDATED=() |
161 |
||
43280 | 162 |
if [ -n "$FRESH" ]; then |
163 |
OUTDATED=true |
|
164 |
else |
|
165 |
OUTDATED=false |
|
43523 | 166 |
if [ ! -e "$TARGET" ]; then |
167 |
OUTDATED=true |
|
168 |
else |
|
43405 | 169 |
for DEP in "${SOURCES[@]}" |
43280 | 170 |
do |
43405 | 171 |
[ ! -e "$DEP" ] && fail "Missing file: $DEP" |
43523 | 172 |
[ "$DEP" -nt "$TARGET" ] && { |
173 |
OUTDATED=true |
|
174 |
UPDATED["${#UPDATED[@]}"]="$DEP" |
|
175 |
} |
|
43280 | 176 |
done |
43405 | 177 |
fi |
43280 | 178 |
fi |
34282
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
179 |
|
34284 | 180 |
if [ "$OUTDATED" = true ] |
181 |
then |
|
49173
fa01a202399c
eliminated potentially confusing terminology of Scala "layer";
wenzelm
parents:
49068
diff
changeset
|
182 |
echo "### Building Isabelle/Scala ..." |
34282
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
183 |
|
43405 | 184 |
[ "${#UPDATED[@]}" -gt 0 ] && { |
185 |
echo "Changed files:" |
|
186 |
for FILE in "${UPDATED[@]}" |
|
187 |
do |
|
188 |
echo " $FILE" |
|
189 |
done |
|
190 |
} |
|
191 |
||
34282
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
192 |
rm -rf classes && mkdir classes |
45673
cd41e3903fbf
separate compilation of PIDE vs. Pure sources, which enables independent Scala library;
wenzelm
parents:
45672
diff
changeset
|
193 |
|
47009 | 194 |
SCALAC_OPTIONS="$ISABELLE_SCALA_BUILD_OPTIONS -d classes" |
45673
cd41e3903fbf
separate compilation of PIDE vs. Pure sources, which enables independent Scala library;
wenzelm
parents:
45672
diff
changeset
|
195 |
|
49067 | 196 |
JFXRT="$ISABELLE_JDK_HOME/jre/lib/jfxrt.jar" |
197 |
||
50689 | 198 |
( |
199 |
for X in "$JFXRT" "${JFREECHART_JARS[@]}" classes |
|
200 |
do |
|
201 |
CLASSPATH="$CLASSPATH:$X" |
|
202 |
done |
|
203 |
CLASSPATH="$(jvmpath "$CLASSPATH")" |
|
204 |
||
205 |
if [ "$TEST_PIDE" = true ]; then |
|
206 |
isabelle_scala scalac $SCALAC_OPTIONS "${PIDE_SOURCES[@]}" || \ |
|
207 |
fail "Failed to compile PIDE sources" |
|
208 |
isabelle_scala scalac $SCALAC_OPTIONS "${PURE_SOURCES[@]}" || \ |
|
209 |
fail "Failed to compile Pure sources" |
|
210 |
else |
|
211 |
isabelle_scala scalac $SCALAC_OPTIONS "${PIDE_SOURCES[@]}" "${PURE_SOURCES[@]}" || \ |
|
212 |
fail "Failed to compile sources" |
|
213 |
fi |
|
214 |
) |
|
45673
cd41e3903fbf
separate compilation of PIDE vs. Pure sources, which enables independent Scala library;
wenzelm
parents:
45672
diff
changeset
|
215 |
|
43523 | 216 |
mkdir -p "$TARGET_DIR/ext" || fail "Failed to create directory $TARGET_DIR/ext" |
43280 | 217 |
|
43285 | 218 |
pushd classes >/dev/null |
43280 | 219 |
|
43517 | 220 |
CHARSET_SERVICE="META-INF/services/java.nio.charset.spi.CharsetProvider" |
221 |
mkdir -p "$(dirname "$CHARSET_SERVICE")" |
|
222 |
echo isabelle.Isabelle_Charset_Provider > "$CHARSET_SERVICE" |
|
223 |
||
47115
1a05adae1cc9
more robust command invocation via ISABELLE_JDK_HOME or SCALA_HOME (NB: bash exec requires genuine executable, not function);
wenzelm
parents:
47113
diff
changeset
|
224 |
isabelle_jdk jar cfe "$(jvmpath "$TARGET")" isabelle.GUI_Setup META-INF isabelle || \ |
43523 | 225 |
fail "Failed to produce $TARGET" |
34282
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
226 |
|
49449 | 227 |
cp "$SCALA_HOME/lib/scala-compiler.jar" \ |
47995
72f52cd7c633
include scala-compiler.jar in basic Isabelle/Scala environment, to make Isabelle/jEdit console work with scala-2.10.0-M3;
wenzelm
parents:
47849
diff
changeset
|
228 |
"$SCALA_HOME/lib/scala-library.jar" \ |
72f52cd7c633
include scala-compiler.jar in basic Isabelle/Scala environment, to make Isabelle/jEdit console work with scala-2.10.0-M3;
wenzelm
parents:
47849
diff
changeset
|
229 |
"$SCALA_HOME/lib/scala-swing.jar" "$TARGET_DIR/ext" |
72f52cd7c633
include scala-compiler.jar in basic Isabelle/Scala environment, to make Isabelle/jEdit console work with scala-2.10.0-M3;
wenzelm
parents:
47849
diff
changeset
|
230 |
|
47849 | 231 |
[ -e "$SCALA_HOME/lib/scala-actors.jar" ] && \ |
232 |
cp "$SCALA_HOME/lib/scala-actors.jar" "$TARGET_DIR/ext" |
|
43521
d477b92109b8
provide Isabelle/Scala environment as Java extension, instead of user classpath
wenzelm
parents:
43517
diff
changeset
|
233 |
|
49955 | 234 |
[ -e "$SCALA_HOME/lib/scala-reflect.jar" ] && \ |
235 |
cp "$SCALA_HOME/lib/scala-reflect.jar" "$TARGET_DIR/ext" |
|
236 |
||
43280 | 237 |
popd >/dev/null |
238 |
||
34282
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
239 |
rm -rf classes |
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
240 |
fi |