| author | huffman | 
| Mon, 02 Apr 2012 09:18:16 +0200 | |
| changeset 47268 | 262d96552e50 | 
| parent 47115 | 1a05adae1cc9 | 
| child 47408 | 63c05991882e | 
| 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" | 
| 34282 
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
 wenzelm parents: diff
changeset | 91 | |
| 
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
 wenzelm parents: diff
changeset | 92 | |
| 43280 | 93 | ## process command line | 
| 94 | ||
| 95 | # options | |
| 96 | ||
| 97 | FRESH="" | |
| 98 | ||
| 99 | while getopts "f" OPT | |
| 100 | do | |
| 101 | case "$OPT" in | |
| 102 | f) | |
| 103 | FRESH=true | |
| 104 | ;; | |
| 105 | \?) | |
| 106 | usage | |
| 107 | ;; | |
| 108 | esac | |
| 109 | done | |
| 110 | ||
| 111 | shift $(($OPTIND - 1)) | |
| 112 | ||
| 113 | ||
| 114 | # args | |
| 115 | ||
| 116 | [ "$#" -ne 0 ] && usage | |
| 117 | ||
| 118 | ||
| 119 | ||
| 43523 | 120 | # build | 
| 34282 
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
 wenzelm parents: diff
changeset | 121 | |
| 34284 | 122 | TARGET_DIR="$ISABELLE_HOME/lib/classes" | 
| 43523 | 123 | TARGET="$TARGET_DIR/ext/Pure.jar" | 
| 34282 
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
 wenzelm parents: diff
changeset | 124 | |
| 45673 
cd41e3903fbf
separate compilation of PIDE vs. Pure sources, which enables independent Scala library;
 wenzelm parents: 
45672diff
changeset | 125 | declare -a PIDE_SOURCES=() | 
| 
cd41e3903fbf
separate compilation of PIDE vs. Pure sources, which enables independent Scala library;
 wenzelm parents: 
45672diff
changeset | 126 | declare -a PURE_SOURCES=() | 
| 
cd41e3903fbf
separate compilation of PIDE vs. Pure sources, which enables independent Scala library;
 wenzelm parents: 
45672diff
changeset | 127 | |
| 
cd41e3903fbf
separate compilation of PIDE vs. Pure sources, which enables independent Scala library;
 wenzelm parents: 
45672diff
changeset | 128 | for DEP in "${SOURCES[@]}"
 | 
| 
cd41e3903fbf
separate compilation of PIDE vs. Pure sources, which enables independent Scala library;
 wenzelm parents: 
45672diff
changeset | 129 | do | 
| 
cd41e3903fbf
separate compilation of PIDE vs. Pure sources, which enables independent Scala library;
 wenzelm parents: 
45672diff
changeset | 130 | if grep "Module:.*PIDE" "$DEP" >/dev/null | 
| 
cd41e3903fbf
separate compilation of PIDE vs. Pure sources, which enables independent Scala library;
 wenzelm parents: 
45672diff
changeset | 131 | then | 
| 
cd41e3903fbf
separate compilation of PIDE vs. Pure sources, which enables independent Scala library;
 wenzelm parents: 
45672diff
changeset | 132 |     PIDE_SOURCES["${#PIDE_SOURCES[@]}"]="$DEP"
 | 
| 
cd41e3903fbf
separate compilation of PIDE vs. Pure sources, which enables independent Scala library;
 wenzelm parents: 
45672diff
changeset | 133 | else | 
| 
cd41e3903fbf
separate compilation of PIDE vs. Pure sources, which enables independent Scala library;
 wenzelm parents: 
45672diff
changeset | 134 |     PURE_SOURCES["${#PURE_SOURCES[@]}"]="$DEP"
 | 
| 
cd41e3903fbf
separate compilation of PIDE vs. Pure sources, which enables independent Scala library;
 wenzelm parents: 
45672diff
changeset | 135 | fi | 
| 
cd41e3903fbf
separate compilation of PIDE vs. Pure sources, which enables independent Scala library;
 wenzelm parents: 
45672diff
changeset | 136 | done | 
| 
cd41e3903fbf
separate compilation of PIDE vs. Pure sources, which enables independent Scala library;
 wenzelm parents: 
45672diff
changeset | 137 | |
| 43405 | 138 | declare -a UPDATED=() | 
| 139 | ||
| 43280 | 140 | if [ -n "$FRESH" ]; then | 
| 141 | OUTDATED=true | |
| 142 | else | |
| 143 | OUTDATED=false | |
| 43523 | 144 | if [ ! -e "$TARGET" ]; then | 
| 145 | OUTDATED=true | |
| 146 | else | |
| 43405 | 147 |     for DEP in "${SOURCES[@]}"
 | 
| 43280 | 148 | do | 
| 43405 | 149 | [ ! -e "$DEP" ] && fail "Missing file: $DEP" | 
| 43523 | 150 |       [ "$DEP" -nt "$TARGET" ] && {
 | 
| 151 | OUTDATED=true | |
| 152 |         UPDATED["${#UPDATED[@]}"]="$DEP"
 | |
| 153 | } | |
| 43280 | 154 | done | 
| 43405 | 155 | fi | 
| 43280 | 156 | fi | 
| 34282 
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
 wenzelm parents: diff
changeset | 157 | |
| 34284 | 158 | if [ "$OUTDATED" = true ] | 
| 159 | then | |
| 34876 | 160 | echo "### Building Isabelle/Scala layer ..." | 
| 34282 
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
 wenzelm parents: diff
changeset | 161 | |
| 43405 | 162 |   [ "${#UPDATED[@]}" -gt 0 ] && {
 | 
| 163 | echo "Changed files:" | |
| 164 |     for FILE in "${UPDATED[@]}"
 | |
| 165 | do | |
| 166 | echo " $FILE" | |
| 167 | done | |
| 168 | } | |
| 169 | ||
| 34282 
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
 wenzelm parents: diff
changeset | 170 | rm -rf classes && mkdir classes | 
| 45673 
cd41e3903fbf
separate compilation of PIDE vs. Pure sources, which enables independent Scala library;
 wenzelm parents: 
45672diff
changeset | 171 | |
| 47009 | 172 | 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 | 173 | |
| 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 | 174 |   isabelle_scala scalac $SCALAC_OPTIONS "${PIDE_SOURCES[@]}" || \
 | 
| 45673 
cd41e3903fbf
separate compilation of PIDE vs. Pure sources, which enables independent Scala library;
 wenzelm parents: 
45672diff
changeset | 175 | fail "Failed to compile PIDE sources" | 
| 
cd41e3903fbf
separate compilation of PIDE vs. Pure sources, which enables independent Scala library;
 wenzelm parents: 
45672diff
changeset | 176 | |
| 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 | 177 |   isabelle_scala scalac $SCALAC_OPTIONS -classpath classes "${PURE_SOURCES[@]}" || \
 | 
| 45673 
cd41e3903fbf
separate compilation of PIDE vs. Pure sources, which enables independent Scala library;
 wenzelm parents: 
45672diff
changeset | 178 | fail "Failed to compile Pure sources" | 
| 
cd41e3903fbf
separate compilation of PIDE vs. Pure sources, which enables independent Scala library;
 wenzelm parents: 
45672diff
changeset | 179 | |
| 43523 | 180 | mkdir -p "$TARGET_DIR/ext" || fail "Failed to create directory $TARGET_DIR/ext" | 
| 43280 | 181 | |
| 43285 | 182 | pushd classes >/dev/null | 
| 43280 | 183 | |
| 43517 | 184 | CHARSET_SERVICE="META-INF/services/java.nio.charset.spi.CharsetProvider" | 
| 185 | mkdir -p "$(dirname "$CHARSET_SERVICE")" | |
| 186 | echo isabelle.Isabelle_Charset_Provider > "$CHARSET_SERVICE" | |
| 187 | ||
| 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 | 188 | isabelle_jdk jar cfe "$(jvmpath "$TARGET")" isabelle.GUI_Setup META-INF isabelle || \ | 
| 43523 | 189 | fail "Failed to produce $TARGET" | 
| 34282 
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
 wenzelm parents: diff
changeset | 190 | |
| 43523 | 191 | 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 | 192 | |
| 43280 | 193 | popd >/dev/null | 
| 194 | ||
| 34282 
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
 wenzelm parents: diff
changeset | 195 | rm -rf classes | 
| 
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
 wenzelm parents: diff
changeset | 196 | fi |