author | wenzelm |
Sun, 25 Nov 2012 19:49:24 +0100 | |
changeset 50201 | c26369c9eda6 |
parent 49955 | 10b2c0b68a4d |
child 50203 | 00d8ad713e32 |
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/markup.scala |
43320 | 36 |
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
|
37 |
PIDE/protocol.scala |
43320 | 38 |
PIDE/text.scala |
44698 | 39 |
PIDE/xml.scala |
40 |
PIDE/yxml.scala |
|
48276 | 41 |
System/build.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 |
43744
2c7e1565b4a3
some support to invoke Scala methods under program control;
wenzelm
parents:
43730
diff
changeset
|
47 |
System/invoke_scala.scala |
43517 | 48 |
System/isabelle_charset.scala |
43320 | 49 |
System/isabelle_process.scala |
50 |
System/isabelle_system.scala |
|
49065 | 51 |
System/jfx_thread.scala |
47663
20e0865ae9e7
default Isabelle application wrapper -- JVM entry point for Isabelle.exe;
wenzelm
parents:
47408
diff
changeset
|
52 |
System/main.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/standard_system.scala |
|
57 |
System/swing_thread.scala |
|
45027
f459e93a038e
more abstract wrapping of fifos as System_Channel;
wenzelm
parents:
44698
diff
changeset
|
58 |
System/system_channel.scala |
43320 | 59 |
Thy/completion.scala |
60 |
Thy/html.scala |
|
61 |
Thy/thy_header.scala |
|
43651
511df47bcadc
some support for theory files within Isabelle/Scala session;
wenzelm
parents:
43600
diff
changeset
|
62 |
Thy/thy_info.scala |
511df47bcadc
some support for theory files within Isabelle/Scala session;
wenzelm
parents:
43600
diff
changeset
|
63 |
Thy/thy_load.scala |
43320 | 64 |
Thy/thy_syntax.scala |
65 |
library.scala |
|
66 |
package.scala |
|
43730
a0ed7bc688b5
lambda terms with XML data representation in Scala;
wenzelm
parents:
43715
diff
changeset
|
67 |
term.scala |
43779 | 68 |
term_xml.scala |
43320 | 69 |
) |
70 |
||
34282
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
71 |
|
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
72 |
## diagnostics |
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
73 |
|
43280 | 74 |
PRG="$(basename "$0")" |
75 |
||
76 |
function usage() |
|
77 |
{ |
|
78 |
echo |
|
79 |
echo "Usage: isabelle $PRG [OPTIONS]" |
|
80 |
echo |
|
81 |
echo " Options are:" |
|
82 |
echo " -f fresh build" |
|
47408
63c05991882e
slightly faster default compilation of Isabelle/Scala;
wenzelm
parents:
47115
diff
changeset
|
83 |
echo " -t test separate compilation of PIDE" |
43280 | 84 |
echo |
85 |
exit 1 |
|
86 |
} |
|
87 |
||
34282
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
88 |
function fail() |
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
89 |
{ |
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
90 |
echo "$1" >&2 |
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
91 |
exit 2 |
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
92 |
} |
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
93 |
|
42899 | 94 |
[ -z "$ISABELLE_HOME" ] && fail "Missing Isabelle settings environment" |
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 |
|
43280 | 97 |
## process command line |
98 |
||
99 |
# options |
|
100 |
||
101 |
FRESH="" |
|
47408
63c05991882e
slightly faster default compilation of Isabelle/Scala;
wenzelm
parents:
47115
diff
changeset
|
102 |
TEST_PIDE="" |
43280 | 103 |
|
47408
63c05991882e
slightly faster default compilation of Isabelle/Scala;
wenzelm
parents:
47115
diff
changeset
|
104 |
while getopts "ft" OPT |
43280 | 105 |
do |
106 |
case "$OPT" in |
|
107 |
f) |
|
108 |
FRESH=true |
|
109 |
;; |
|
47408
63c05991882e
slightly faster default compilation of Isabelle/Scala;
wenzelm
parents:
47115
diff
changeset
|
110 |
t) |
63c05991882e
slightly faster default compilation of Isabelle/Scala;
wenzelm
parents:
47115
diff
changeset
|
111 |
TEST_PIDE=true |
63c05991882e
slightly faster default compilation of Isabelle/Scala;
wenzelm
parents:
47115
diff
changeset
|
112 |
;; |
43280 | 113 |
\?) |
114 |
usage |
|
115 |
;; |
|
116 |
esac |
|
117 |
done |
|
118 |
||
119 |
shift $(($OPTIND - 1)) |
|
120 |
||
121 |
||
122 |
# args |
|
123 |
||
124 |
[ "$#" -ne 0 ] && usage |
|
125 |
||
126 |
||
49558 | 127 |
## build |
34282
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
128 |
|
34284 | 129 |
TARGET_DIR="$ISABELLE_HOME/lib/classes" |
43523 | 130 |
TARGET="$TARGET_DIR/ext/Pure.jar" |
34282
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
131 |
|
45673
cd41e3903fbf
separate compilation of PIDE vs. Pure sources, which enables independent Scala library;
wenzelm
parents:
45672
diff
changeset
|
132 |
declare -a PIDE_SOURCES=() |
cd41e3903fbf
separate compilation of PIDE vs. Pure sources, which enables independent Scala library;
wenzelm
parents:
45672
diff
changeset
|
133 |
declare -a PURE_SOURCES=() |
cd41e3903fbf
separate compilation of PIDE vs. Pure sources, which enables independent Scala library;
wenzelm
parents:
45672
diff
changeset
|
134 |
|
cd41e3903fbf
separate compilation of PIDE vs. Pure sources, which enables independent Scala library;
wenzelm
parents:
45672
diff
changeset
|
135 |
for DEP in "${SOURCES[@]}" |
cd41e3903fbf
separate compilation of PIDE vs. Pure sources, which enables independent Scala library;
wenzelm
parents:
45672
diff
changeset
|
136 |
do |
cd41e3903fbf
separate compilation of PIDE vs. Pure sources, which enables independent Scala library;
wenzelm
parents:
45672
diff
changeset
|
137 |
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
|
138 |
then |
cd41e3903fbf
separate compilation of PIDE vs. Pure sources, which enables independent Scala library;
wenzelm
parents:
45672
diff
changeset
|
139 |
PIDE_SOURCES["${#PIDE_SOURCES[@]}"]="$DEP" |
cd41e3903fbf
separate compilation of PIDE vs. Pure sources, which enables independent Scala library;
wenzelm
parents:
45672
diff
changeset
|
140 |
else |
cd41e3903fbf
separate compilation of PIDE vs. Pure sources, which enables independent Scala library;
wenzelm
parents:
45672
diff
changeset
|
141 |
PURE_SOURCES["${#PURE_SOURCES[@]}"]="$DEP" |
cd41e3903fbf
separate compilation of PIDE vs. Pure sources, which enables independent Scala library;
wenzelm
parents:
45672
diff
changeset
|
142 |
fi |
cd41e3903fbf
separate compilation of PIDE vs. Pure sources, which enables independent Scala library;
wenzelm
parents:
45672
diff
changeset
|
143 |
done |
cd41e3903fbf
separate compilation of PIDE vs. Pure sources, which enables independent Scala library;
wenzelm
parents:
45672
diff
changeset
|
144 |
|
43405 | 145 |
declare -a UPDATED=() |
146 |
||
43280 | 147 |
if [ -n "$FRESH" ]; then |
148 |
OUTDATED=true |
|
149 |
else |
|
150 |
OUTDATED=false |
|
43523 | 151 |
if [ ! -e "$TARGET" ]; then |
152 |
OUTDATED=true |
|
153 |
else |
|
43405 | 154 |
for DEP in "${SOURCES[@]}" |
43280 | 155 |
do |
43405 | 156 |
[ ! -e "$DEP" ] && fail "Missing file: $DEP" |
43523 | 157 |
[ "$DEP" -nt "$TARGET" ] && { |
158 |
OUTDATED=true |
|
159 |
UPDATED["${#UPDATED[@]}"]="$DEP" |
|
160 |
} |
|
43280 | 161 |
done |
43405 | 162 |
fi |
43280 | 163 |
fi |
34282
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
164 |
|
34284 | 165 |
if [ "$OUTDATED" = true ] |
166 |
then |
|
49173
fa01a202399c
eliminated potentially confusing terminology of Scala "layer";
wenzelm
parents:
49068
diff
changeset
|
167 |
echo "### Building Isabelle/Scala ..." |
34282
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
168 |
|
43405 | 169 |
[ "${#UPDATED[@]}" -gt 0 ] && { |
170 |
echo "Changed files:" |
|
171 |
for FILE in "${UPDATED[@]}" |
|
172 |
do |
|
173 |
echo " $FILE" |
|
174 |
done |
|
175 |
} |
|
176 |
||
34282
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
177 |
rm -rf classes && mkdir classes |
45673
cd41e3903fbf
separate compilation of PIDE vs. Pure sources, which enables independent Scala library;
wenzelm
parents:
45672
diff
changeset
|
178 |
|
47009 | 179 |
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
|
180 |
|
49067 | 181 |
JFXRT="$ISABELLE_JDK_HOME/jre/lib/jfxrt.jar" |
182 |
||
47408
63c05991882e
slightly faster default compilation of Isabelle/Scala;
wenzelm
parents:
47115
diff
changeset
|
183 |
if [ "$TEST_PIDE" = true ]; then |
63c05991882e
slightly faster default compilation of Isabelle/Scala;
wenzelm
parents:
47115
diff
changeset
|
184 |
isabelle_scala scalac $SCALAC_OPTIONS "${PIDE_SOURCES[@]}" || \ |
63c05991882e
slightly faster default compilation of Isabelle/Scala;
wenzelm
parents:
47115
diff
changeset
|
185 |
fail "Failed to compile PIDE sources" |
49068 | 186 |
isabelle_scala scalac $SCALAC_OPTIONS \ |
187 |
-classpath "$(jvmpath "$JFXRT:classes")" "${PURE_SOURCES[@]}" || \ |
|
47408
63c05991882e
slightly faster default compilation of Isabelle/Scala;
wenzelm
parents:
47115
diff
changeset
|
188 |
fail "Failed to compile Pure sources" |
63c05991882e
slightly faster default compilation of Isabelle/Scala;
wenzelm
parents:
47115
diff
changeset
|
189 |
else |
49068 | 190 |
isabelle_scala scalac $SCALAC_OPTIONS \ |
191 |
-classpath "$(jvmpath "$JFXRT:classes")" "${PIDE_SOURCES[@]}" "${PURE_SOURCES[@]}" || \ |
|
47408
63c05991882e
slightly faster default compilation of Isabelle/Scala;
wenzelm
parents:
47115
diff
changeset
|
192 |
fail "Failed to compile sources" |
63c05991882e
slightly faster default compilation of Isabelle/Scala;
wenzelm
parents:
47115
diff
changeset
|
193 |
fi |
45673
cd41e3903fbf
separate compilation of PIDE vs. Pure sources, which enables independent Scala library;
wenzelm
parents:
45672
diff
changeset
|
194 |
|
43523 | 195 |
mkdir -p "$TARGET_DIR/ext" || fail "Failed to create directory $TARGET_DIR/ext" |
43280 | 196 |
|
43285 | 197 |
pushd classes >/dev/null |
43280 | 198 |
|
43517 | 199 |
CHARSET_SERVICE="META-INF/services/java.nio.charset.spi.CharsetProvider" |
200 |
mkdir -p "$(dirname "$CHARSET_SERVICE")" |
|
201 |
echo isabelle.Isabelle_Charset_Provider > "$CHARSET_SERVICE" |
|
202 |
||
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
|
203 |
isabelle_jdk jar cfe "$(jvmpath "$TARGET")" isabelle.GUI_Setup META-INF isabelle || \ |
43523 | 204 |
fail "Failed to produce $TARGET" |
34282
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
205 |
|
49449 | 206 |
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
|
207 |
"$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
|
208 |
"$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
|
209 |
|
47849 | 210 |
[ -e "$SCALA_HOME/lib/scala-actors.jar" ] && \ |
211 |
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
|
212 |
|
49955 | 213 |
[ -e "$SCALA_HOME/lib/scala-reflect.jar" ] && \ |
214 |
cp "$SCALA_HOME/lib/scala-reflect.jar" "$TARGET_DIR/ext" |
|
215 |
||
43280 | 216 |
popd >/dev/null |
217 |
||
34282
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
218 |
rm -rf classes |
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
219 |
fi |