| author | nipkow | 
| Wed, 21 Sep 2011 07:31:08 +0200 | |
| changeset 45023 | 76abd26e2e2d | 
| parent 44698 | 0385292321a0 | 
| child 45027 | f459e93a038e | 
| 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  | 
|
| 43780 | 23  | 
General/properties.scala  | 
| 43320 | 24  | 
General/scan.scala  | 
25  | 
General/sha1.scala  | 
|
26  | 
General/symbol.scala  | 
|
27  | 
Isar/keyword.scala  | 
|
28  | 
Isar/outer_syntax.scala  | 
|
29  | 
Isar/parse.scala  | 
|
30  | 
Isar/token.scala  | 
|
| 
43715
 
518e44a0ee15
some support for blobs (arbitrary text files) within document nodes;
 
wenzelm 
parents: 
43695 
diff
changeset
 | 
31  | 
PIDE/blob.scala  | 
| 43320 | 32  | 
PIDE/command.scala  | 
33  | 
PIDE/document.scala  | 
|
34  | 
PIDE/isar_document.scala  | 
|
35  | 
PIDE/markup_tree.scala  | 
|
36  | 
PIDE/text.scala  | 
|
| 44698 | 37  | 
PIDE/xml.scala  | 
38  | 
PIDE/yxml.scala  | 
|
| 43320 | 39  | 
System/cygwin.scala  | 
40  | 
System/download.scala  | 
|
41  | 
System/event_bus.scala  | 
|
42  | 
System/gui_setup.scala  | 
|
| 
43744
 
2c7e1565b4a3
some support to invoke Scala methods under program control;
 
wenzelm 
parents: 
43730 
diff
changeset
 | 
43  | 
System/invoke_scala.scala  | 
| 43517 | 44  | 
System/isabelle_charset.scala  | 
| 43320 | 45  | 
System/isabelle_process.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  | 
|
| 
43730
 
a0ed7bc688b5
lambda terms with XML data representation in Scala;
 
wenzelm 
parents: 
43715 
diff
changeset
 | 
60  | 
term.scala  | 
| 43779 | 61  | 
term_xml.scala  | 
| 43320 | 62  | 
)  | 
63  | 
||
| 
34282
 
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
 
wenzelm 
parents:  
diff
changeset
 | 
64  | 
|
| 
 
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
 
wenzelm 
parents:  
diff
changeset
 | 
65  | 
## diagnostics  | 
| 
 
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
 
wenzelm 
parents:  
diff
changeset
 | 
66  | 
|
| 43280 | 67  | 
PRG="$(basename "$0")"  | 
68  | 
||
69  | 
function usage()  | 
|
70  | 
{
 | 
|
71  | 
echo  | 
|
72  | 
echo "Usage: isabelle $PRG [OPTIONS]"  | 
|
73  | 
echo  | 
|
74  | 
echo " Options are:"  | 
|
75  | 
echo " -f fresh build"  | 
|
76  | 
echo  | 
|
77  | 
exit 1  | 
|
78  | 
}  | 
|
79  | 
||
| 
34282
 
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
 
wenzelm 
parents:  
diff
changeset
 | 
80  | 
function fail()  | 
| 
 
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  | 
echo "$1" >&2  | 
| 
 
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
 
wenzelm 
parents:  
diff
changeset
 | 
83  | 
exit 2  | 
| 
 
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
 
wenzelm 
parents:  
diff
changeset
 | 
84  | 
}  | 
| 
 
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
 
wenzelm 
parents:  
diff
changeset
 | 
85  | 
|
| 42899 | 86  | 
[ -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
 | 
87  | 
[ -z "$SCALA_HOME" ] && fail "Unknown SCALA_HOME -- Scala unavailable"  | 
| 
34282
 
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
 
wenzelm 
parents:  
diff
changeset
 | 
88  | 
|
| 
 
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
 
wenzelm 
parents:  
diff
changeset
 | 
89  | 
|
| 43280 | 90  | 
## process command line  | 
91  | 
||
92  | 
# options  | 
|
93  | 
||
94  | 
FRESH=""  | 
|
95  | 
||
96  | 
while getopts "f" OPT  | 
|
97  | 
do  | 
|
98  | 
case "$OPT" in  | 
|
99  | 
f)  | 
|
100  | 
FRESH=true  | 
|
101  | 
;;  | 
|
102  | 
\?)  | 
|
103  | 
usage  | 
|
104  | 
;;  | 
|
105  | 
esac  | 
|
106  | 
done  | 
|
107  | 
||
108  | 
shift $(($OPTIND - 1))  | 
|
109  | 
||
110  | 
||
111  | 
# args  | 
|
112  | 
||
113  | 
[ "$#" -ne 0 ] && usage  | 
|
114  | 
||
115  | 
||
116  | 
||
| 43523 | 117  | 
# build  | 
| 
34282
 
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
 
wenzelm 
parents:  
diff
changeset
 | 
118  | 
|
| 34284 | 119  | 
TARGET_DIR="$ISABELLE_HOME/lib/classes"  | 
| 43523 | 120  | 
TARGET="$TARGET_DIR/ext/Pure.jar"  | 
| 
34282
 
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
 
wenzelm 
parents:  
diff
changeset
 | 
121  | 
|
| 43405 | 122  | 
declare -a UPDATED=()  | 
123  | 
||
| 43280 | 124  | 
if [ -n "$FRESH" ]; then  | 
125  | 
OUTDATED=true  | 
|
126  | 
else  | 
|
127  | 
OUTDATED=false  | 
|
| 43523 | 128  | 
if [ ! -e "$TARGET" ]; then  | 
129  | 
OUTDATED=true  | 
|
130  | 
else  | 
|
| 43405 | 131  | 
    for DEP in "${SOURCES[@]}"
 | 
| 43280 | 132  | 
do  | 
| 43405 | 133  | 
[ ! -e "$DEP" ] && fail "Missing file: $DEP"  | 
| 43523 | 134  | 
      [ "$DEP" -nt "$TARGET" ] && {
 | 
135  | 
OUTDATED=true  | 
|
136  | 
        UPDATED["${#UPDATED[@]}"]="$DEP"
 | 
|
137  | 
}  | 
|
| 43280 | 138  | 
done  | 
| 43405 | 139  | 
fi  | 
| 43280 | 140  | 
fi  | 
| 
34282
 
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
 
wenzelm 
parents:  
diff
changeset
 | 
141  | 
|
| 34284 | 142  | 
if [ "$OUTDATED" = true ]  | 
143  | 
then  | 
|
| 34876 | 144  | 
echo "### Building Isabelle/Scala layer ..."  | 
| 
34282
 
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
 
wenzelm 
parents:  
diff
changeset
 | 
145  | 
|
| 43405 | 146  | 
  [ "${#UPDATED[@]}" -gt 0 ] && {
 | 
147  | 
echo "Changed files:"  | 
|
148  | 
    for FILE in "${UPDATED[@]}"
 | 
|
149  | 
do  | 
|
150  | 
echo " $FILE"  | 
|
151  | 
done  | 
|
152  | 
}  | 
|
153  | 
||
| 
34282
 
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
 
wenzelm 
parents:  
diff
changeset
 | 
154  | 
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
 | 
155  | 
  "$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
 | 
156  | 
fail "Failed to compile sources"  | 
| 43523 | 157  | 
mkdir -p "$TARGET_DIR/ext" || fail "Failed to create directory $TARGET_DIR/ext"  | 
| 43280 | 158  | 
|
| 43285 | 159  | 
pushd classes >/dev/null  | 
| 43280 | 160  | 
|
| 43517 | 161  | 
CHARSET_SERVICE="META-INF/services/java.nio.charset.spi.CharsetProvider"  | 
162  | 
mkdir -p "$(dirname "$CHARSET_SERVICE")"  | 
|
163  | 
echo isabelle.Isabelle_Charset_Provider > "$CHARSET_SERVICE"  | 
|
164  | 
||
| 43523 | 165  | 
jar cfe "$(jvmpath "$TARGET")" isabelle.GUI_Setup META-INF isabelle || \  | 
166  | 
fail "Failed to produce $TARGET"  | 
|
| 
34282
 
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
 
wenzelm 
parents:  
diff
changeset
 | 
167  | 
|
| 43523 | 168  | 
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
 | 
169  | 
|
| 43280 | 170  | 
popd >/dev/null  | 
171  | 
||
| 
34282
 
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
 
wenzelm 
parents:  
diff
changeset
 | 
172  | 
rm -rf classes  | 
| 
 
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
 
wenzelm 
parents:  
diff
changeset
 | 
173  | 
fi  |