author | wenzelm |
Thu, 24 Apr 2014 10:38:14 +0200 | |
changeset 56690 | 69b31dc7256e |
parent 56685 | 535d59d4ed12 |
child 56693 | 0423c957b081 |
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 |
|
56685 | 15 |
Concurrent/synchronized.scala |
55511
984e210d412e
antiquotations within plain text: Scala version in accordance to ML;
wenzelm
parents:
55497
diff
changeset
|
16 |
General/antiquote.scala |
54439 | 17 |
General/bytes.scala |
55673
0286219c1261
clarified module location (again, see 763d35697338);
wenzelm
parents:
55511
diff
changeset
|
18 |
General/completion.scala |
43320 | 19 |
General/exn.scala |
48411
5b3440850d36
more abstract file system operations in Scala, corresponding to ML version;
wenzelm
parents:
48410
diff
changeset
|
20 |
General/file.scala |
46611 | 21 |
General/graph.scala |
51098 | 22 |
General/graphics_file.scala |
43320 | 23 |
General/linear_set.scala |
52975 | 24 |
General/multi_map.scala |
43600
4ac04bf9ff89
abstract algebra of file paths in Scala (cf. path.ML);
wenzelm
parents:
43523
diff
changeset
|
25 |
General/path.scala |
43320 | 26 |
General/position.scala |
27 |
General/pretty.scala |
|
43780 | 28 |
General/properties.scala |
43320 | 29 |
General/scan.scala |
30 |
General/sha1.scala |
|
31 |
General/symbol.scala |
|
45674 | 32 |
General/time.scala |
45666 | 33 |
General/timing.scala |
56501
5fda9e5c5874
basic URL operations (with Isabelle/Scala error handling);
wenzelm
parents:
56429
diff
changeset
|
34 |
General/url.scala |
56599 | 35 |
General/word.scala |
52671
9a360530eac8
separate module XZ_File to avoid initial dependency on org.tukaani.xz;
wenzelm
parents:
52667
diff
changeset
|
36 |
General/xz_file.scala |
53783
f5e9d182f645
clarified location of GUI modules (which depend on Swing of JFX);
wenzelm
parents:
53711
diff
changeset
|
37 |
GUI/color_value.scala |
f5e9d182f645
clarified location of GUI modules (which depend on Swing of JFX);
wenzelm
parents:
53711
diff
changeset
|
38 |
GUI/gui.scala |
f5e9d182f645
clarified location of GUI modules (which depend on Swing of JFX);
wenzelm
parents:
53711
diff
changeset
|
39 |
GUI/html5_panel.scala |
f5e9d182f645
clarified location of GUI modules (which depend on Swing of JFX);
wenzelm
parents:
53711
diff
changeset
|
40 |
GUI/jfx_thread.scala |
f5e9d182f645
clarified location of GUI modules (which depend on Swing of JFX);
wenzelm
parents:
53711
diff
changeset
|
41 |
GUI/popup.scala |
f5e9d182f645
clarified location of GUI modules (which depend on Swing of JFX);
wenzelm
parents:
53711
diff
changeset
|
42 |
GUI/swing_thread.scala |
f5e9d182f645
clarified location of GUI modules (which depend on Swing of JFX);
wenzelm
parents:
53711
diff
changeset
|
43 |
GUI/system_dialog.scala |
f5e9d182f645
clarified location of GUI modules (which depend on Swing of JFX);
wenzelm
parents:
53711
diff
changeset
|
44 |
GUI/wrap_panel.scala |
43320 | 45 |
Isar/keyword.scala |
46 |
Isar/outer_syntax.scala |
|
47 |
Isar/parse.scala |
|
48 |
Isar/token.scala |
|
55497 | 49 |
ML/ml_lex.scala |
43320 | 50 |
PIDE/command.scala |
51 |
PIDE/document.scala |
|
52530
99dd8b4ef3fe
explicit module Document_ID as source of globally unique identifiers across ML/Scala;
wenzelm
parents:
52444
diff
changeset
|
52 |
PIDE/document_id.scala |
52971
31926d2c04ee
tuned signature -- more abstract PIDE editor operations;
wenzelm
parents:
52671
diff
changeset
|
53 |
PIDE/editor.scala |
45670 | 54 |
PIDE/markup.scala |
43320 | 55 |
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
|
56 |
PIDE/protocol.scala |
56385 | 57 |
PIDE/prover.scala |
52981 | 58 |
PIDE/query_operation.scala |
56208 | 59 |
PIDE/resources.scala |
56210 | 60 |
PIDE/session.scala |
43320 | 61 |
PIDE/text.scala |
44698 | 62 |
PIDE/xml.scala |
63 |
PIDE/yxml.scala |
|
48346
e2382bede914
more general support for Isabelle/Scala command line tools;
wenzelm
parents:
48276
diff
changeset
|
64 |
System/command_line.scala |
43320 | 65 |
System/event_bus.scala |
51250
ca13a14cc52e
support for POSIX interrupts (bypassed on Windows);
wenzelm
parents:
51098
diff
changeset
|
66 |
System/interrupt.scala |
43744
2c7e1565b4a3
some support to invoke Scala methods under program control;
wenzelm
parents:
43730
diff
changeset
|
67 |
System/invoke_scala.scala |
43517 | 68 |
System/isabelle_charset.scala |
51614
22d1dd43f089
separate module Isabelle_Font, to keep this out of the way of generic Isabelle_System operations, notably for non-Isabelle/jEdit applications;
wenzelm
parents:
51508
diff
changeset
|
69 |
System/isabelle_font.scala |
43320 | 70 |
System/isabelle_process.scala |
71 |
System/isabelle_system.scala |
|
48365
d88aefda01c4
basic support for stand-alone options with external string representation;
wenzelm
parents:
48346
diff
changeset
|
72 |
System/options.scala |
43320 | 73 |
System/platform.scala |
45027
f459e93a038e
more abstract wrapping of fifos as System_Channel;
wenzelm
parents:
44698
diff
changeset
|
74 |
System/system_channel.scala |
50203 | 75 |
System/utf8.scala |
43320 | 76 |
Thy/html.scala |
50707
5b2bf7611662
maintain session index on Scala side, for more determistic results;
wenzelm
parents:
50689
diff
changeset
|
77 |
Thy/present.scala |
43320 | 78 |
Thy/thy_header.scala |
43651
511df47bcadc
some support for theory files within Isabelle/Scala session;
wenzelm
parents:
43600
diff
changeset
|
79 |
Thy/thy_info.scala |
43320 | 80 |
Thy/thy_syntax.scala |
50686 | 81 |
Tools/build.scala |
56429 | 82 |
Tools/build_doc.scala |
52444
2cfe6656d6d6
slightly improved "isabelle doc" based on Isabelle/Scala;
wenzelm
parents:
52439
diff
changeset
|
83 |
Tools/doc.scala |
52439
4cf3f6153eb8
improved "isabelle keywords" and "isabelle update_keywords" based on Isabelle/Scala, without requiring to build sessions first;
wenzelm
parents:
52427
diff
changeset
|
84 |
Tools/keywords.scala |
50687 | 85 |
Tools/main.scala |
50981 | 86 |
Tools/ml_statistics.scala |
54730 | 87 |
Tools/simplifier_trace.scala |
50980 | 88 |
Tools/task_statistics.scala |
43320 | 89 |
library.scala |
90 |
package.scala |
|
43730
a0ed7bc688b5
lambda terms with XML data representation in Scala;
wenzelm
parents:
43715
diff
changeset
|
91 |
term.scala |
43779 | 92 |
term_xml.scala |
43320 | 93 |
) |
94 |
||
34282
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 |
## diagnostics |
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
97 |
|
43280 | 98 |
PRG="$(basename "$0")" |
99 |
||
100 |
function usage() |
|
101 |
{ |
|
102 |
echo |
|
103 |
echo "Usage: isabelle $PRG [OPTIONS]" |
|
104 |
echo |
|
105 |
echo " Options are:" |
|
106 |
echo " -f fresh build" |
|
47408
63c05991882e
slightly faster default compilation of Isabelle/Scala;
wenzelm
parents:
47115
diff
changeset
|
107 |
echo " -t test separate compilation of PIDE" |
43280 | 108 |
echo |
109 |
exit 1 |
|
110 |
} |
|
111 |
||
34282
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
112 |
function fail() |
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
113 |
{ |
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
114 |
echo "$1" >&2 |
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
115 |
exit 2 |
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
116 |
} |
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
117 |
|
42899 | 118 |
[ -z "$ISABELLE_HOME" ] && fail "Missing Isabelle settings environment" |
34282
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
119 |
|
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
120 |
|
43280 | 121 |
## process command line |
122 |
||
123 |
# options |
|
124 |
||
125 |
FRESH="" |
|
47408
63c05991882e
slightly faster default compilation of Isabelle/Scala;
wenzelm
parents:
47115
diff
changeset
|
126 |
TEST_PIDE="" |
43280 | 127 |
|
47408
63c05991882e
slightly faster default compilation of Isabelle/Scala;
wenzelm
parents:
47115
diff
changeset
|
128 |
while getopts "ft" OPT |
43280 | 129 |
do |
130 |
case "$OPT" in |
|
131 |
f) |
|
132 |
FRESH=true |
|
133 |
;; |
|
47408
63c05991882e
slightly faster default compilation of Isabelle/Scala;
wenzelm
parents:
47115
diff
changeset
|
134 |
t) |
63c05991882e
slightly faster default compilation of Isabelle/Scala;
wenzelm
parents:
47115
diff
changeset
|
135 |
TEST_PIDE=true |
63c05991882e
slightly faster default compilation of Isabelle/Scala;
wenzelm
parents:
47115
diff
changeset
|
136 |
;; |
43280 | 137 |
\?) |
138 |
usage |
|
139 |
;; |
|
140 |
esac |
|
141 |
done |
|
142 |
||
143 |
shift $(($OPTIND - 1)) |
|
144 |
||
145 |
||
146 |
# args |
|
147 |
||
148 |
[ "$#" -ne 0 ] && usage |
|
149 |
||
150 |
||
49558 | 151 |
## build |
34282
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
152 |
|
34284 | 153 |
TARGET_DIR="$ISABELLE_HOME/lib/classes" |
53577 | 154 |
TARGET="$TARGET_DIR/Pure.jar" |
34282
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
155 |
|
45673
cd41e3903fbf
separate compilation of PIDE vs. Pure sources, which enables independent Scala library;
wenzelm
parents:
45672
diff
changeset
|
156 |
declare -a PIDE_SOURCES=() |
cd41e3903fbf
separate compilation of PIDE vs. Pure sources, which enables independent Scala library;
wenzelm
parents:
45672
diff
changeset
|
157 |
declare -a PURE_SOURCES=() |
cd41e3903fbf
separate compilation of PIDE vs. Pure sources, which enables independent Scala library;
wenzelm
parents:
45672
diff
changeset
|
158 |
|
cd41e3903fbf
separate compilation of PIDE vs. Pure sources, which enables independent Scala library;
wenzelm
parents:
45672
diff
changeset
|
159 |
for DEP in "${SOURCES[@]}" |
cd41e3903fbf
separate compilation of PIDE vs. Pure sources, which enables independent Scala library;
wenzelm
parents:
45672
diff
changeset
|
160 |
do |
cd41e3903fbf
separate compilation of PIDE vs. Pure sources, which enables independent Scala library;
wenzelm
parents:
45672
diff
changeset
|
161 |
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
|
162 |
then |
cd41e3903fbf
separate compilation of PIDE vs. Pure sources, which enables independent Scala library;
wenzelm
parents:
45672
diff
changeset
|
163 |
PIDE_SOURCES["${#PIDE_SOURCES[@]}"]="$DEP" |
cd41e3903fbf
separate compilation of PIDE vs. Pure sources, which enables independent Scala library;
wenzelm
parents:
45672
diff
changeset
|
164 |
else |
cd41e3903fbf
separate compilation of PIDE vs. Pure sources, which enables independent Scala library;
wenzelm
parents:
45672
diff
changeset
|
165 |
PURE_SOURCES["${#PURE_SOURCES[@]}"]="$DEP" |
cd41e3903fbf
separate compilation of PIDE vs. Pure sources, which enables independent Scala library;
wenzelm
parents:
45672
diff
changeset
|
166 |
fi |
cd41e3903fbf
separate compilation of PIDE vs. Pure sources, which enables independent Scala library;
wenzelm
parents:
45672
diff
changeset
|
167 |
done |
cd41e3903fbf
separate compilation of PIDE vs. Pure sources, which enables independent Scala library;
wenzelm
parents:
45672
diff
changeset
|
168 |
|
43405 | 169 |
declare -a UPDATED=() |
170 |
||
43280 | 171 |
if [ -n "$FRESH" ]; then |
172 |
OUTDATED=true |
|
173 |
else |
|
174 |
OUTDATED=false |
|
43523 | 175 |
if [ ! -e "$TARGET" ]; then |
176 |
OUTDATED=true |
|
177 |
else |
|
43405 | 178 |
for DEP in "${SOURCES[@]}" |
43280 | 179 |
do |
43405 | 180 |
[ ! -e "$DEP" ] && fail "Missing file: $DEP" |
43523 | 181 |
[ "$DEP" -nt "$TARGET" ] && { |
182 |
OUTDATED=true |
|
183 |
UPDATED["${#UPDATED[@]}"]="$DEP" |
|
184 |
} |
|
43280 | 185 |
done |
43405 | 186 |
fi |
43280 | 187 |
fi |
34282
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
188 |
|
34284 | 189 |
if [ "$OUTDATED" = true ] |
190 |
then |
|
49173
fa01a202399c
eliminated potentially confusing terminology of Scala "layer";
wenzelm
parents:
49068
diff
changeset
|
191 |
echo "### Building Isabelle/Scala ..." |
34282
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
192 |
|
43405 | 193 |
[ "${#UPDATED[@]}" -gt 0 ] && { |
194 |
echo "Changed files:" |
|
195 |
for FILE in "${UPDATED[@]}" |
|
196 |
do |
|
197 |
echo " $FILE" |
|
198 |
done |
|
199 |
} |
|
200 |
||
34282
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
201 |
rm -rf classes && mkdir classes |
45673
cd41e3903fbf
separate compilation of PIDE vs. Pure sources, which enables independent Scala library;
wenzelm
parents:
45672
diff
changeset
|
202 |
|
47009 | 203 |
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
|
204 |
|
50689 | 205 |
( |
53576
793a429c63e7
maintain classpath in more elementary manner: turn ISABELLE_CLASSPATH into -classpath option, so that all jars are covered by sun.misc.Launcher.AppClassLoader (e.g. relevant for loading add-on resources);
wenzelm
parents:
53519
diff
changeset
|
206 |
classpath "$ISABELLE_JDK_HOME/jre/lib/jfxrt.jar" |
793a429c63e7
maintain classpath in more elementary manner: turn ISABELLE_CLASSPATH into -classpath option, so that all jars are covered by sun.misc.Launcher.AppClassLoader (e.g. relevant for loading add-on resources);
wenzelm
parents:
53519
diff
changeset
|
207 |
classpath classes |
793a429c63e7
maintain classpath in more elementary manner: turn ISABELLE_CLASSPATH into -classpath option, so that all jars are covered by sun.misc.Launcher.AppClassLoader (e.g. relevant for loading add-on resources);
wenzelm
parents:
53519
diff
changeset
|
208 |
export CLASSPATH="$(jvmpath "$ISABELLE_CLASSPATH")" |
50689 | 209 |
|
210 |
if [ "$TEST_PIDE" = true ]; then |
|
211 |
isabelle_scala scalac $SCALAC_OPTIONS "${PIDE_SOURCES[@]}" || \ |
|
212 |
fail "Failed to compile PIDE sources" |
|
213 |
isabelle_scala scalac $SCALAC_OPTIONS "${PURE_SOURCES[@]}" || \ |
|
214 |
fail "Failed to compile Pure sources" |
|
215 |
else |
|
216 |
isabelle_scala scalac $SCALAC_OPTIONS "${PIDE_SOURCES[@]}" "${PURE_SOURCES[@]}" || \ |
|
217 |
fail "Failed to compile sources" |
|
218 |
fi |
|
51508 | 219 |
) || exit "$?" |
45673
cd41e3903fbf
separate compilation of PIDE vs. Pure sources, which enables independent Scala library;
wenzelm
parents:
45672
diff
changeset
|
220 |
|
53577 | 221 |
mkdir -p "$TARGET_DIR" || fail "Failed to create directory $TARGET_DIR" |
43280 | 222 |
|
43285 | 223 |
pushd classes >/dev/null |
43280 | 224 |
|
43517 | 225 |
CHARSET_SERVICE="META-INF/services/java.nio.charset.spi.CharsetProvider" |
226 |
mkdir -p "$(dirname "$CHARSET_SERVICE")" |
|
227 |
echo isabelle.Isabelle_Charset_Provider > "$CHARSET_SERVICE" |
|
228 |
||
54676
6b2ca4850b71
uniform use of transparent icons, as for main "apps";
wenzelm
parents:
54671
diff
changeset
|
229 |
cp "$ISABELLE_HOME/lib/logo/isabelle_transparent-32.gif" isabelle/. |
54709 | 230 |
cp "$ISABELLE_HOME/lib/logo/isabelle_transparent.gif" isabelle/. |
53452
8181bc357dc4
more portable access to icon -- avoid Isabelle_System which is not yet initialized in bootstrap;
wenzelm
parents:
53279
diff
changeset
|
231 |
|
53841 | 232 |
isabelle_jdk jar cfe "$(jvmpath "$TARGET")" isabelle.Main META-INF isabelle || \ |
43523 | 233 |
fail "Failed to produce $TARGET" |
34282
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
234 |
|
43280 | 235 |
popd >/dev/null |
236 |
||
34282
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
237 |
rm -rf classes |
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
238 |
fi |