| author | wenzelm | 
| Wed, 29 Aug 2012 20:54:49 +0200 | |
| changeset 49002 | 8ce0fa01ea86 | 
| parent 48411 | 5b3440850d36 | 
| child 49065 | 8ead9e8b15fb | 
| 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 | |
| 48411 
5b3440850d36
more abstract file system operations in Scala, corresponding to ML version;
 wenzelm parents: 
48410diff
changeset | 17 | General/file.scala | 
| 46611 | 18 | General/graph.scala | 
| 43320 | 19 | General/linear_set.scala | 
| 43600 
4ac04bf9ff89
abstract algebra of file paths in Scala (cf. path.ML);
 wenzelm parents: 
43523diff
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 | |
| 45674 | 27 | General/time.scala | 
| 45666 | 28 | General/timing.scala | 
| 43320 | 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: 
43695diff
changeset | 33 | PIDE/blob.scala | 
| 43320 | 34 | PIDE/command.scala | 
| 35 | PIDE/document.scala | |
| 45670 | 36 | PIDE/isabelle_markup.scala | 
| 37 | PIDE/markup.scala | |
| 43320 | 38 | PIDE/markup_tree.scala | 
| 45709 
87017fcbad83
clarified modules (again) -- NB: both Document and Protocol are specific to this particular prover;
 wenzelm parents: 
45674diff
changeset | 39 | PIDE/protocol.scala | 
| 43320 | 40 | PIDE/text.scala | 
| 44698 | 41 | PIDE/xml.scala | 
| 42 | PIDE/yxml.scala | |
| 48276 | 43 | System/build.scala | 
| 48346 
e2382bede914
more general support for Isabelle/Scala command line tools;
 wenzelm parents: 
48276diff
changeset | 44 | System/command_line.scala | 
| 43320 | 45 | System/event_bus.scala | 
| 46 | System/gui_setup.scala | |
| 43744 
2c7e1565b4a3
some support to invoke Scala methods under program control;
 wenzelm parents: 
43730diff
changeset | 47 | System/invoke_scala.scala | 
| 43517 | 48 | System/isabelle_charset.scala | 
| 43320 | 49 | System/isabelle_process.scala | 
| 50 | System/isabelle_system.scala | |
| 47663 
20e0865ae9e7
default Isabelle application wrapper -- JVM entry point for Isabelle.exe;
 wenzelm parents: 
47408diff
changeset | 51 | System/main.scala | 
| 48365 
d88aefda01c4
basic support for stand-alone options with external string representation;
 wenzelm parents: 
48346diff
changeset | 52 | System/options.scala | 
| 43320 | 53 | System/platform.scala | 
| 54 | System/session.scala | |
| 55 | System/standard_system.scala | |
| 56 | System/swing_thread.scala | |
| 45027 
f459e93a038e
more abstract wrapping of fifos as System_Channel;
 wenzelm parents: 
44698diff
changeset | 57 | System/system_channel.scala | 
| 43320 | 58 | Thy/completion.scala | 
| 59 | Thy/html.scala | |
| 60 | Thy/thy_header.scala | |
| 43651 
511df47bcadc
some support for theory files within Isabelle/Scala session;
 wenzelm parents: 
43600diff
changeset | 61 | Thy/thy_info.scala | 
| 
511df47bcadc
some support for theory files within Isabelle/Scala session;
 wenzelm parents: 
43600diff
changeset | 62 | Thy/thy_load.scala | 
| 43320 | 63 | Thy/thy_syntax.scala | 
| 64 | library.scala | |
| 65 | package.scala | |
| 43730 
a0ed7bc688b5
lambda terms with XML data representation in Scala;
 wenzelm parents: 
43715diff
changeset | 66 | term.scala | 
| 43779 | 67 | term_xml.scala | 
| 43320 | 68 | ) | 
| 69 | ||
| 34282 
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
 wenzelm parents: diff
changeset | 70 | |
| 
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
 wenzelm parents: diff
changeset | 71 | ## diagnostics | 
| 
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
 wenzelm parents: diff
changeset | 72 | |
| 43280 | 73 | PRG="$(basename "$0")" | 
| 74 | ||
| 75 | function usage() | |
| 76 | {
 | |
| 77 | echo | |
| 78 | echo "Usage: isabelle $PRG [OPTIONS]" | |
| 79 | echo | |
| 80 | echo " Options are:" | |
| 81 | echo " -f fresh build" | |
| 47408 
63c05991882e
slightly faster default compilation of Isabelle/Scala;
 wenzelm parents: 
47115diff
changeset | 82 | echo " -t test separate compilation of PIDE" | 
| 43280 | 83 | echo | 
| 84 | exit 1 | |
| 85 | } | |
| 86 | ||
| 34282 
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
 wenzelm parents: diff
changeset | 87 | function fail() | 
| 
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 | echo "$1" >&2 | 
| 
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
 wenzelm parents: diff
changeset | 90 | exit 2 | 
| 
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 | |
| 42899 | 93 | [ -z "$ISABELLE_HOME" ] && fail "Missing Isabelle settings environment" | 
| 34282 
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
 wenzelm parents: diff
changeset | 94 | |
| 
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
 wenzelm parents: diff
changeset | 95 | |
| 43280 | 96 | ## process command line | 
| 97 | ||
| 98 | # options | |
| 99 | ||
| 100 | FRESH="" | |
| 47408 
63c05991882e
slightly faster default compilation of Isabelle/Scala;
 wenzelm parents: 
47115diff
changeset | 101 | TEST_PIDE="" | 
| 43280 | 102 | |
| 47408 
63c05991882e
slightly faster default compilation of Isabelle/Scala;
 wenzelm parents: 
47115diff
changeset | 103 | while getopts "ft" OPT | 
| 43280 | 104 | do | 
| 105 | case "$OPT" in | |
| 106 | f) | |
| 107 | FRESH=true | |
| 108 | ;; | |
| 47408 
63c05991882e
slightly faster default compilation of Isabelle/Scala;
 wenzelm parents: 
47115diff
changeset | 109 | t) | 
| 
63c05991882e
slightly faster default compilation of Isabelle/Scala;
 wenzelm parents: 
47115diff
changeset | 110 | TEST_PIDE=true | 
| 
63c05991882e
slightly faster default compilation of Isabelle/Scala;
 wenzelm parents: 
47115diff
changeset | 111 | ;; | 
| 43280 | 112 | \?) | 
| 113 | usage | |
| 114 | ;; | |
| 115 | esac | |
| 116 | done | |
| 117 | ||
| 118 | shift $(($OPTIND - 1)) | |
| 119 | ||
| 120 | ||
| 121 | # args | |
| 122 | ||
| 123 | [ "$#" -ne 0 ] && usage | |
| 124 | ||
| 125 | ||
| 126 | ||
| 43523 | 127 | # build | 
| 34282 
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
 wenzelm parents: diff
changeset | 128 | |
| 34284 | 129 | TARGET_DIR="$ISABELLE_HOME/lib/classes" | 
| 43523 | 130 | TARGET="$TARGET_DIR/ext/Pure.jar" | 
| 34282 
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
 wenzelm parents: diff
changeset | 131 | |
| 45673 
cd41e3903fbf
separate compilation of PIDE vs. Pure sources, which enables independent Scala library;
 wenzelm parents: 
45672diff
changeset | 132 | declare -a PIDE_SOURCES=() | 
| 
cd41e3903fbf
separate compilation of PIDE vs. Pure sources, which enables independent Scala library;
 wenzelm parents: 
45672diff
changeset | 133 | declare -a PURE_SOURCES=() | 
| 
cd41e3903fbf
separate compilation of PIDE vs. Pure sources, which enables independent Scala library;
 wenzelm parents: 
45672diff
changeset | 134 | |
| 
cd41e3903fbf
separate compilation of PIDE vs. Pure sources, which enables independent Scala library;
 wenzelm parents: 
45672diff
changeset | 135 | for DEP in "${SOURCES[@]}"
 | 
| 
cd41e3903fbf
separate compilation of PIDE vs. Pure sources, which enables independent Scala library;
 wenzelm parents: 
45672diff
changeset | 136 | do | 
| 
cd41e3903fbf
separate compilation of PIDE vs. Pure sources, which enables independent Scala library;
 wenzelm parents: 
45672diff
changeset | 137 | if grep "Module:.*PIDE" "$DEP" >/dev/null | 
| 
cd41e3903fbf
separate compilation of PIDE vs. Pure sources, which enables independent Scala library;
 wenzelm parents: 
45672diff
changeset | 138 | then | 
| 
cd41e3903fbf
separate compilation of PIDE vs. Pure sources, which enables independent Scala library;
 wenzelm parents: 
45672diff
changeset | 139 |     PIDE_SOURCES["${#PIDE_SOURCES[@]}"]="$DEP"
 | 
| 
cd41e3903fbf
separate compilation of PIDE vs. Pure sources, which enables independent Scala library;
 wenzelm parents: 
45672diff
changeset | 140 | else | 
| 
cd41e3903fbf
separate compilation of PIDE vs. Pure sources, which enables independent Scala library;
 wenzelm parents: 
45672diff
changeset | 141 |     PURE_SOURCES["${#PURE_SOURCES[@]}"]="$DEP"
 | 
| 
cd41e3903fbf
separate compilation of PIDE vs. Pure sources, which enables independent Scala library;
 wenzelm parents: 
45672diff
changeset | 142 | fi | 
| 
cd41e3903fbf
separate compilation of PIDE vs. Pure sources, which enables independent Scala library;
 wenzelm parents: 
45672diff
changeset | 143 | done | 
| 
cd41e3903fbf
separate compilation of PIDE vs. Pure sources, which enables independent Scala library;
 wenzelm parents: 
45672diff
changeset | 144 | |
| 43405 | 145 | declare -a UPDATED=() | 
| 146 | ||
| 43280 | 147 | if [ -n "$FRESH" ]; then | 
| 148 | OUTDATED=true | |
| 149 | else | |
| 150 | OUTDATED=false | |
| 43523 | 151 | if [ ! -e "$TARGET" ]; then | 
| 152 | OUTDATED=true | |
| 153 | else | |
| 43405 | 154 |     for DEP in "${SOURCES[@]}"
 | 
| 43280 | 155 | do | 
| 43405 | 156 | [ ! -e "$DEP" ] && fail "Missing file: $DEP" | 
| 43523 | 157 |       [ "$DEP" -nt "$TARGET" ] && {
 | 
| 158 | OUTDATED=true | |
| 159 |         UPDATED["${#UPDATED[@]}"]="$DEP"
 | |
| 160 | } | |
| 43280 | 161 | done | 
| 43405 | 162 | fi | 
| 43280 | 163 | fi | 
| 34282 
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
 wenzelm parents: diff
changeset | 164 | |
| 34284 | 165 | if [ "$OUTDATED" = true ] | 
| 166 | then | |
| 34876 | 167 | echo "### Building Isabelle/Scala layer ..." | 
| 34282 
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
 wenzelm parents: diff
changeset | 168 | |
| 43405 | 169 |   [ "${#UPDATED[@]}" -gt 0 ] && {
 | 
| 170 | echo "Changed files:" | |
| 171 |     for FILE in "${UPDATED[@]}"
 | |
| 172 | do | |
| 173 | echo " $FILE" | |
| 174 | done | |
| 175 | } | |
| 176 | ||
| 34282 
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
 wenzelm parents: diff
changeset | 177 | rm -rf classes && mkdir classes | 
| 45673 
cd41e3903fbf
separate compilation of PIDE vs. Pure sources, which enables independent Scala library;
 wenzelm parents: 
45672diff
changeset | 178 | |
| 47009 | 179 | 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 | 180 | |
| 47408 
63c05991882e
slightly faster default compilation of Isabelle/Scala;
 wenzelm parents: 
47115diff
changeset | 181 | if [ "$TEST_PIDE" = true ]; then | 
| 
63c05991882e
slightly faster default compilation of Isabelle/Scala;
 wenzelm parents: 
47115diff
changeset | 182 |     isabelle_scala scalac $SCALAC_OPTIONS "${PIDE_SOURCES[@]}" || \
 | 
| 
63c05991882e
slightly faster default compilation of Isabelle/Scala;
 wenzelm parents: 
47115diff
changeset | 183 | fail "Failed to compile PIDE sources" | 
| 
63c05991882e
slightly faster default compilation of Isabelle/Scala;
 wenzelm parents: 
47115diff
changeset | 184 |     isabelle_scala scalac $SCALAC_OPTIONS -classpath classes "${PURE_SOURCES[@]}" || \
 | 
| 
63c05991882e
slightly faster default compilation of Isabelle/Scala;
 wenzelm parents: 
47115diff
changeset | 185 | fail "Failed to compile Pure sources" | 
| 
63c05991882e
slightly faster default compilation of Isabelle/Scala;
 wenzelm parents: 
47115diff
changeset | 186 | else | 
| 
63c05991882e
slightly faster default compilation of Isabelle/Scala;
 wenzelm parents: 
47115diff
changeset | 187 | isabelle_scala scalac $SCALAC_OPTIONS -classpath classes \ | 
| 
63c05991882e
slightly faster default compilation of Isabelle/Scala;
 wenzelm parents: 
47115diff
changeset | 188 |       "${PIDE_SOURCES[@]}" "${PURE_SOURCES[@]}" || \
 | 
| 
63c05991882e
slightly faster default compilation of Isabelle/Scala;
 wenzelm parents: 
47115diff
changeset | 189 | fail "Failed to compile sources" | 
| 
63c05991882e
slightly faster default compilation of Isabelle/Scala;
 wenzelm parents: 
47115diff
changeset | 190 | fi | 
| 45673 
cd41e3903fbf
separate compilation of PIDE vs. Pure sources, which enables independent Scala library;
 wenzelm parents: 
45672diff
changeset | 191 | |
| 43523 | 192 | mkdir -p "$TARGET_DIR/ext" || fail "Failed to create directory $TARGET_DIR/ext" | 
| 43280 | 193 | |
| 43285 | 194 | pushd classes >/dev/null | 
| 43280 | 195 | |
| 43517 | 196 | CHARSET_SERVICE="META-INF/services/java.nio.charset.spi.CharsetProvider" | 
| 197 | mkdir -p "$(dirname "$CHARSET_SERVICE")" | |
| 198 | echo isabelle.Isabelle_Charset_Provider > "$CHARSET_SERVICE" | |
| 199 | ||
| 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 | 200 | isabelle_jdk jar cfe "$(jvmpath "$TARGET")" isabelle.GUI_Setup META-INF isabelle || \ | 
| 43523 | 201 | fail "Failed to produce $TARGET" | 
| 34282 
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
 wenzelm parents: diff
changeset | 202 | |
| 47995 
72f52cd7c633
include scala-compiler.jar in basic Isabelle/Scala environment, to make Isabelle/jEdit console work with scala-2.10.0-M3;
 wenzelm parents: 
47849diff
changeset | 203 | cp "$SCALA_HOME/lib/scala-compiler.jar" \ | 
| 
72f52cd7c633
include scala-compiler.jar in basic Isabelle/Scala environment, to make Isabelle/jEdit console work with scala-2.10.0-M3;
 wenzelm parents: 
47849diff
changeset | 204 | "$SCALA_HOME/lib/scala-library.jar" \ | 
| 
72f52cd7c633
include scala-compiler.jar in basic Isabelle/Scala environment, to make Isabelle/jEdit console work with scala-2.10.0-M3;
 wenzelm parents: 
47849diff
changeset | 205 | "$SCALA_HOME/lib/scala-swing.jar" "$TARGET_DIR/ext" | 
| 
72f52cd7c633
include scala-compiler.jar in basic Isabelle/Scala environment, to make Isabelle/jEdit console work with scala-2.10.0-M3;
 wenzelm parents: 
47849diff
changeset | 206 | |
| 47849 | 207 | [ -e "$SCALA_HOME/lib/scala-actors.jar" ] && \ | 
| 208 | cp "$SCALA_HOME/lib/scala-actors.jar" "$TARGET_DIR/ext" | |
| 43521 
d477b92109b8
provide Isabelle/Scala environment as Java extension, instead of user classpath
 wenzelm parents: 
43517diff
changeset | 209 | |
| 43280 | 210 | popd >/dev/null | 
| 211 | ||
| 34282 
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
 wenzelm parents: diff
changeset | 212 | rm -rf classes | 
| 
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
 wenzelm parents: diff
changeset | 213 | fi |