| author | panny | 
| Tue, 03 Dec 2013 02:51:20 +0100 | |
| changeset 54629 | a692901ecdc2 | 
| parent 54439 | 621a155c7715 | 
| child 54671 | d64a4ef26edb | 
| 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 | |
| 54439 | 16 | General/bytes.scala | 
| 43320 | 17 | General/exn.scala | 
| 48411 
5b3440850d36
more abstract file system operations in Scala, corresponding to ML version;
 wenzelm parents: 
48410diff
changeset | 18 | General/file.scala | 
| 46611 | 19 | General/graph.scala | 
| 51098 | 20 | General/graphics_file.scala | 
| 43320 | 21 | General/linear_set.scala | 
| 52975 | 22 | General/multi_map.scala | 
| 43600 
4ac04bf9ff89
abstract algebra of file paths in Scala (cf. path.ML);
 wenzelm parents: 
43523diff
changeset | 23 | General/path.scala | 
| 43320 | 24 | General/position.scala | 
| 25 | General/pretty.scala | |
| 43780 | 26 | General/properties.scala | 
| 43320 | 27 | General/scan.scala | 
| 28 | General/sha1.scala | |
| 29 | General/symbol.scala | |
| 45674 | 30 | General/time.scala | 
| 45666 | 31 | General/timing.scala | 
| 52671 
9a360530eac8
separate module XZ_File to avoid initial dependency on org.tukaani.xz;
 wenzelm parents: 
52667diff
changeset | 32 | General/xz_file.scala | 
| 53783 
f5e9d182f645
clarified location of GUI modules (which depend on Swing of JFX);
 wenzelm parents: 
53711diff
changeset | 33 | GUI/color_value.scala | 
| 
f5e9d182f645
clarified location of GUI modules (which depend on Swing of JFX);
 wenzelm parents: 
53711diff
changeset | 34 | GUI/gui.scala | 
| 
f5e9d182f645
clarified location of GUI modules (which depend on Swing of JFX);
 wenzelm parents: 
53711diff
changeset | 35 | GUI/html5_panel.scala | 
| 
f5e9d182f645
clarified location of GUI modules (which depend on Swing of JFX);
 wenzelm parents: 
53711diff
changeset | 36 | GUI/jfx_thread.scala | 
| 
f5e9d182f645
clarified location of GUI modules (which depend on Swing of JFX);
 wenzelm parents: 
53711diff
changeset | 37 | GUI/popup.scala | 
| 
f5e9d182f645
clarified location of GUI modules (which depend on Swing of JFX);
 wenzelm parents: 
53711diff
changeset | 38 | GUI/swing_thread.scala | 
| 
f5e9d182f645
clarified location of GUI modules (which depend on Swing of JFX);
 wenzelm parents: 
53711diff
changeset | 39 | GUI/system_dialog.scala | 
| 
f5e9d182f645
clarified location of GUI modules (which depend on Swing of JFX);
 wenzelm parents: 
53711diff
changeset | 40 | GUI/wrap_panel.scala | 
| 53279 | 41 | Isar/completion.scala | 
| 43320 | 42 | Isar/keyword.scala | 
| 43 | Isar/outer_syntax.scala | |
| 44 | Isar/parse.scala | |
| 45 | Isar/token.scala | |
| 46 | PIDE/command.scala | |
| 47 | PIDE/document.scala | |
| 52530 
99dd8b4ef3fe
explicit module Document_ID as source of globally unique identifiers across ML/Scala;
 wenzelm parents: 
52444diff
changeset | 48 | PIDE/document_id.scala | 
| 52971 
31926d2c04ee
tuned signature -- more abstract PIDE editor operations;
 wenzelm parents: 
52671diff
changeset | 49 | PIDE/editor.scala | 
| 45670 | 50 | PIDE/markup.scala | 
| 43320 | 51 | PIDE/markup_tree.scala | 
| 45709 
87017fcbad83
clarified modules (again) -- NB: both Document and Protocol are specific to this particular prover;
 wenzelm parents: 
45674diff
changeset | 52 | PIDE/protocol.scala | 
| 52981 | 53 | PIDE/query_operation.scala | 
| 43320 | 54 | PIDE/text.scala | 
| 44698 | 55 | PIDE/xml.scala | 
| 56 | PIDE/yxml.scala | |
| 48346 
e2382bede914
more general support for Isabelle/Scala command line tools;
 wenzelm parents: 
48276diff
changeset | 57 | System/command_line.scala | 
| 43320 | 58 | System/event_bus.scala | 
| 51250 
ca13a14cc52e
support for POSIX interrupts (bypassed on Windows);
 wenzelm parents: 
51098diff
changeset | 59 | System/interrupt.scala | 
| 43744 
2c7e1565b4a3
some support to invoke Scala methods under program control;
 wenzelm parents: 
43730diff
changeset | 60 | System/invoke_scala.scala | 
| 43517 | 61 | System/isabelle_charset.scala | 
| 51614 
22d1dd43f089
separate module Isabelle_Font, to keep this out of the way of generic Isabelle_System operations, notably for non-Isabelle/jEdit applications;
 wenzelm parents: 
51508diff
changeset | 62 | System/isabelle_font.scala | 
| 43320 | 63 | System/isabelle_process.scala | 
| 64 | System/isabelle_system.scala | |
| 48365 
d88aefda01c4
basic support for stand-alone options with external string representation;
 wenzelm parents: 
48346diff
changeset | 65 | System/options.scala | 
| 43320 | 66 | System/platform.scala | 
| 67 | System/session.scala | |
| 45027 
f459e93a038e
more abstract wrapping of fifos as System_Channel;
 wenzelm parents: 
44698diff
changeset | 68 | System/system_channel.scala | 
| 50203 | 69 | System/utf8.scala | 
| 43320 | 70 | Thy/html.scala | 
| 50707 
5b2bf7611662
maintain session index on Scala side, for more determistic results;
 wenzelm parents: 
50689diff
changeset | 71 | Thy/present.scala | 
| 43320 | 72 | Thy/thy_header.scala | 
| 43651 
511df47bcadc
some support for theory files within Isabelle/Scala session;
 wenzelm parents: 
43600diff
changeset | 73 | Thy/thy_info.scala | 
| 
511df47bcadc
some support for theory files within Isabelle/Scala session;
 wenzelm parents: 
43600diff
changeset | 74 | Thy/thy_load.scala | 
| 43320 | 75 | Thy/thy_syntax.scala | 
| 50686 | 76 | Tools/build.scala | 
| 52444 
2cfe6656d6d6
slightly improved "isabelle doc" based on Isabelle/Scala;
 wenzelm parents: 
52439diff
changeset | 77 | Tools/doc.scala | 
| 52439 
4cf3f6153eb8
improved "isabelle keywords" and "isabelle update_keywords" based on Isabelle/Scala, without requiring to build sessions first;
 wenzelm parents: 
52427diff
changeset | 78 | Tools/keywords.scala | 
| 50687 | 79 | Tools/main.scala | 
| 50981 | 80 | Tools/ml_statistics.scala | 
| 53055 
0fe8a9972eda
some protocol to determine provers according to ML;
 wenzelm parents: 
52981diff
changeset | 81 | Tools/sledgehammer_params.scala | 
| 50980 | 82 | Tools/task_statistics.scala | 
| 43320 | 83 | library.scala | 
| 84 | package.scala | |
| 43730 
a0ed7bc688b5
lambda terms with XML data representation in Scala;
 wenzelm parents: 
43715diff
changeset | 85 | term.scala | 
| 43779 | 86 | term_xml.scala | 
| 43320 | 87 | ) | 
| 88 | ||
| 34282 
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
 wenzelm parents: diff
changeset | 89 | |
| 
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
 wenzelm parents: diff
changeset | 90 | ## diagnostics | 
| 
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
 wenzelm parents: diff
changeset | 91 | |
| 43280 | 92 | PRG="$(basename "$0")" | 
| 93 | ||
| 94 | function usage() | |
| 95 | {
 | |
| 96 | echo | |
| 97 | echo "Usage: isabelle $PRG [OPTIONS]" | |
| 98 | echo | |
| 99 | echo " Options are:" | |
| 100 | echo " -f fresh build" | |
| 47408 
63c05991882e
slightly faster default compilation of Isabelle/Scala;
 wenzelm parents: 
47115diff
changeset | 101 | echo " -t test separate compilation of PIDE" | 
| 43280 | 102 | echo | 
| 103 | exit 1 | |
| 104 | } | |
| 105 | ||
| 34282 
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
 wenzelm parents: diff
changeset | 106 | function fail() | 
| 
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
 wenzelm parents: diff
changeset | 107 | {
 | 
| 
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
 wenzelm parents: diff
changeset | 108 | echo "$1" >&2 | 
| 
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
 wenzelm parents: diff
changeset | 109 | exit 2 | 
| 
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
 wenzelm parents: diff
changeset | 110 | } | 
| 
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
 wenzelm parents: diff
changeset | 111 | |
| 42899 | 112 | [ -z "$ISABELLE_HOME" ] && fail "Missing Isabelle settings environment" | 
| 34282 
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
 wenzelm parents: diff
changeset | 113 | |
| 
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
 wenzelm parents: diff
changeset | 114 | |
| 43280 | 115 | ## process command line | 
| 116 | ||
| 117 | # options | |
| 118 | ||
| 119 | FRESH="" | |
| 47408 
63c05991882e
slightly faster default compilation of Isabelle/Scala;
 wenzelm parents: 
47115diff
changeset | 120 | TEST_PIDE="" | 
| 43280 | 121 | |
| 47408 
63c05991882e
slightly faster default compilation of Isabelle/Scala;
 wenzelm parents: 
47115diff
changeset | 122 | while getopts "ft" OPT | 
| 43280 | 123 | do | 
| 124 | case "$OPT" in | |
| 125 | f) | |
| 126 | FRESH=true | |
| 127 | ;; | |
| 47408 
63c05991882e
slightly faster default compilation of Isabelle/Scala;
 wenzelm parents: 
47115diff
changeset | 128 | t) | 
| 
63c05991882e
slightly faster default compilation of Isabelle/Scala;
 wenzelm parents: 
47115diff
changeset | 129 | TEST_PIDE=true | 
| 
63c05991882e
slightly faster default compilation of Isabelle/Scala;
 wenzelm parents: 
47115diff
changeset | 130 | ;; | 
| 43280 | 131 | \?) | 
| 132 | usage | |
| 133 | ;; | |
| 134 | esac | |
| 135 | done | |
| 136 | ||
| 137 | shift $(($OPTIND - 1)) | |
| 138 | ||
| 139 | ||
| 140 | # args | |
| 141 | ||
| 142 | [ "$#" -ne 0 ] && usage | |
| 143 | ||
| 144 | ||
| 49558 | 145 | ## build | 
| 34282 
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
 wenzelm parents: diff
changeset | 146 | |
| 34284 | 147 | TARGET_DIR="$ISABELLE_HOME/lib/classes" | 
| 53577 | 148 | TARGET="$TARGET_DIR/Pure.jar" | 
| 34282 
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
 wenzelm parents: diff
changeset | 149 | |
| 45673 
cd41e3903fbf
separate compilation of PIDE vs. Pure sources, which enables independent Scala library;
 wenzelm parents: 
45672diff
changeset | 150 | declare -a PIDE_SOURCES=() | 
| 
cd41e3903fbf
separate compilation of PIDE vs. Pure sources, which enables independent Scala library;
 wenzelm parents: 
45672diff
changeset | 151 | declare -a PURE_SOURCES=() | 
| 
cd41e3903fbf
separate compilation of PIDE vs. Pure sources, which enables independent Scala library;
 wenzelm parents: 
45672diff
changeset | 152 | |
| 
cd41e3903fbf
separate compilation of PIDE vs. Pure sources, which enables independent Scala library;
 wenzelm parents: 
45672diff
changeset | 153 | for DEP in "${SOURCES[@]}"
 | 
| 
cd41e3903fbf
separate compilation of PIDE vs. Pure sources, which enables independent Scala library;
 wenzelm parents: 
45672diff
changeset | 154 | do | 
| 
cd41e3903fbf
separate compilation of PIDE vs. Pure sources, which enables independent Scala library;
 wenzelm parents: 
45672diff
changeset | 155 | if grep "Module:.*PIDE" "$DEP" >/dev/null | 
| 
cd41e3903fbf
separate compilation of PIDE vs. Pure sources, which enables independent Scala library;
 wenzelm parents: 
45672diff
changeset | 156 | then | 
| 
cd41e3903fbf
separate compilation of PIDE vs. Pure sources, which enables independent Scala library;
 wenzelm parents: 
45672diff
changeset | 157 |     PIDE_SOURCES["${#PIDE_SOURCES[@]}"]="$DEP"
 | 
| 
cd41e3903fbf
separate compilation of PIDE vs. Pure sources, which enables independent Scala library;
 wenzelm parents: 
45672diff
changeset | 158 | else | 
| 
cd41e3903fbf
separate compilation of PIDE vs. Pure sources, which enables independent Scala library;
 wenzelm parents: 
45672diff
changeset | 159 |     PURE_SOURCES["${#PURE_SOURCES[@]}"]="$DEP"
 | 
| 
cd41e3903fbf
separate compilation of PIDE vs. Pure sources, which enables independent Scala library;
 wenzelm parents: 
45672diff
changeset | 160 | fi | 
| 
cd41e3903fbf
separate compilation of PIDE vs. Pure sources, which enables independent Scala library;
 wenzelm parents: 
45672diff
changeset | 161 | done | 
| 
cd41e3903fbf
separate compilation of PIDE vs. Pure sources, which enables independent Scala library;
 wenzelm parents: 
45672diff
changeset | 162 | |
| 43405 | 163 | declare -a UPDATED=() | 
| 164 | ||
| 43280 | 165 | if [ -n "$FRESH" ]; then | 
| 166 | OUTDATED=true | |
| 167 | else | |
| 168 | OUTDATED=false | |
| 43523 | 169 | if [ ! -e "$TARGET" ]; then | 
| 170 | OUTDATED=true | |
| 171 | else | |
| 43405 | 172 |     for DEP in "${SOURCES[@]}"
 | 
| 43280 | 173 | do | 
| 43405 | 174 | [ ! -e "$DEP" ] && fail "Missing file: $DEP" | 
| 43523 | 175 |       [ "$DEP" -nt "$TARGET" ] && {
 | 
| 176 | OUTDATED=true | |
| 177 |         UPDATED["${#UPDATED[@]}"]="$DEP"
 | |
| 178 | } | |
| 43280 | 179 | done | 
| 43405 | 180 | fi | 
| 43280 | 181 | fi | 
| 34282 
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
 wenzelm parents: diff
changeset | 182 | |
| 34284 | 183 | if [ "$OUTDATED" = true ] | 
| 184 | then | |
| 49173 
fa01a202399c
eliminated potentially confusing terminology of Scala "layer";
 wenzelm parents: 
49068diff
changeset | 185 | echo "### Building Isabelle/Scala ..." | 
| 34282 
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
 wenzelm parents: diff
changeset | 186 | |
| 43405 | 187 |   [ "${#UPDATED[@]}" -gt 0 ] && {
 | 
| 188 | echo "Changed files:" | |
| 189 |     for FILE in "${UPDATED[@]}"
 | |
| 190 | do | |
| 191 | echo " $FILE" | |
| 192 | done | |
| 193 | } | |
| 194 | ||
| 34282 
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
 wenzelm parents: diff
changeset | 195 | rm -rf classes && mkdir classes | 
| 45673 
cd41e3903fbf
separate compilation of PIDE vs. Pure sources, which enables independent Scala library;
 wenzelm parents: 
45672diff
changeset | 196 | |
| 47009 | 197 | 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 | 198 | |
| 50689 | 199 | ( | 
| 53576 
793a429c63e7
maintain classpath in more elementary manner: turn ISABELLE_CLASSPATH into -classpath option, so that all jars are covered by sun.misc.Launcher.AppClassLoader (e.g. relevant for loading add-on resources);
 wenzelm parents: 
53519diff
changeset | 200 | classpath "$ISABELLE_JDK_HOME/jre/lib/jfxrt.jar" | 
| 
793a429c63e7
maintain classpath in more elementary manner: turn ISABELLE_CLASSPATH into -classpath option, so that all jars are covered by sun.misc.Launcher.AppClassLoader (e.g. relevant for loading add-on resources);
 wenzelm parents: 
53519diff
changeset | 201 | classpath classes | 
| 
793a429c63e7
maintain classpath in more elementary manner: turn ISABELLE_CLASSPATH into -classpath option, so that all jars are covered by sun.misc.Launcher.AppClassLoader (e.g. relevant for loading add-on resources);
 wenzelm parents: 
53519diff
changeset | 202 | export CLASSPATH="$(jvmpath "$ISABELLE_CLASSPATH")" | 
| 50689 | 203 | |
| 204 | if [ "$TEST_PIDE" = true ]; then | |
| 205 |       isabelle_scala scalac $SCALAC_OPTIONS "${PIDE_SOURCES[@]}" || \
 | |
| 206 | fail "Failed to compile PIDE sources" | |
| 207 |       isabelle_scala scalac $SCALAC_OPTIONS "${PURE_SOURCES[@]}" || \
 | |
| 208 | fail "Failed to compile Pure sources" | |
| 209 | else | |
| 210 |       isabelle_scala scalac $SCALAC_OPTIONS "${PIDE_SOURCES[@]}" "${PURE_SOURCES[@]}" || \
 | |
| 211 | fail "Failed to compile sources" | |
| 212 | fi | |
| 51508 | 213 | ) || exit "$?" | 
| 45673 
cd41e3903fbf
separate compilation of PIDE vs. Pure sources, which enables independent Scala library;
 wenzelm parents: 
45672diff
changeset | 214 | |
| 53577 | 215 | mkdir -p "$TARGET_DIR" || fail "Failed to create directory $TARGET_DIR" | 
| 43280 | 216 | |
| 43285 | 217 | pushd classes >/dev/null | 
| 43280 | 218 | |
| 43517 | 219 | CHARSET_SERVICE="META-INF/services/java.nio.charset.spi.CharsetProvider" | 
| 220 | mkdir -p "$(dirname "$CHARSET_SERVICE")" | |
| 221 | echo isabelle.Isabelle_Charset_Provider > "$CHARSET_SERVICE" | |
| 222 | ||
| 53452 
8181bc357dc4
more portable access to icon -- avoid Isabelle_System which is not yet initialized in bootstrap;
 wenzelm parents: 
53279diff
changeset | 223 | cp "$ISABELLE_HOME/lib/logo/isabelle.gif" isabelle/. | 
| 
8181bc357dc4
more portable access to icon -- avoid Isabelle_System which is not yet initialized in bootstrap;
 wenzelm parents: 
53279diff
changeset | 224 | |
| 53841 | 225 | isabelle_jdk jar cfe "$(jvmpath "$TARGET")" isabelle.Main META-INF isabelle || \ | 
| 43523 | 226 | fail "Failed to produce $TARGET" | 
| 34282 
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
 wenzelm parents: diff
changeset | 227 | |
| 49449 | 228 | cp "$SCALA_HOME/lib/scala-compiler.jar" \ | 
| 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 | 229 | "$SCALA_HOME/lib/scala-library.jar" \ | 
| 53577 | 230 | "$SCALA_HOME/lib/scala-swing.jar" \ | 
| 231 | "$SCALA_HOME/lib/scala-actors.jar" \ | |
| 232 | "$SCALA_HOME/lib/scala-reflect.jar" \ | |
| 233 | "$TARGET_DIR" | |
| 49955 | 234 | |
| 43280 | 235 | popd >/dev/null | 
| 236 | ||
| 34282 
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
 wenzelm parents: diff
changeset | 237 | rm -rf classes | 
| 
549969a7f582
simplified build/bootstrap of Isabelle/Scala components -- avoid make;
 wenzelm parents: diff
changeset | 238 | fi |