author | wenzelm |
Sun, 07 Jul 2013 22:58:34 +0200 | |
changeset 52553 | d5d150d159ad |
parent 52530 | 99dd8b4ef3fe |
child 52667 | d2b12523186d |
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 |
|
52530
99dd8b4ef3fe
explicit module Document_ID as source of globally unique identifiers across ML/Scala;
wenzelm
parents:
52444
diff
changeset
|
36 |
PIDE/document_id.scala |
45670 | 37 |
PIDE/markup.scala |
43320 | 38 |
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
|
39 |
PIDE/protocol.scala |
43320 | 40 |
PIDE/text.scala |
44698 | 41 |
PIDE/xml.scala |
42 |
PIDE/yxml.scala |
|
49294 | 43 |
System/color_value.scala |
48346
e2382bede914
more general support for Isabelle/Scala command line tools;
wenzelm
parents:
48276
diff
changeset
|
44 |
System/command_line.scala |
52553 | 45 |
System/cygwin.scala |
43320 | 46 |
System/event_bus.scala |
51615
072a7249e1ac
separate module "GUI", to keep this out of the way of generic Isabelle_System operations, notably for non-Isabelle/jEdit applications;
wenzelm
parents:
51614
diff
changeset
|
47 |
System/gui.scala |
43320 | 48 |
System/gui_setup.scala |
49066 | 49 |
System/html5_panel.scala |
51250
ca13a14cc52e
support for POSIX interrupts (bypassed on Windows);
wenzelm
parents:
51098
diff
changeset
|
50 |
System/interrupt.scala |
43744
2c7e1565b4a3
some support to invoke Scala methods under program control;
wenzelm
parents:
43730
diff
changeset
|
51 |
System/invoke_scala.scala |
43517 | 52 |
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
|
53 |
System/isabelle_font.scala |
43320 | 54 |
System/isabelle_process.scala |
55 |
System/isabelle_system.scala |
|
49065 | 56 |
System/jfx_thread.scala |
48365
d88aefda01c4
basic support for stand-alone options with external string representation;
wenzelm
parents:
48346
diff
changeset
|
57 |
System/options.scala |
43320 | 58 |
System/platform.scala |
59 |
System/session.scala |
|
60 |
System/swing_thread.scala |
|
45027
f459e93a038e
more abstract wrapping of fifos as System_Channel;
wenzelm
parents:
44698
diff
changeset
|
61 |
System/system_channel.scala |
50203 | 62 |
System/utf8.scala |
43320 | 63 |
Thy/completion.scala |
64 |
Thy/html.scala |
|
50707
5b2bf7611662
maintain session index on Scala side, for more determistic results;
wenzelm
parents:
50689
diff
changeset
|
65 |
Thy/present.scala |
43320 | 66 |
Thy/thy_header.scala |
43651
511df47bcadc
some support for theory files within Isabelle/Scala session;
wenzelm
parents:
43600
diff
changeset
|
67 |
Thy/thy_info.scala |
511df47bcadc
some support for theory files within Isabelle/Scala session;
wenzelm
parents:
43600
diff
changeset
|
68 |
Thy/thy_load.scala |
43320 | 69 |
Thy/thy_syntax.scala |
50686 | 70 |
Tools/build.scala |
71 |
Tools/build_dialog.scala |
|
52444
2cfe6656d6d6
slightly improved "isabelle doc" based on Isabelle/Scala;
wenzelm
parents:
52439
diff
changeset
|
72 |
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
|
73 |
Tools/keywords.scala |
50687 | 74 |
Tools/main.scala |
50981 | 75 |
Tools/ml_statistics.scala |
50980 | 76 |
Tools/task_statistics.scala |
43320 | 77 |
library.scala |
78 |
package.scala |
|
43730
a0ed7bc688b5
lambda terms with XML data representation in Scala;
wenzelm
parents:
43715
diff
changeset
|
79 |
term.scala |
43779 | 80 |
term_xml.scala |
43320 | 81 |
) |
82 |
||
34282
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
83 |
|
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
84 |
## diagnostics |
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
85 |
|
43280 | 86 |
PRG="$(basename "$0")" |
87 |
||
88 |
function usage() |
|
89 |
{ |
|
90 |
echo |
|
91 |
echo "Usage: isabelle $PRG [OPTIONS]" |
|
92 |
echo |
|
93 |
echo " Options are:" |
|
94 |
echo " -f fresh build" |
|
47408
63c05991882e
slightly faster default compilation of Isabelle/Scala;
wenzelm
parents:
47115
diff
changeset
|
95 |
echo " -t test separate compilation of PIDE" |
43280 | 96 |
echo |
97 |
exit 1 |
|
98 |
} |
|
99 |
||
34282
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
100 |
function fail() |
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 |
echo "$1" >&2 |
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
103 |
exit 2 |
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
104 |
} |
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
105 |
|
42899 | 106 |
[ -z "$ISABELLE_HOME" ] && fail "Missing Isabelle settings environment" |
34282
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
107 |
|
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
108 |
|
43280 | 109 |
## process command line |
110 |
||
111 |
# options |
|
112 |
||
113 |
FRESH="" |
|
47408
63c05991882e
slightly faster default compilation of Isabelle/Scala;
wenzelm
parents:
47115
diff
changeset
|
114 |
TEST_PIDE="" |
43280 | 115 |
|
47408
63c05991882e
slightly faster default compilation of Isabelle/Scala;
wenzelm
parents:
47115
diff
changeset
|
116 |
while getopts "ft" OPT |
43280 | 117 |
do |
118 |
case "$OPT" in |
|
119 |
f) |
|
120 |
FRESH=true |
|
121 |
;; |
|
47408
63c05991882e
slightly faster default compilation of Isabelle/Scala;
wenzelm
parents:
47115
diff
changeset
|
122 |
t) |
63c05991882e
slightly faster default compilation of Isabelle/Scala;
wenzelm
parents:
47115
diff
changeset
|
123 |
TEST_PIDE=true |
63c05991882e
slightly faster default compilation of Isabelle/Scala;
wenzelm
parents:
47115
diff
changeset
|
124 |
;; |
43280 | 125 |
\?) |
126 |
usage |
|
127 |
;; |
|
128 |
esac |
|
129 |
done |
|
130 |
||
131 |
shift $(($OPTIND - 1)) |
|
132 |
||
133 |
||
134 |
# args |
|
135 |
||
136 |
[ "$#" -ne 0 ] && usage |
|
137 |
||
138 |
||
50689 | 139 |
## dependencies |
140 |
||
141 |
declare -a JFREECHART_JARS=() |
|
142 |
for NAME in $JFREECHART_JAR_NAMES |
|
143 |
do |
|
144 |
JFREECHART_JARS["${#JFREECHART_JARS[@]}"]="$JFREECHART_HOME/lib/$NAME" |
|
145 |
done |
|
146 |
||
147 |
||
49558 | 148 |
## build |
34282
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
149 |
|
34284 | 150 |
TARGET_DIR="$ISABELLE_HOME/lib/classes" |
43523 | 151 |
TARGET="$TARGET_DIR/ext/Pure.jar" |
34282
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
152 |
|
45673
cd41e3903fbf
separate compilation of PIDE vs. Pure sources, which enables independent Scala library;
wenzelm
parents:
45672
diff
changeset
|
153 |
declare -a PIDE_SOURCES=() |
cd41e3903fbf
separate compilation of PIDE vs. Pure sources, which enables independent Scala library;
wenzelm
parents:
45672
diff
changeset
|
154 |
declare -a PURE_SOURCES=() |
cd41e3903fbf
separate compilation of PIDE vs. Pure sources, which enables independent Scala library;
wenzelm
parents:
45672
diff
changeset
|
155 |
|
cd41e3903fbf
separate compilation of PIDE vs. Pure sources, which enables independent Scala library;
wenzelm
parents:
45672
diff
changeset
|
156 |
for DEP in "${SOURCES[@]}" |
cd41e3903fbf
separate compilation of PIDE vs. Pure sources, which enables independent Scala library;
wenzelm
parents:
45672
diff
changeset
|
157 |
do |
cd41e3903fbf
separate compilation of PIDE vs. Pure sources, which enables independent Scala library;
wenzelm
parents:
45672
diff
changeset
|
158 |
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
|
159 |
then |
cd41e3903fbf
separate compilation of PIDE vs. Pure sources, which enables independent Scala library;
wenzelm
parents:
45672
diff
changeset
|
160 |
PIDE_SOURCES["${#PIDE_SOURCES[@]}"]="$DEP" |
cd41e3903fbf
separate compilation of PIDE vs. Pure sources, which enables independent Scala library;
wenzelm
parents:
45672
diff
changeset
|
161 |
else |
cd41e3903fbf
separate compilation of PIDE vs. Pure sources, which enables independent Scala library;
wenzelm
parents:
45672
diff
changeset
|
162 |
PURE_SOURCES["${#PURE_SOURCES[@]}"]="$DEP" |
cd41e3903fbf
separate compilation of PIDE vs. Pure sources, which enables independent Scala library;
wenzelm
parents:
45672
diff
changeset
|
163 |
fi |
cd41e3903fbf
separate compilation of PIDE vs. Pure sources, which enables independent Scala library;
wenzelm
parents:
45672
diff
changeset
|
164 |
done |
cd41e3903fbf
separate compilation of PIDE vs. Pure sources, which enables independent Scala library;
wenzelm
parents:
45672
diff
changeset
|
165 |
|
43405 | 166 |
declare -a UPDATED=() |
167 |
||
43280 | 168 |
if [ -n "$FRESH" ]; then |
169 |
OUTDATED=true |
|
170 |
else |
|
171 |
OUTDATED=false |
|
43523 | 172 |
if [ ! -e "$TARGET" ]; then |
173 |
OUTDATED=true |
|
174 |
else |
|
43405 | 175 |
for DEP in "${SOURCES[@]}" |
43280 | 176 |
do |
43405 | 177 |
[ ! -e "$DEP" ] && fail "Missing file: $DEP" |
43523 | 178 |
[ "$DEP" -nt "$TARGET" ] && { |
179 |
OUTDATED=true |
|
180 |
UPDATED["${#UPDATED[@]}"]="$DEP" |
|
181 |
} |
|
43280 | 182 |
done |
43405 | 183 |
fi |
43280 | 184 |
fi |
34282
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
185 |
|
34284 | 186 |
if [ "$OUTDATED" = true ] |
187 |
then |
|
49173
fa01a202399c
eliminated potentially confusing terminology of Scala "layer";
wenzelm
parents:
49068
diff
changeset
|
188 |
echo "### Building Isabelle/Scala ..." |
34282
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
189 |
|
43405 | 190 |
[ "${#UPDATED[@]}" -gt 0 ] && { |
191 |
echo "Changed files:" |
|
192 |
for FILE in "${UPDATED[@]}" |
|
193 |
do |
|
194 |
echo " $FILE" |
|
195 |
done |
|
196 |
} |
|
197 |
||
34282
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
198 |
rm -rf classes && mkdir classes |
45673
cd41e3903fbf
separate compilation of PIDE vs. Pure sources, which enables independent Scala library;
wenzelm
parents:
45672
diff
changeset
|
199 |
|
47009 | 200 |
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
|
201 |
|
49067 | 202 |
JFXRT="$ISABELLE_JDK_HOME/jre/lib/jfxrt.jar" |
203 |
||
50689 | 204 |
( |
51504 | 205 |
for X in "$JFXRT" "${JFREECHART_JARS[@]}" "$XZ_JAVA_HOME/lib/xz.jar" classes |
50689 | 206 |
do |
207 |
CLASSPATH="$CLASSPATH:$X" |
|
208 |
done |
|
209 |
CLASSPATH="$(jvmpath "$CLASSPATH")" |
|
210 |
||
211 |
if [ "$TEST_PIDE" = true ]; then |
|
212 |
isabelle_scala scalac $SCALAC_OPTIONS "${PIDE_SOURCES[@]}" || \ |
|
213 |
fail "Failed to compile PIDE sources" |
|
214 |
isabelle_scala scalac $SCALAC_OPTIONS "${PURE_SOURCES[@]}" || \ |
|
215 |
fail "Failed to compile Pure sources" |
|
216 |
else |
|
217 |
isabelle_scala scalac $SCALAC_OPTIONS "${PIDE_SOURCES[@]}" "${PURE_SOURCES[@]}" || \ |
|
218 |
fail "Failed to compile sources" |
|
219 |
fi |
|
51508 | 220 |
) || exit "$?" |
45673
cd41e3903fbf
separate compilation of PIDE vs. Pure sources, which enables independent Scala library;
wenzelm
parents:
45672
diff
changeset
|
221 |
|
43523 | 222 |
mkdir -p "$TARGET_DIR/ext" || fail "Failed to create directory $TARGET_DIR/ext" |
43280 | 223 |
|
43285 | 224 |
pushd classes >/dev/null |
43280 | 225 |
|
43517 | 226 |
CHARSET_SERVICE="META-INF/services/java.nio.charset.spi.CharsetProvider" |
227 |
mkdir -p "$(dirname "$CHARSET_SERVICE")" |
|
228 |
echo isabelle.Isabelle_Charset_Provider > "$CHARSET_SERVICE" |
|
229 |
||
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
|
230 |
isabelle_jdk jar cfe "$(jvmpath "$TARGET")" isabelle.GUI_Setup META-INF isabelle || \ |
43523 | 231 |
fail "Failed to produce $TARGET" |
34282
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
232 |
|
49449 | 233 |
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
|
234 |
"$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
|
235 |
"$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
|
236 |
|
47849 | 237 |
[ -e "$SCALA_HOME/lib/scala-actors.jar" ] && \ |
238 |
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
|
239 |
|
49955 | 240 |
[ -e "$SCALA_HOME/lib/scala-reflect.jar" ] && \ |
241 |
cp "$SCALA_HOME/lib/scala-reflect.jar" "$TARGET_DIR/ext" |
|
242 |
||
43280 | 243 |
popd >/dev/null |
244 |
||
34282
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
245 |
rm -rf classes |
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
246 |
fi |