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