author | wenzelm |
Thu, 24 May 2012 23:28:58 +0200 | |
changeset 47997 | 0a43fc778cd2 |
parent 47995 | 72f52cd7c633 |
child 47998 | 969457d93f75 |
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 |
|
46611 | 17 |
General/graph.scala |
43320 | 18 |
General/linear_set.scala |
43600
4ac04bf9ff89
abstract algebra of file paths in Scala (cf. path.ML);
wenzelm
parents:
43523
diff
changeset
|
19 |
General/path.scala |
43320 | 20 |
General/position.scala |
21 |
General/pretty.scala |
|
43780 | 22 |
General/properties.scala |
43320 | 23 |
General/scan.scala |
24 |
General/sha1.scala |
|
25 |
General/symbol.scala |
|
45674 | 26 |
General/time.scala |
45666 | 27 |
General/timing.scala |
43320 | 28 |
Isar/keyword.scala |
29 |
Isar/outer_syntax.scala |
|
30 |
Isar/parse.scala |
|
31 |
Isar/token.scala |
|
43715
518e44a0ee15
some support for blobs (arbitrary text files) within document nodes;
wenzelm
parents:
43695
diff
changeset
|
32 |
PIDE/blob.scala |
43320 | 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 |
|
43320 | 42 |
System/cygwin.scala |
43 |
System/event_bus.scala |
|
44 |
System/gui_setup.scala |
|
43744
2c7e1565b4a3
some support to invoke Scala methods under program control;
wenzelm
parents:
43730
diff
changeset
|
45 |
System/invoke_scala.scala |
43517 | 46 |
System/isabelle_charset.scala |
43320 | 47 |
System/isabelle_process.scala |
48 |
System/isabelle_system.scala |
|
47663
20e0865ae9e7
default Isabelle application wrapper -- JVM entry point for Isabelle.exe;
wenzelm
parents:
47408
diff
changeset
|
49 |
System/main.scala |
43320 | 50 |
System/platform.scala |
51 |
System/session.scala |
|
52 |
System/session_manager.scala |
|
53 |
System/standard_system.scala |
|
54 |
System/swing_thread.scala |
|
45027
f459e93a038e
more abstract wrapping of fifos as System_Channel;
wenzelm
parents:
44698
diff
changeset
|
55 |
System/system_channel.scala |
43320 | 56 |
Thy/completion.scala |
57 |
Thy/html.scala |
|
58 |
Thy/thy_header.scala |
|
43651
511df47bcadc
some support for theory files within Isabelle/Scala session;
wenzelm
parents:
43600
diff
changeset
|
59 |
Thy/thy_info.scala |
511df47bcadc
some support for theory files within Isabelle/Scala session;
wenzelm
parents:
43600
diff
changeset
|
60 |
Thy/thy_load.scala |
43320 | 61 |
Thy/thy_syntax.scala |
62 |
library.scala |
|
63 |
package.scala |
|
43730
a0ed7bc688b5
lambda terms with XML data representation in Scala;
wenzelm
parents:
43715
diff
changeset
|
64 |
term.scala |
43779 | 65 |
term_xml.scala |
43320 | 66 |
) |
67 |
||
34282
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
68 |
|
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
69 |
## diagnostics |
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
70 |
|
43280 | 71 |
PRG="$(basename "$0")" |
72 |
||
73 |
function usage() |
|
74 |
{ |
|
75 |
echo |
|
76 |
echo "Usage: isabelle $PRG [OPTIONS]" |
|
77 |
echo |
|
78 |
echo " Options are:" |
|
79 |
echo " -f fresh build" |
|
47408
63c05991882e
slightly faster default compilation of Isabelle/Scala;
wenzelm
parents:
47115
diff
changeset
|
80 |
echo " -t test separate compilation of PIDE" |
43280 | 81 |
echo |
82 |
exit 1 |
|
83 |
} |
|
84 |
||
34282
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
85 |
function fail() |
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
86 |
{ |
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
87 |
echo "$1" >&2 |
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
88 |
exit 2 |
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 |
|
42899 | 91 |
[ -z "$ISABELLE_HOME" ] && fail "Missing Isabelle settings environment" |
34282
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 |
|
43280 | 94 |
## process command line |
95 |
||
96 |
# options |
|
97 |
||
98 |
FRESH="" |
|
47408
63c05991882e
slightly faster default compilation of Isabelle/Scala;
wenzelm
parents:
47115
diff
changeset
|
99 |
TEST_PIDE="" |
43280 | 100 |
|
47408
63c05991882e
slightly faster default compilation of Isabelle/Scala;
wenzelm
parents:
47115
diff
changeset
|
101 |
while getopts "ft" OPT |
43280 | 102 |
do |
103 |
case "$OPT" in |
|
104 |
f) |
|
105 |
FRESH=true |
|
106 |
;; |
|
47408
63c05991882e
slightly faster default compilation of Isabelle/Scala;
wenzelm
parents:
47115
diff
changeset
|
107 |
t) |
63c05991882e
slightly faster default compilation of Isabelle/Scala;
wenzelm
parents:
47115
diff
changeset
|
108 |
TEST_PIDE=true |
63c05991882e
slightly faster default compilation of Isabelle/Scala;
wenzelm
parents:
47115
diff
changeset
|
109 |
;; |
43280 | 110 |
\?) |
111 |
usage |
|
112 |
;; |
|
113 |
esac |
|
114 |
done |
|
115 |
||
116 |
shift $(($OPTIND - 1)) |
|
117 |
||
118 |
||
119 |
# args |
|
120 |
||
121 |
[ "$#" -ne 0 ] && usage |
|
122 |
||
123 |
||
124 |
||
43523 | 125 |
# build |
34282
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
126 |
|
34284 | 127 |
TARGET_DIR="$ISABELLE_HOME/lib/classes" |
43523 | 128 |
TARGET="$TARGET_DIR/ext/Pure.jar" |
34282
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
129 |
|
45673
cd41e3903fbf
separate compilation of PIDE vs. Pure sources, which enables independent Scala library;
wenzelm
parents:
45672
diff
changeset
|
130 |
declare -a PIDE_SOURCES=() |
cd41e3903fbf
separate compilation of PIDE vs. Pure sources, which enables independent Scala library;
wenzelm
parents:
45672
diff
changeset
|
131 |
declare -a PURE_SOURCES=() |
cd41e3903fbf
separate compilation of PIDE vs. Pure sources, which enables independent Scala library;
wenzelm
parents:
45672
diff
changeset
|
132 |
|
cd41e3903fbf
separate compilation of PIDE vs. Pure sources, which enables independent Scala library;
wenzelm
parents:
45672
diff
changeset
|
133 |
for DEP in "${SOURCES[@]}" |
cd41e3903fbf
separate compilation of PIDE vs. Pure sources, which enables independent Scala library;
wenzelm
parents:
45672
diff
changeset
|
134 |
do |
cd41e3903fbf
separate compilation of PIDE vs. Pure sources, which enables independent Scala library;
wenzelm
parents:
45672
diff
changeset
|
135 |
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
|
136 |
then |
cd41e3903fbf
separate compilation of PIDE vs. Pure sources, which enables independent Scala library;
wenzelm
parents:
45672
diff
changeset
|
137 |
PIDE_SOURCES["${#PIDE_SOURCES[@]}"]="$DEP" |
cd41e3903fbf
separate compilation of PIDE vs. Pure sources, which enables independent Scala library;
wenzelm
parents:
45672
diff
changeset
|
138 |
else |
cd41e3903fbf
separate compilation of PIDE vs. Pure sources, which enables independent Scala library;
wenzelm
parents:
45672
diff
changeset
|
139 |
PURE_SOURCES["${#PURE_SOURCES[@]}"]="$DEP" |
cd41e3903fbf
separate compilation of PIDE vs. Pure sources, which enables independent Scala library;
wenzelm
parents:
45672
diff
changeset
|
140 |
fi |
cd41e3903fbf
separate compilation of PIDE vs. Pure sources, which enables independent Scala library;
wenzelm
parents:
45672
diff
changeset
|
141 |
done |
cd41e3903fbf
separate compilation of PIDE vs. Pure sources, which enables independent Scala library;
wenzelm
parents:
45672
diff
changeset
|
142 |
|
43405 | 143 |
declare -a UPDATED=() |
144 |
||
43280 | 145 |
if [ -n "$FRESH" ]; then |
146 |
OUTDATED=true |
|
147 |
else |
|
148 |
OUTDATED=false |
|
43523 | 149 |
if [ ! -e "$TARGET" ]; then |
150 |
OUTDATED=true |
|
151 |
else |
|
43405 | 152 |
for DEP in "${SOURCES[@]}" |
43280 | 153 |
do |
43405 | 154 |
[ ! -e "$DEP" ] && fail "Missing file: $DEP" |
43523 | 155 |
[ "$DEP" -nt "$TARGET" ] && { |
156 |
OUTDATED=true |
|
157 |
UPDATED["${#UPDATED[@]}"]="$DEP" |
|
158 |
} |
|
43280 | 159 |
done |
43405 | 160 |
fi |
43280 | 161 |
fi |
34282
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
162 |
|
34284 | 163 |
if [ "$OUTDATED" = true ] |
164 |
then |
|
34876 | 165 |
echo "### Building Isabelle/Scala layer ..." |
34282
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
166 |
|
43405 | 167 |
[ "${#UPDATED[@]}" -gt 0 ] && { |
168 |
echo "Changed files:" |
|
169 |
for FILE in "${UPDATED[@]}" |
|
170 |
do |
|
171 |
echo " $FILE" |
|
172 |
done |
|
173 |
} |
|
174 |
||
34282
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
175 |
rm -rf classes && mkdir classes |
45673
cd41e3903fbf
separate compilation of PIDE vs. Pure sources, which enables independent Scala library;
wenzelm
parents:
45672
diff
changeset
|
176 |
|
47009 | 177 |
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
|
178 |
|
47408
63c05991882e
slightly faster default compilation of Isabelle/Scala;
wenzelm
parents:
47115
diff
changeset
|
179 |
if [ "$TEST_PIDE" = true ]; then |
63c05991882e
slightly faster default compilation of Isabelle/Scala;
wenzelm
parents:
47115
diff
changeset
|
180 |
isabelle_scala scalac $SCALAC_OPTIONS "${PIDE_SOURCES[@]}" || \ |
63c05991882e
slightly faster default compilation of Isabelle/Scala;
wenzelm
parents:
47115
diff
changeset
|
181 |
fail "Failed to compile PIDE sources" |
63c05991882e
slightly faster default compilation of Isabelle/Scala;
wenzelm
parents:
47115
diff
changeset
|
182 |
isabelle_scala scalac $SCALAC_OPTIONS -classpath classes "${PURE_SOURCES[@]}" || \ |
63c05991882e
slightly faster default compilation of Isabelle/Scala;
wenzelm
parents:
47115
diff
changeset
|
183 |
fail "Failed to compile Pure sources" |
63c05991882e
slightly faster default compilation of Isabelle/Scala;
wenzelm
parents:
47115
diff
changeset
|
184 |
else |
63c05991882e
slightly faster default compilation of Isabelle/Scala;
wenzelm
parents:
47115
diff
changeset
|
185 |
isabelle_scala scalac $SCALAC_OPTIONS -classpath classes \ |
63c05991882e
slightly faster default compilation of Isabelle/Scala;
wenzelm
parents:
47115
diff
changeset
|
186 |
"${PIDE_SOURCES[@]}" "${PURE_SOURCES[@]}" || \ |
63c05991882e
slightly faster default compilation of Isabelle/Scala;
wenzelm
parents:
47115
diff
changeset
|
187 |
fail "Failed to compile sources" |
63c05991882e
slightly faster default compilation of Isabelle/Scala;
wenzelm
parents:
47115
diff
changeset
|
188 |
fi |
45673
cd41e3903fbf
separate compilation of PIDE vs. Pure sources, which enables independent Scala library;
wenzelm
parents:
45672
diff
changeset
|
189 |
|
43523 | 190 |
mkdir -p "$TARGET_DIR/ext" || fail "Failed to create directory $TARGET_DIR/ext" |
43280 | 191 |
|
43285 | 192 |
pushd classes >/dev/null |
43280 | 193 |
|
43517 | 194 |
CHARSET_SERVICE="META-INF/services/java.nio.charset.spi.CharsetProvider" |
195 |
mkdir -p "$(dirname "$CHARSET_SERVICE")" |
|
196 |
echo isabelle.Isabelle_Charset_Provider > "$CHARSET_SERVICE" |
|
197 |
||
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
|
198 |
isabelle_jdk jar cfe "$(jvmpath "$TARGET")" isabelle.GUI_Setup META-INF isabelle || \ |
43523 | 199 |
fail "Failed to produce $TARGET" |
34282
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
200 |
|
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
|
201 |
cp "$SCALA_HOME/lib/scala-compiler.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
|
202 |
"$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
|
203 |
"$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
|
204 |
|
47849 | 205 |
[ -e "$SCALA_HOME/lib/scala-actors.jar" ] && \ |
206 |
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
|
207 |
|
43280 | 208 |
popd >/dev/null |
209 |
||
34282
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
210 |
rm -rf classes |
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
211 |
fi |