author | wenzelm |
Thu, 23 Jun 2011 17:17:40 +0200 | |
changeset 43523 | 5aaa0fe92672 |
parent 43521 | d477b92109b8 |
child 43600 | 4ac04bf9ff89 |
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=( |
|
12 |
Concurrent/future.scala |
|
13 |
Concurrent/simple_thread.scala |
|
14 |
Concurrent/volatile.scala |
|
15 |
General/exn.scala |
|
16 |
General/timing.scala |
|
17 |
General/linear_set.scala |
|
18 |
General/markup.scala |
|
19 |
General/position.scala |
|
20 |
General/pretty.scala |
|
21 |
General/scan.scala |
|
22 |
General/sha1.scala |
|
23 |
General/symbol.scala |
|
24 |
General/xml.scala |
|
25 |
General/xml_data.scala |
|
26 |
General/yxml.scala |
|
27 |
Isar/keyword.scala |
|
28 |
Isar/outer_syntax.scala |
|
29 |
Isar/parse.scala |
|
30 |
Isar/token.scala |
|
31 |
PIDE/command.scala |
|
32 |
PIDE/document.scala |
|
33 |
PIDE/isar_document.scala |
|
34 |
PIDE/markup_tree.scala |
|
35 |
PIDE/text.scala |
|
36 |
System/cygwin.scala |
|
37 |
System/download.scala |
|
38 |
System/event_bus.scala |
|
39 |
System/gui_setup.scala |
|
43517 | 40 |
System/isabelle_charset.scala |
43320 | 41 |
System/isabelle_process.scala |
42 |
System/isabelle_syntax.scala |
|
43 |
System/isabelle_system.scala |
|
44 |
System/platform.scala |
|
45 |
System/session.scala |
|
46 |
System/session_manager.scala |
|
47 |
System/standard_system.scala |
|
48 |
System/swing_thread.scala |
|
49 |
Thy/completion.scala |
|
50 |
Thy/html.scala |
|
51 |
Thy/thy_header.scala |
|
52 |
Thy/thy_syntax.scala |
|
53 |
library.scala |
|
54 |
package.scala |
|
55 |
) |
|
56 |
||
34282
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
57 |
|
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
58 |
## diagnostics |
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
59 |
|
43280 | 60 |
PRG="$(basename "$0")" |
61 |
||
62 |
function usage() |
|
63 |
{ |
|
64 |
echo |
|
65 |
echo "Usage: isabelle $PRG [OPTIONS]" |
|
66 |
echo |
|
67 |
echo " Options are:" |
|
68 |
echo " -f fresh build" |
|
69 |
echo |
|
70 |
exit 1 |
|
71 |
} |
|
72 |
||
34282
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
73 |
function fail() |
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
74 |
{ |
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
75 |
echo "$1" >&2 |
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
76 |
exit 2 |
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
77 |
} |
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
78 |
|
42899 | 79 |
[ -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
|
80 |
[ -z "$SCALA_HOME" ] && fail "Unknown SCALA_HOME -- Scala unavailable" |
34282
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
81 |
|
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
82 |
|
43280 | 83 |
## process command line |
84 |
||
85 |
# options |
|
86 |
||
87 |
FRESH="" |
|
88 |
||
89 |
while getopts "f" OPT |
|
90 |
do |
|
91 |
case "$OPT" in |
|
92 |
f) |
|
93 |
FRESH=true |
|
94 |
;; |
|
95 |
\?) |
|
96 |
usage |
|
97 |
;; |
|
98 |
esac |
|
99 |
done |
|
100 |
||
101 |
shift $(($OPTIND - 1)) |
|
102 |
||
103 |
||
104 |
# args |
|
105 |
||
106 |
[ "$#" -ne 0 ] && usage |
|
107 |
||
108 |
||
109 |
||
43523 | 110 |
# build |
34282
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
111 |
|
34284 | 112 |
TARGET_DIR="$ISABELLE_HOME/lib/classes" |
43523 | 113 |
TARGET="$TARGET_DIR/ext/Pure.jar" |
34282
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
114 |
|
43405 | 115 |
declare -a UPDATED=() |
116 |
||
43280 | 117 |
if [ -n "$FRESH" ]; then |
118 |
OUTDATED=true |
|
119 |
else |
|
120 |
OUTDATED=false |
|
43523 | 121 |
if [ ! -e "$TARGET" ]; then |
122 |
OUTDATED=true |
|
123 |
else |
|
43405 | 124 |
for DEP in "${SOURCES[@]}" |
43280 | 125 |
do |
43405 | 126 |
[ ! -e "$DEP" ] && fail "Missing file: $DEP" |
43523 | 127 |
[ "$DEP" -nt "$TARGET" ] && { |
128 |
OUTDATED=true |
|
129 |
UPDATED["${#UPDATED[@]}"]="$DEP" |
|
130 |
} |
|
43280 | 131 |
done |
43405 | 132 |
fi |
43280 | 133 |
fi |
34282
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
134 |
|
34284 | 135 |
if [ "$OUTDATED" = true ] |
136 |
then |
|
34282
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
137 |
echo "###" |
34876 | 138 |
echo "### Building Isabelle/Scala layer ..." |
34282
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
139 |
echo "###" |
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
140 |
|
43405 | 141 |
[ "${#UPDATED[@]}" -gt 0 ] && { |
142 |
echo "Changed files:" |
|
143 |
for FILE in "${UPDATED[@]}" |
|
144 |
do |
|
145 |
echo " $FILE" |
|
146 |
done |
|
147 |
} |
|
148 |
||
34282
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
149 |
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
|
150 |
"$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
|
151 |
fail "Failed to compile sources" |
43523 | 152 |
mkdir -p "$TARGET_DIR/ext" || fail "Failed to create directory $TARGET_DIR/ext" |
43280 | 153 |
|
43285 | 154 |
pushd classes >/dev/null |
43280 | 155 |
|
43517 | 156 |
CHARSET_SERVICE="META-INF/services/java.nio.charset.spi.CharsetProvider" |
157 |
mkdir -p "$(dirname "$CHARSET_SERVICE")" |
|
158 |
echo isabelle.Isabelle_Charset_Provider > "$CHARSET_SERVICE" |
|
159 |
||
43523 | 160 |
jar cfe "$(jvmpath "$TARGET")" isabelle.GUI_Setup META-INF isabelle || \ |
161 |
fail "Failed to produce $TARGET" |
|
34282
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
162 |
|
43523 | 163 |
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
|
164 |
|
43280 | 165 |
popd >/dev/null |
166 |
||
34282
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
167 |
rm -rf classes |
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
wenzelm
parents:
diff
changeset
|
168 |
fi |