| author | hoelzl | 
| Mon, 23 Apr 2012 12:14:35 +0200 | |
| changeset 47694 | 05663f75964c | 
| parent 47663 | 20e0865ae9e7 | 
| child 47849 | 48b52cdc214a | 
| 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 | |
| 47663 
20e0865ae9e7
default Isabelle application wrapper -- JVM entry point for Isabelle.exe;
 wenzelm parents: 
47408diff
changeset | 50 | System/main.scala | 
| 43320 | 51 | System/platform.scala | 
| 52 | System/session.scala | |
| 53 | System/session_manager.scala | |
| 54 | System/standard_system.scala | |
| 55 | System/swing_thread.scala | |
| 45027 
f459e93a038e
more abstract wrapping of fifos as System_Channel;
 wenzelm parents: 
44698diff
changeset | 56 | System/system_channel.scala | 
| 43320 | 57 | Thy/completion.scala | 
| 58 | Thy/html.scala | |
| 59 | Thy/thy_header.scala | |
| 43651 
511df47bcadc
some support for theory files within Isabelle/Scala session;
 wenzelm parents: 
43600diff
changeset | 60 | Thy/thy_info.scala | 
| 
511df47bcadc
some support for theory files within Isabelle/Scala session;
 wenzelm parents: 
43600diff
changeset | 61 | Thy/thy_load.scala | 
| 43320 | 62 | Thy/thy_syntax.scala | 
| 63 | library.scala | |
| 64 | package.scala | |
| 43730 
a0ed7bc688b5
lambda terms with XML data representation in Scala;
 wenzelm parents: 
43715diff
changeset | 65 | term.scala | 
| 43779 | 66 | term_xml.scala | 
| 43320 | 67 | ) | 
| 68 | ||
| 34282 
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
 wenzelm parents: diff
changeset | 69 | |
| 
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
 wenzelm parents: diff
changeset | 70 | ## diagnostics | 
| 
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
 wenzelm parents: diff
changeset | 71 | |
| 43280 | 72 | PRG="$(basename "$0")" | 
| 73 | ||
| 74 | function usage() | |
| 75 | {
 | |
| 76 | echo | |
| 77 | echo "Usage: isabelle $PRG [OPTIONS]" | |
| 78 | echo | |
| 79 | echo " Options are:" | |
| 80 | echo " -f fresh build" | |
| 47408 
63c05991882e
slightly faster default compilation of Isabelle/Scala;
 wenzelm parents: 
47115diff
changeset | 81 | echo " -t test separate compilation of PIDE" | 
| 43280 | 82 | echo | 
| 83 | exit 1 | |
| 84 | } | |
| 85 | ||
| 34282 
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
 wenzelm parents: diff
changeset | 86 | function fail() | 
| 
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
 wenzelm parents: diff
changeset | 87 | {
 | 
| 
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
 wenzelm parents: diff
changeset | 88 | echo "$1" >&2 | 
| 
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
 wenzelm parents: diff
changeset | 89 | exit 2 | 
| 
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 | |
| 42899 | 92 | [ -z "$ISABELLE_HOME" ] && fail "Missing Isabelle settings environment" | 
| 34282 
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
 wenzelm parents: diff
changeset | 93 | |
| 
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
 wenzelm parents: diff
changeset | 94 | |
| 43280 | 95 | ## process command line | 
| 96 | ||
| 97 | # options | |
| 98 | ||
| 99 | FRESH="" | |
| 47408 
63c05991882e
slightly faster default compilation of Isabelle/Scala;
 wenzelm parents: 
47115diff
changeset | 100 | TEST_PIDE="" | 
| 43280 | 101 | |
| 47408 
63c05991882e
slightly faster default compilation of Isabelle/Scala;
 wenzelm parents: 
47115diff
changeset | 102 | while getopts "ft" OPT | 
| 43280 | 103 | do | 
| 104 | case "$OPT" in | |
| 105 | f) | |
| 106 | FRESH=true | |
| 107 | ;; | |
| 47408 
63c05991882e
slightly faster default compilation of Isabelle/Scala;
 wenzelm parents: 
47115diff
changeset | 108 | t) | 
| 
63c05991882e
slightly faster default compilation of Isabelle/Scala;
 wenzelm parents: 
47115diff
changeset | 109 | TEST_PIDE=true | 
| 
63c05991882e
slightly faster default compilation of Isabelle/Scala;
 wenzelm parents: 
47115diff
changeset | 110 | ;; | 
| 43280 | 111 | \?) | 
| 112 | usage | |
| 113 | ;; | |
| 114 | esac | |
| 115 | done | |
| 116 | ||
| 117 | shift $(($OPTIND - 1)) | |
| 118 | ||
| 119 | ||
| 120 | # args | |
| 121 | ||
| 122 | [ "$#" -ne 0 ] && usage | |
| 123 | ||
| 124 | ||
| 125 | ||
| 43523 | 126 | # build | 
| 34282 
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
 wenzelm parents: diff
changeset | 127 | |
| 34284 | 128 | TARGET_DIR="$ISABELLE_HOME/lib/classes" | 
| 43523 | 129 | TARGET="$TARGET_DIR/ext/Pure.jar" | 
| 34282 
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
 wenzelm parents: diff
changeset | 130 | |
| 45673 
cd41e3903fbf
separate compilation of PIDE vs. Pure sources, which enables independent Scala library;
 wenzelm parents: 
45672diff
changeset | 131 | declare -a PIDE_SOURCES=() | 
| 
cd41e3903fbf
separate compilation of PIDE vs. Pure sources, which enables independent Scala library;
 wenzelm parents: 
45672diff
changeset | 132 | declare -a PURE_SOURCES=() | 
| 
cd41e3903fbf
separate compilation of PIDE vs. Pure sources, which enables independent Scala library;
 wenzelm parents: 
45672diff
changeset | 133 | |
| 
cd41e3903fbf
separate compilation of PIDE vs. Pure sources, which enables independent Scala library;
 wenzelm parents: 
45672diff
changeset | 134 | for DEP in "${SOURCES[@]}"
 | 
| 
cd41e3903fbf
separate compilation of PIDE vs. Pure sources, which enables independent Scala library;
 wenzelm parents: 
45672diff
changeset | 135 | do | 
| 
cd41e3903fbf
separate compilation of PIDE vs. Pure sources, which enables independent Scala library;
 wenzelm parents: 
45672diff
changeset | 136 | if grep "Module:.*PIDE" "$DEP" >/dev/null | 
| 
cd41e3903fbf
separate compilation of PIDE vs. Pure sources, which enables independent Scala library;
 wenzelm parents: 
45672diff
changeset | 137 | then | 
| 
cd41e3903fbf
separate compilation of PIDE vs. Pure sources, which enables independent Scala library;
 wenzelm parents: 
45672diff
changeset | 138 |     PIDE_SOURCES["${#PIDE_SOURCES[@]}"]="$DEP"
 | 
| 
cd41e3903fbf
separate compilation of PIDE vs. Pure sources, which enables independent Scala library;
 wenzelm parents: 
45672diff
changeset | 139 | else | 
| 
cd41e3903fbf
separate compilation of PIDE vs. Pure sources, which enables independent Scala library;
 wenzelm parents: 
45672diff
changeset | 140 |     PURE_SOURCES["${#PURE_SOURCES[@]}"]="$DEP"
 | 
| 
cd41e3903fbf
separate compilation of PIDE vs. Pure sources, which enables independent Scala library;
 wenzelm parents: 
45672diff
changeset | 141 | fi | 
| 
cd41e3903fbf
separate compilation of PIDE vs. Pure sources, which enables independent Scala library;
 wenzelm parents: 
45672diff
changeset | 142 | done | 
| 
cd41e3903fbf
separate compilation of PIDE vs. Pure sources, which enables independent Scala library;
 wenzelm parents: 
45672diff
changeset | 143 | |
| 43405 | 144 | declare -a UPDATED=() | 
| 145 | ||
| 43280 | 146 | if [ -n "$FRESH" ]; then | 
| 147 | OUTDATED=true | |
| 148 | else | |
| 149 | OUTDATED=false | |
| 43523 | 150 | if [ ! -e "$TARGET" ]; then | 
| 151 | OUTDATED=true | |
| 152 | else | |
| 43405 | 153 |     for DEP in "${SOURCES[@]}"
 | 
| 43280 | 154 | do | 
| 43405 | 155 | [ ! -e "$DEP" ] && fail "Missing file: $DEP" | 
| 43523 | 156 |       [ "$DEP" -nt "$TARGET" ] && {
 | 
| 157 | OUTDATED=true | |
| 158 |         UPDATED["${#UPDATED[@]}"]="$DEP"
 | |
| 159 | } | |
| 43280 | 160 | done | 
| 43405 | 161 | fi | 
| 43280 | 162 | fi | 
| 34282 
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
 wenzelm parents: diff
changeset | 163 | |
| 34284 | 164 | if [ "$OUTDATED" = true ] | 
| 165 | then | |
| 34876 | 166 | echo "### Building Isabelle/Scala layer ..." | 
| 34282 
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
 wenzelm parents: diff
changeset | 167 | |
| 43405 | 168 |   [ "${#UPDATED[@]}" -gt 0 ] && {
 | 
| 169 | echo "Changed files:" | |
| 170 |     for FILE in "${UPDATED[@]}"
 | |
| 171 | do | |
| 172 | echo " $FILE" | |
| 173 | done | |
| 174 | } | |
| 175 | ||
| 34282 
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
 wenzelm parents: diff
changeset | 176 | rm -rf classes && mkdir classes | 
| 45673 
cd41e3903fbf
separate compilation of PIDE vs. Pure sources, which enables independent Scala library;
 wenzelm parents: 
45672diff
changeset | 177 | |
| 47009 | 178 | SCALAC_OPTIONS="$ISABELLE_SCALA_BUILD_OPTIONS -d classes" | 
| 45673 
cd41e3903fbf
separate compilation of PIDE vs. Pure sources, which enables independent Scala library;
 wenzelm parents: 
45672diff
changeset | 179 | |
| 47408 
63c05991882e
slightly faster default compilation of Isabelle/Scala;
 wenzelm parents: 
47115diff
changeset | 180 | if [ "$TEST_PIDE" = true ]; then | 
| 
63c05991882e
slightly faster default compilation of Isabelle/Scala;
 wenzelm parents: 
47115diff
changeset | 181 |     isabelle_scala scalac $SCALAC_OPTIONS "${PIDE_SOURCES[@]}" || \
 | 
| 
63c05991882e
slightly faster default compilation of Isabelle/Scala;
 wenzelm parents: 
47115diff
changeset | 182 | fail "Failed to compile PIDE sources" | 
| 
63c05991882e
slightly faster default compilation of Isabelle/Scala;
 wenzelm parents: 
47115diff
changeset | 183 |     isabelle_scala scalac $SCALAC_OPTIONS -classpath classes "${PURE_SOURCES[@]}" || \
 | 
| 
63c05991882e
slightly faster default compilation of Isabelle/Scala;
 wenzelm parents: 
47115diff
changeset | 184 | fail "Failed to compile Pure sources" | 
| 
63c05991882e
slightly faster default compilation of Isabelle/Scala;
 wenzelm parents: 
47115diff
changeset | 185 | else | 
| 
63c05991882e
slightly faster default compilation of Isabelle/Scala;
 wenzelm parents: 
47115diff
changeset | 186 | isabelle_scala scalac $SCALAC_OPTIONS -classpath classes \ | 
| 
63c05991882e
slightly faster default compilation of Isabelle/Scala;
 wenzelm parents: 
47115diff
changeset | 187 |       "${PIDE_SOURCES[@]}" "${PURE_SOURCES[@]}" || \
 | 
| 
63c05991882e
slightly faster default compilation of Isabelle/Scala;
 wenzelm parents: 
47115diff
changeset | 188 | fail "Failed to compile sources" | 
| 
63c05991882e
slightly faster default compilation of Isabelle/Scala;
 wenzelm parents: 
47115diff
changeset | 189 | fi | 
| 45673 
cd41e3903fbf
separate compilation of PIDE vs. Pure sources, which enables independent Scala library;
 wenzelm parents: 
45672diff
changeset | 190 | |
| 43523 | 191 | mkdir -p "$TARGET_DIR/ext" || fail "Failed to create directory $TARGET_DIR/ext" | 
| 43280 | 192 | |
| 43285 | 193 | pushd classes >/dev/null | 
| 43280 | 194 | |
| 43517 | 195 | CHARSET_SERVICE="META-INF/services/java.nio.charset.spi.CharsetProvider" | 
| 196 | mkdir -p "$(dirname "$CHARSET_SERVICE")" | |
| 197 | echo isabelle.Isabelle_Charset_Provider > "$CHARSET_SERVICE" | |
| 198 | ||
| 47115 
1a05adae1cc9
more robust command invocation via ISABELLE_JDK_HOME or SCALA_HOME (NB: bash exec requires genuine executable, not function);
 wenzelm parents: 
47113diff
changeset | 199 | isabelle_jdk jar cfe "$(jvmpath "$TARGET")" isabelle.GUI_Setup META-INF isabelle || \ | 
| 43523 | 200 | fail "Failed to produce $TARGET" | 
| 34282 
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
 wenzelm parents: diff
changeset | 201 | |
| 43523 | 202 | 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 | 203 | |
| 43280 | 204 | popd >/dev/null | 
| 205 | ||
| 34282 
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
 wenzelm parents: diff
changeset | 206 | rm -rf classes | 
| 
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
 wenzelm parents: diff
changeset | 207 | fi |