author | wenzelm |
Sat, 20 Oct 2012 17:15:40 +0200 | |
changeset 49955 | 10b2c0b68a4d |
parent 49678 | 954d1c94f55f |
child 50201 | c26369c9eda6 |
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 |
43320 | 19 |
General/linear_set.scala |
43600
4ac04bf9ff89
abstract algebra of file paths in Scala (cf. path.ML);
wenzelm
parents:
43523
diff
changeset
|
20 |
General/path.scala |
43320 | 21 |
General/position.scala |
22 |
General/pretty.scala |
|
43780 | 23 |
General/properties.scala |
43320 | 24 |
General/scan.scala |
25 |
General/sha1.scala |
|
26 |
General/symbol.scala |
|
45674 | 27 |
General/time.scala |
45666 | 28 |
General/timing.scala |
43320 | 29 |
Isar/keyword.scala |
30 |
Isar/outer_syntax.scala |
|
31 |
Isar/parse.scala |
|
32 |
Isar/token.scala |
|
33 |
PIDE/command.scala |
|
34 |
PIDE/document.scala |
|
45670 | 35 |
PIDE/isabelle_markup.scala |
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 |
|
48276 | 42 |
System/build.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 |
43320 | 45 |
System/event_bus.scala |
46 |
System/gui_setup.scala |
|
49066 | 47 |
System/html5_panel.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 |
47663
20e0865ae9e7
default Isabelle application wrapper -- JVM entry point for Isabelle.exe;
wenzelm
parents:
47408
diff
changeset
|
53 |
System/main.scala |
48365
d88aefda01c4
basic support for stand-alone options with external string representation;
wenzelm
parents:
48346
diff
changeset
|
54 |
System/options.scala |
43320 | 55 |
System/platform.scala |
56 |
System/session.scala |
|
57 |
System/standard_system.scala |
|
58 |
System/swing_thread.scala |
|
45027
f459e93a038e
more abstract wrapping of fifos as System_Channel;
wenzelm
parents:
44698
diff
changeset
|
59 |
System/system_channel.scala |
43320 | 60 |
Thy/completion.scala |
61 |
Thy/html.scala |
|
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 |
66 |
library.scala |
|
67 |
package.scala |
|
43730
a0ed7bc688b5
lambda terms with XML data representation in Scala;
wenzelm
parents:
43715
diff
changeset
|
68 |
term.scala |
43779 | 69 |
term_xml.scala |
43320 | 70 |
) |
71 |
||
34282
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
72 |
|
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
73 |
## diagnostics |
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
74 |
|
43280 | 75 |
PRG="$(basename "$0")" |
76 |
||
77 |
function usage() |
|
78 |
{ |
|
79 |
echo |
|
80 |
echo "Usage: isabelle $PRG [OPTIONS]" |
|
81 |
echo |
|
82 |
echo " Options are:" |
|
83 |
echo " -f fresh build" |
|
47408
63c05991882e
slightly faster default compilation of Isabelle/Scala;
wenzelm
parents:
47115
diff
changeset
|
84 |
echo " -t test separate compilation of PIDE" |
43280 | 85 |
echo |
86 |
exit 1 |
|
87 |
} |
|
88 |
||
34282
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
89 |
function fail() |
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
90 |
{ |
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
91 |
echo "$1" >&2 |
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
92 |
exit 2 |
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
93 |
} |
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
94 |
|
42899 | 95 |
[ -z "$ISABELLE_HOME" ] && fail "Missing Isabelle settings environment" |
34282
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
96 |
|
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
97 |
|
43280 | 98 |
## process command line |
99 |
||
100 |
# options |
|
101 |
||
102 |
FRESH="" |
|
47408
63c05991882e
slightly faster default compilation of Isabelle/Scala;
wenzelm
parents:
47115
diff
changeset
|
103 |
TEST_PIDE="" |
43280 | 104 |
|
47408
63c05991882e
slightly faster default compilation of Isabelle/Scala;
wenzelm
parents:
47115
diff
changeset
|
105 |
while getopts "ft" OPT |
43280 | 106 |
do |
107 |
case "$OPT" in |
|
108 |
f) |
|
109 |
FRESH=true |
|
110 |
;; |
|
47408
63c05991882e
slightly faster default compilation of Isabelle/Scala;
wenzelm
parents:
47115
diff
changeset
|
111 |
t) |
63c05991882e
slightly faster default compilation of Isabelle/Scala;
wenzelm
parents:
47115
diff
changeset
|
112 |
TEST_PIDE=true |
63c05991882e
slightly faster default compilation of Isabelle/Scala;
wenzelm
parents:
47115
diff
changeset
|
113 |
;; |
43280 | 114 |
\?) |
115 |
usage |
|
116 |
;; |
|
117 |
esac |
|
118 |
done |
|
119 |
||
120 |
shift $(($OPTIND - 1)) |
|
121 |
||
122 |
||
123 |
# args |
|
124 |
||
125 |
[ "$#" -ne 0 ] && usage |
|
126 |
||
127 |
||
49558 | 128 |
## build |
34282
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
129 |
|
34284 | 130 |
TARGET_DIR="$ISABELLE_HOME/lib/classes" |
43523 | 131 |
TARGET="$TARGET_DIR/ext/Pure.jar" |
34282
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
132 |
|
45673
cd41e3903fbf
separate compilation of PIDE vs. Pure sources, which enables independent Scala library;
wenzelm
parents:
45672
diff
changeset
|
133 |
declare -a PIDE_SOURCES=() |
cd41e3903fbf
separate compilation of PIDE vs. Pure sources, which enables independent Scala library;
wenzelm
parents:
45672
diff
changeset
|
134 |
declare -a PURE_SOURCES=() |
cd41e3903fbf
separate compilation of PIDE vs. Pure sources, which enables independent Scala library;
wenzelm
parents:
45672
diff
changeset
|
135 |
|
cd41e3903fbf
separate compilation of PIDE vs. Pure sources, which enables independent Scala library;
wenzelm
parents:
45672
diff
changeset
|
136 |
for DEP in "${SOURCES[@]}" |
cd41e3903fbf
separate compilation of PIDE vs. Pure sources, which enables independent Scala library;
wenzelm
parents:
45672
diff
changeset
|
137 |
do |
cd41e3903fbf
separate compilation of PIDE vs. Pure sources, which enables independent Scala library;
wenzelm
parents:
45672
diff
changeset
|
138 |
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
|
139 |
then |
cd41e3903fbf
separate compilation of PIDE vs. Pure sources, which enables independent Scala library;
wenzelm
parents:
45672
diff
changeset
|
140 |
PIDE_SOURCES["${#PIDE_SOURCES[@]}"]="$DEP" |
cd41e3903fbf
separate compilation of PIDE vs. Pure sources, which enables independent Scala library;
wenzelm
parents:
45672
diff
changeset
|
141 |
else |
cd41e3903fbf
separate compilation of PIDE vs. Pure sources, which enables independent Scala library;
wenzelm
parents:
45672
diff
changeset
|
142 |
PURE_SOURCES["${#PURE_SOURCES[@]}"]="$DEP" |
cd41e3903fbf
separate compilation of PIDE vs. Pure sources, which enables independent Scala library;
wenzelm
parents:
45672
diff
changeset
|
143 |
fi |
cd41e3903fbf
separate compilation of PIDE vs. Pure sources, which enables independent Scala library;
wenzelm
parents:
45672
diff
changeset
|
144 |
done |
cd41e3903fbf
separate compilation of PIDE vs. Pure sources, which enables independent Scala library;
wenzelm
parents:
45672
diff
changeset
|
145 |
|
43405 | 146 |
declare -a UPDATED=() |
147 |
||
43280 | 148 |
if [ -n "$FRESH" ]; then |
149 |
OUTDATED=true |
|
150 |
else |
|
151 |
OUTDATED=false |
|
43523 | 152 |
if [ ! -e "$TARGET" ]; then |
153 |
OUTDATED=true |
|
154 |
else |
|
43405 | 155 |
for DEP in "${SOURCES[@]}" |
43280 | 156 |
do |
43405 | 157 |
[ ! -e "$DEP" ] && fail "Missing file: $DEP" |
43523 | 158 |
[ "$DEP" -nt "$TARGET" ] && { |
159 |
OUTDATED=true |
|
160 |
UPDATED["${#UPDATED[@]}"]="$DEP" |
|
161 |
} |
|
43280 | 162 |
done |
43405 | 163 |
fi |
43280 | 164 |
fi |
34282
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
165 |
|
34284 | 166 |
if [ "$OUTDATED" = true ] |
167 |
then |
|
49173
fa01a202399c
eliminated potentially confusing terminology of Scala "layer";
wenzelm
parents:
49068
diff
changeset
|
168 |
echo "### Building Isabelle/Scala ..." |
34282
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
169 |
|
43405 | 170 |
[ "${#UPDATED[@]}" -gt 0 ] && { |
171 |
echo "Changed files:" |
|
172 |
for FILE in "${UPDATED[@]}" |
|
173 |
do |
|
174 |
echo " $FILE" |
|
175 |
done |
|
176 |
} |
|
177 |
||
34282
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
178 |
rm -rf classes && mkdir classes |
45673
cd41e3903fbf
separate compilation of PIDE vs. Pure sources, which enables independent Scala library;
wenzelm
parents:
45672
diff
changeset
|
179 |
|
47009 | 180 |
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
|
181 |
|
49067 | 182 |
JFXRT="$ISABELLE_JDK_HOME/jre/lib/jfxrt.jar" |
183 |
||
47408
63c05991882e
slightly faster default compilation of Isabelle/Scala;
wenzelm
parents:
47115
diff
changeset
|
184 |
if [ "$TEST_PIDE" = true ]; then |
63c05991882e
slightly faster default compilation of Isabelle/Scala;
wenzelm
parents:
47115
diff
changeset
|
185 |
isabelle_scala scalac $SCALAC_OPTIONS "${PIDE_SOURCES[@]}" || \ |
63c05991882e
slightly faster default compilation of Isabelle/Scala;
wenzelm
parents:
47115
diff
changeset
|
186 |
fail "Failed to compile PIDE sources" |
49068 | 187 |
isabelle_scala scalac $SCALAC_OPTIONS \ |
188 |
-classpath "$(jvmpath "$JFXRT:classes")" "${PURE_SOURCES[@]}" || \ |
|
47408
63c05991882e
slightly faster default compilation of Isabelle/Scala;
wenzelm
parents:
47115
diff
changeset
|
189 |
fail "Failed to compile Pure sources" |
63c05991882e
slightly faster default compilation of Isabelle/Scala;
wenzelm
parents:
47115
diff
changeset
|
190 |
else |
49068 | 191 |
isabelle_scala scalac $SCALAC_OPTIONS \ |
192 |
-classpath "$(jvmpath "$JFXRT:classes")" "${PIDE_SOURCES[@]}" "${PURE_SOURCES[@]}" || \ |
|
47408
63c05991882e
slightly faster default compilation of Isabelle/Scala;
wenzelm
parents:
47115
diff
changeset
|
193 |
fail "Failed to compile sources" |
63c05991882e
slightly faster default compilation of Isabelle/Scala;
wenzelm
parents:
47115
diff
changeset
|
194 |
fi |
45673
cd41e3903fbf
separate compilation of PIDE vs. Pure sources, which enables independent Scala library;
wenzelm
parents:
45672
diff
changeset
|
195 |
|
43523 | 196 |
mkdir -p "$TARGET_DIR/ext" || fail "Failed to create directory $TARGET_DIR/ext" |
43280 | 197 |
|
43285 | 198 |
pushd classes >/dev/null |
43280 | 199 |
|
43517 | 200 |
CHARSET_SERVICE="META-INF/services/java.nio.charset.spi.CharsetProvider" |
201 |
mkdir -p "$(dirname "$CHARSET_SERVICE")" |
|
202 |
echo isabelle.Isabelle_Charset_Provider > "$CHARSET_SERVICE" |
|
203 |
||
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
|
204 |
isabelle_jdk jar cfe "$(jvmpath "$TARGET")" isabelle.GUI_Setup META-INF isabelle || \ |
43523 | 205 |
fail "Failed to produce $TARGET" |
34282
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
206 |
|
49449 | 207 |
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
|
208 |
"$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
|
209 |
"$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
|
210 |
|
47849 | 211 |
[ -e "$SCALA_HOME/lib/scala-actors.jar" ] && \ |
212 |
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
|
213 |
|
49955 | 214 |
[ -e "$SCALA_HOME/lib/scala-reflect.jar" ] && \ |
215 |
cp "$SCALA_HOME/lib/scala-reflect.jar" "$TARGET_DIR/ext" |
|
216 |
||
43280 | 217 |
popd >/dev/null |
218 |
||
34282
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
219 |
rm -rf classes |
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
220 |
fi |