author | wenzelm |
Tue, 29 Nov 2011 20:18:02 +0100 | |
changeset 45672 | a497c5d4a523 |
parent 45670 | b84170538043 |
child 45673 | cd41e3903fbf |
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 |
|
17 |
General/linear_set.scala |
|
43600
4ac04bf9ff89
abstract algebra of file paths in Scala (cf. path.ML);
wenzelm
parents:
43523
diff
changeset
|
18 |
General/path.scala |
43320 | 19 |
General/position.scala |
20 |
General/pretty.scala |
|
43780 | 21 |
General/properties.scala |
43320 | 22 |
General/scan.scala |
23 |
General/sha1.scala |
|
24 |
General/symbol.scala |
|
45666 | 25 |
General/timing.scala |
43320 | 26 |
Isar/keyword.scala |
27 |
Isar/outer_syntax.scala |
|
28 |
Isar/parse.scala |
|
29 |
Isar/token.scala |
|
43715
518e44a0ee15
some support for blobs (arbitrary text files) within document nodes;
wenzelm
parents:
43695
diff
changeset
|
30 |
PIDE/blob.scala |
43320 | 31 |
PIDE/command.scala |
32 |
PIDE/document.scala |
|
45672 | 33 |
PIDE/isabelle_document.scala |
45670 | 34 |
PIDE/isabelle_markup.scala |
35 |
PIDE/markup.scala |
|
43320 | 36 |
PIDE/markup_tree.scala |
37 |
PIDE/text.scala |
|
44698 | 38 |
PIDE/xml.scala |
39 |
PIDE/yxml.scala |
|
43320 | 40 |
System/cygwin.scala |
41 |
System/download.scala |
|
42 |
System/event_bus.scala |
|
43 |
System/gui_setup.scala |
|
43744
2c7e1565b4a3
some support to invoke Scala methods under program control;
wenzelm
parents:
43730
diff
changeset
|
44 |
System/invoke_scala.scala |
43517 | 45 |
System/isabelle_charset.scala |
43320 | 46 |
System/isabelle_process.scala |
47 |
System/isabelle_system.scala |
|
48 |
System/platform.scala |
|
49 |
System/session.scala |
|
50 |
System/session_manager.scala |
|
51 |
System/standard_system.scala |
|
52 |
System/swing_thread.scala |
|
45027
f459e93a038e
more abstract wrapping of fifos as System_Channel;
wenzelm
parents:
44698
diff
changeset
|
53 |
System/system_channel.scala |
43320 | 54 |
Thy/completion.scala |
55 |
Thy/html.scala |
|
56 |
Thy/thy_header.scala |
|
43651
511df47bcadc
some support for theory files within Isabelle/Scala session;
wenzelm
parents:
43600
diff
changeset
|
57 |
Thy/thy_info.scala |
511df47bcadc
some support for theory files within Isabelle/Scala session;
wenzelm
parents:
43600
diff
changeset
|
58 |
Thy/thy_load.scala |
43320 | 59 |
Thy/thy_syntax.scala |
60 |
library.scala |
|
61 |
package.scala |
|
43730
a0ed7bc688b5
lambda terms with XML data representation in Scala;
wenzelm
parents:
43715
diff
changeset
|
62 |
term.scala |
43779 | 63 |
term_xml.scala |
43320 | 64 |
) |
65 |
||
34282
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
66 |
|
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
67 |
## diagnostics |
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
68 |
|
43280 | 69 |
PRG="$(basename "$0")" |
70 |
||
71 |
function usage() |
|
72 |
{ |
|
73 |
echo |
|
74 |
echo "Usage: isabelle $PRG [OPTIONS]" |
|
75 |
echo |
|
76 |
echo " Options are:" |
|
77 |
echo " -f fresh build" |
|
78 |
echo |
|
79 |
exit 1 |
|
80 |
} |
|
81 |
||
34282
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
82 |
function fail() |
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 |
echo "$1" >&2 |
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
85 |
exit 2 |
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 |
|
42899 | 88 |
[ -z "$ISABELLE_HOME" ] && fail "Missing Isabelle settings environment" |
37174
6feaab4fc27d
assume given SCALA_HOME, e.g. from component settings or external setup;
wenzelm
parents:
37044
diff
changeset
|
89 |
[ -z "$SCALA_HOME" ] && fail "Unknown SCALA_HOME -- Scala unavailable" |
34282
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 |
|
43280 | 92 |
## process command line |
93 |
||
94 |
# options |
|
95 |
||
96 |
FRESH="" |
|
97 |
||
98 |
while getopts "f" OPT |
|
99 |
do |
|
100 |
case "$OPT" in |
|
101 |
f) |
|
102 |
FRESH=true |
|
103 |
;; |
|
104 |
\?) |
|
105 |
usage |
|
106 |
;; |
|
107 |
esac |
|
108 |
done |
|
109 |
||
110 |
shift $(($OPTIND - 1)) |
|
111 |
||
112 |
||
113 |
# args |
|
114 |
||
115 |
[ "$#" -ne 0 ] && usage |
|
116 |
||
117 |
||
118 |
||
43523 | 119 |
# build |
34282
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
120 |
|
34284 | 121 |
TARGET_DIR="$ISABELLE_HOME/lib/classes" |
43523 | 122 |
TARGET="$TARGET_DIR/ext/Pure.jar" |
34282
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
123 |
|
43405 | 124 |
declare -a UPDATED=() |
125 |
||
43280 | 126 |
if [ -n "$FRESH" ]; then |
127 |
OUTDATED=true |
|
128 |
else |
|
129 |
OUTDATED=false |
|
43523 | 130 |
if [ ! -e "$TARGET" ]; then |
131 |
OUTDATED=true |
|
132 |
else |
|
43405 | 133 |
for DEP in "${SOURCES[@]}" |
43280 | 134 |
do |
43405 | 135 |
[ ! -e "$DEP" ] && fail "Missing file: $DEP" |
43523 | 136 |
[ "$DEP" -nt "$TARGET" ] && { |
137 |
OUTDATED=true |
|
138 |
UPDATED["${#UPDATED[@]}"]="$DEP" |
|
139 |
} |
|
43280 | 140 |
done |
43405 | 141 |
fi |
43280 | 142 |
fi |
34282
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
143 |
|
34284 | 144 |
if [ "$OUTDATED" = true ] |
145 |
then |
|
34876 | 146 |
echo "### Building Isabelle/Scala layer ..." |
34282
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
147 |
|
43405 | 148 |
[ "${#UPDATED[@]}" -gt 0 ] && { |
149 |
echo "Changed files:" |
|
150 |
for FILE in "${UPDATED[@]}" |
|
151 |
do |
|
152 |
echo " $FILE" |
|
153 |
done |
|
154 |
} |
|
155 |
||
34282
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
156 |
rm -rf classes && mkdir classes |
36011
3ff725ac13a4
adapted to Scala 2.8.0 Beta1 -- with notable changes to scala.collection;
wenzelm
parents:
34876
diff
changeset
|
157 |
"$SCALA_HOME/bin/scalac" -unchecked -deprecation -d classes -target:jvm-1.5 "${SOURCES[@]}" || \ |
34282
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
158 |
fail "Failed to compile sources" |
43523 | 159 |
mkdir -p "$TARGET_DIR/ext" || fail "Failed to create directory $TARGET_DIR/ext" |
43280 | 160 |
|
43285 | 161 |
pushd classes >/dev/null |
43280 | 162 |
|
43517 | 163 |
CHARSET_SERVICE="META-INF/services/java.nio.charset.spi.CharsetProvider" |
164 |
mkdir -p "$(dirname "$CHARSET_SERVICE")" |
|
165 |
echo isabelle.Isabelle_Charset_Provider > "$CHARSET_SERVICE" |
|
166 |
||
43523 | 167 |
jar cfe "$(jvmpath "$TARGET")" isabelle.GUI_Setup META-INF isabelle || \ |
168 |
fail "Failed to produce $TARGET" |
|
34282
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
169 |
|
43523 | 170 |
cp "$SCALA_HOME/lib/scala-swing.jar" "$SCALA_HOME/lib/scala-library.jar" "$TARGET_DIR/ext" |
43521
d477b92109b8
provide Isabelle/Scala environment as Java extension, instead of user classpath
wenzelm
parents:
43517
diff
changeset
|
171 |
|
43280 | 172 |
popd >/dev/null |
173 |
||
34282
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
174 |
rm -rf classes |
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
175 |
fi |