| author | wenzelm | 
| Sun, 26 Feb 2012 18:25:28 +0100 | |
| changeset 46684 | 7f741b2c82a3 | 
| parent 46611 | 669601fa1a62 | 
| child 47009 | 97b68d61de2e | 
| 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: 
43523diff
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: 
43695diff
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: 
45674diff
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/download.scala | |
| 44 | System/event_bus.scala | |
| 45 | System/gui_setup.scala | |
| 43744 
2c7e1565b4a3
some support to invoke Scala methods under program control;
 wenzelm parents: 
43730diff
changeset | 46 | System/invoke_scala.scala | 
| 43517 | 47 | System/isabelle_charset.scala | 
| 43320 | 48 | System/isabelle_process.scala | 
| 49 | System/isabelle_system.scala | |
| 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: 
44698diff
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: 
43600diff
changeset | 59 | Thy/thy_info.scala | 
| 
511df47bcadc
some support for theory files within Isabelle/Scala session;
 wenzelm parents: 
43600diff
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: 
43715diff
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" | |
| 80 | echo | |
| 81 | exit 1 | |
| 82 | } | |
| 83 | ||
| 34282 
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
 wenzelm parents: diff
changeset | 84 | function fail() | 
| 
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
 wenzelm parents: diff
changeset | 85 | {
 | 
| 
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
 wenzelm parents: diff
changeset | 86 | echo "$1" >&2 | 
| 
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
 wenzelm parents: diff
changeset | 87 | exit 2 | 
| 
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 | |
| 42899 | 90 | [ -z "$ISABELLE_HOME" ] && fail "Missing Isabelle settings environment" | 
| 37174 
6feaab4fc27d
assume given SCALA_HOME, e.g. from component settings or external setup;
 wenzelm parents: 
37044diff
changeset | 91 | [ -z "$SCALA_HOME" ] && fail "Unknown SCALA_HOME -- Scala unavailable" | 
| 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="" | |
| 99 | ||
| 100 | while getopts "f" OPT | |
| 101 | do | |
| 102 | case "$OPT" in | |
| 103 | f) | |
| 104 | FRESH=true | |
| 105 | ;; | |
| 106 | \?) | |
| 107 | usage | |
| 108 | ;; | |
| 109 | esac | |
| 110 | done | |
| 111 | ||
| 112 | shift $(($OPTIND - 1)) | |
| 113 | ||
| 114 | ||
| 115 | # args | |
| 116 | ||
| 117 | [ "$#" -ne 0 ] && usage | |
| 118 | ||
| 119 | ||
| 120 | ||
| 43523 | 121 | # build | 
| 34282 
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
 wenzelm parents: diff
changeset | 122 | |
| 34284 | 123 | TARGET_DIR="$ISABELLE_HOME/lib/classes" | 
| 43523 | 124 | TARGET="$TARGET_DIR/ext/Pure.jar" | 
| 34282 
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
 wenzelm parents: diff
changeset | 125 | |
| 45673 
cd41e3903fbf
separate compilation of PIDE vs. Pure sources, which enables independent Scala library;
 wenzelm parents: 
45672diff
changeset | 126 | declare -a PIDE_SOURCES=() | 
| 
cd41e3903fbf
separate compilation of PIDE vs. Pure sources, which enables independent Scala library;
 wenzelm parents: 
45672diff
changeset | 127 | declare -a PURE_SOURCES=() | 
| 
cd41e3903fbf
separate compilation of PIDE vs. Pure sources, which enables independent Scala library;
 wenzelm parents: 
45672diff
changeset | 128 | |
| 
cd41e3903fbf
separate compilation of PIDE vs. Pure sources, which enables independent Scala library;
 wenzelm parents: 
45672diff
changeset | 129 | for DEP in "${SOURCES[@]}"
 | 
| 
cd41e3903fbf
separate compilation of PIDE vs. Pure sources, which enables independent Scala library;
 wenzelm parents: 
45672diff
changeset | 130 | do | 
| 
cd41e3903fbf
separate compilation of PIDE vs. Pure sources, which enables independent Scala library;
 wenzelm parents: 
45672diff
changeset | 131 | if grep "Module:.*PIDE" "$DEP" >/dev/null | 
| 
cd41e3903fbf
separate compilation of PIDE vs. Pure sources, which enables independent Scala library;
 wenzelm parents: 
45672diff
changeset | 132 | then | 
| 
cd41e3903fbf
separate compilation of PIDE vs. Pure sources, which enables independent Scala library;
 wenzelm parents: 
45672diff
changeset | 133 |     PIDE_SOURCES["${#PIDE_SOURCES[@]}"]="$DEP"
 | 
| 
cd41e3903fbf
separate compilation of PIDE vs. Pure sources, which enables independent Scala library;
 wenzelm parents: 
45672diff
changeset | 134 | else | 
| 
cd41e3903fbf
separate compilation of PIDE vs. Pure sources, which enables independent Scala library;
 wenzelm parents: 
45672diff
changeset | 135 |     PURE_SOURCES["${#PURE_SOURCES[@]}"]="$DEP"
 | 
| 
cd41e3903fbf
separate compilation of PIDE vs. Pure sources, which enables independent Scala library;
 wenzelm parents: 
45672diff
changeset | 136 | fi | 
| 
cd41e3903fbf
separate compilation of PIDE vs. Pure sources, which enables independent Scala library;
 wenzelm parents: 
45672diff
changeset | 137 | done | 
| 
cd41e3903fbf
separate compilation of PIDE vs. Pure sources, which enables independent Scala library;
 wenzelm parents: 
45672diff
changeset | 138 | |
| 43405 | 139 | declare -a UPDATED=() | 
| 140 | ||
| 43280 | 141 | if [ -n "$FRESH" ]; then | 
| 142 | OUTDATED=true | |
| 143 | else | |
| 144 | OUTDATED=false | |
| 43523 | 145 | if [ ! -e "$TARGET" ]; then | 
| 146 | OUTDATED=true | |
| 147 | else | |
| 43405 | 148 |     for DEP in "${SOURCES[@]}"
 | 
| 43280 | 149 | do | 
| 43405 | 150 | [ ! -e "$DEP" ] && fail "Missing file: $DEP" | 
| 43523 | 151 |       [ "$DEP" -nt "$TARGET" ] && {
 | 
| 152 | OUTDATED=true | |
| 153 |         UPDATED["${#UPDATED[@]}"]="$DEP"
 | |
| 154 | } | |
| 43280 | 155 | done | 
| 43405 | 156 | fi | 
| 43280 | 157 | fi | 
| 34282 
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
 wenzelm parents: diff
changeset | 158 | |
| 34284 | 159 | if [ "$OUTDATED" = true ] | 
| 160 | then | |
| 34876 | 161 | echo "### Building Isabelle/Scala layer ..." | 
| 34282 
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
 wenzelm parents: diff
changeset | 162 | |
| 43405 | 163 |   [ "${#UPDATED[@]}" -gt 0 ] && {
 | 
| 164 | echo "Changed files:" | |
| 165 |     for FILE in "${UPDATED[@]}"
 | |
| 166 | do | |
| 167 | echo " $FILE" | |
| 168 | done | |
| 169 | } | |
| 170 | ||
| 34282 
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
 wenzelm parents: diff
changeset | 171 | rm -rf classes && mkdir classes | 
| 45673 
cd41e3903fbf
separate compilation of PIDE vs. Pure sources, which enables independent Scala library;
 wenzelm parents: 
45672diff
changeset | 172 | |
| 
cd41e3903fbf
separate compilation of PIDE vs. Pure sources, which enables independent Scala library;
 wenzelm parents: 
45672diff
changeset | 173 | SCALAC_OPTIONS="-unchecked -deprecation -d classes -target:jvm-1.5" | 
| 
cd41e3903fbf
separate compilation of PIDE vs. Pure sources, which enables independent Scala library;
 wenzelm parents: 
45672diff
changeset | 174 | |
| 
cd41e3903fbf
separate compilation of PIDE vs. Pure sources, which enables independent Scala library;
 wenzelm parents: 
45672diff
changeset | 175 |   "$SCALA_HOME/bin/scalac" $SCALAC_OPTIONS "${PIDE_SOURCES[@]}" || \
 | 
| 
cd41e3903fbf
separate compilation of PIDE vs. Pure sources, which enables independent Scala library;
 wenzelm parents: 
45672diff
changeset | 176 | fail "Failed to compile PIDE sources" | 
| 
cd41e3903fbf
separate compilation of PIDE vs. Pure sources, which enables independent Scala library;
 wenzelm parents: 
45672diff
changeset | 177 | |
| 
cd41e3903fbf
separate compilation of PIDE vs. Pure sources, which enables independent Scala library;
 wenzelm parents: 
45672diff
changeset | 178 |   "$SCALA_HOME/bin/scalac" $SCALAC_OPTIONS -classpath classes "${PURE_SOURCES[@]}" || \
 | 
| 
cd41e3903fbf
separate compilation of PIDE vs. Pure sources, which enables independent Scala library;
 wenzelm parents: 
45672diff
changeset | 179 | fail "Failed to compile Pure sources" | 
| 
cd41e3903fbf
separate compilation of PIDE vs. Pure sources, which enables independent Scala library;
 wenzelm parents: 
45672diff
changeset | 180 | |
| 43523 | 181 | mkdir -p "$TARGET_DIR/ext" || fail "Failed to create directory $TARGET_DIR/ext" | 
| 43280 | 182 | |
| 43285 | 183 | pushd classes >/dev/null | 
| 43280 | 184 | |
| 43517 | 185 | CHARSET_SERVICE="META-INF/services/java.nio.charset.spi.CharsetProvider" | 
| 186 | mkdir -p "$(dirname "$CHARSET_SERVICE")" | |
| 187 | echo isabelle.Isabelle_Charset_Provider > "$CHARSET_SERVICE" | |
| 188 | ||
| 43523 | 189 | jar cfe "$(jvmpath "$TARGET")" isabelle.GUI_Setup META-INF isabelle || \ | 
| 190 | fail "Failed to produce $TARGET" | |
| 34282 
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
 wenzelm parents: diff
changeset | 191 | |
| 43523 | 192 | 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: 
43517diff
changeset | 193 | |
| 43280 | 194 | popd >/dev/null | 
| 195 | ||
| 34282 
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
 wenzelm parents: diff
changeset | 196 | rm -rf classes | 
| 
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
 wenzelm parents: diff
changeset | 197 | fi |