src/Pure/build-jars
changeset 34284 33ad3571ad83
parent 34282 549969a7f582
child 34871 e596a0b71f3c
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/src/Pure/build-jars	Wed Jan 06 22:21:25 2010 +0100
     1.3 @@ -0,0 +1,101 @@
     1.4 +#!/usr/bin/env bash
     1.5 +#
     1.6 +# Author: Makarius
     1.7 +#
     1.8 +# mk-jars - build Isabelle/Scala
     1.9 +#
    1.10 +# Requires proper Isabelle settings environment.
    1.11 +
    1.12 +
    1.13 +## diagnostics
    1.14 +
    1.15 +function fail()
    1.16 +{
    1.17 +  echo "$1" >&2
    1.18 +  exit 2
    1.19 +}
    1.20 +
    1.21 +[ -n "$ISABELLE_HOME" ] || fail "Missing Isabelle settings environment"
    1.22 +[ -z "$SCALA_HOME" ] && fail "Scala unavailable: unknown SCALA_HOME"
    1.23 +
    1.24 +
    1.25 +## dependencies
    1.26 +
    1.27 +declare -a SOURCES=(
    1.28 +  Concurrent/future.scala
    1.29 +  General/download.scala
    1.30 +  General/event_bus.scala
    1.31 +  General/exn.scala
    1.32 +  General/linear_set.scala
    1.33 +  General/markup.scala
    1.34 +  General/position.scala
    1.35 +  General/scan.scala
    1.36 +  General/swing_thread.scala
    1.37 +  General/symbol.scala
    1.38 +  General/xml.scala
    1.39 +  General/yxml.scala
    1.40 +  Isar/isar_document.scala
    1.41 +  Isar/outer_keyword.scala
    1.42 +  Isar/outer_lex.scala
    1.43 +  Isar/outer_parse.scala
    1.44 +  Isar/outer_syntax.scala
    1.45 +  System/cygwin.scala
    1.46 +  System/gui_setup.scala
    1.47 +  System/isabelle_process.scala
    1.48 +  System/isabelle_syntax.scala
    1.49 +  System/isabelle_system.scala
    1.50 +  System/platform.scala
    1.51 +  System/session_manager.scala
    1.52 +  System/standard_system.scala
    1.53 +  Thy/completion.scala
    1.54 +  Thy/html.scala
    1.55 +  Thy/text_edit.scala
    1.56 +  Thy/thy_header.scala
    1.57 +  Thy/thy_syntax.scala
    1.58 +  library.scala
    1.59 +)
    1.60 +
    1.61 +TARGET_DIR="$ISABELLE_HOME/lib/classes"
    1.62 +PURE_JAR="$TARGET_DIR/Pure.jar"
    1.63 +FULL_JAR="$TARGET_DIR/isabelle-scala.jar"
    1.64 +
    1.65 +declare -a TARGETS=("$PURE_JAR" "$FULL_JAR")
    1.66 +
    1.67 +
    1.68 +## main
    1.69 +
    1.70 +OUTDATED=false
    1.71 +
    1.72 +for SOURCE in "${SOURCES[@]}"
    1.73 +do
    1.74 +  [ ! -e "$SOURCE" ] && fail "Missing source file: $SOURCE"
    1.75 +  for TARGET in "${TARGETS[@]}"
    1.76 +  do
    1.77 +    [ ! -e "$TARGET" -o "$SOURCE" -nt "$TARGET" ] && OUTDATED=true
    1.78 +  done
    1.79 +done
    1.80 +
    1.81 +if [ "$OUTDATED" = true ]
    1.82 +then
    1.83 +  echo "###"
    1.84 +  echo "### Building Isabelle/Scala components ..."
    1.85 +  echo "###"
    1.86 +
    1.87 +  rm -rf classes && mkdir classes
    1.88 +  "$SCALA_HOME/bin/scalac" -unchecked -deprecation -d classes -target jvm-1.5 "${SOURCES[@]}" || \
    1.89 +    fail "Failed to compile sources"
    1.90 +  mkdir -p "$TARGET_DIR" || fail "Failed to create directory $TARGET_DIR"
    1.91 +  (
    1.92 +    cd classes
    1.93 +    jar cfe "$(jvmpath "$PURE_JAR")" isabelle.GUI_Setup isabelle || \
    1.94 +      fail "Failed to produce $PURE_JAR"
    1.95 +
    1.96 +    cp "$SCALA_HOME/lib/scala-swing.jar" .
    1.97 +    jar xf scala-swing.jar
    1.98 +
    1.99 +    cp "$SCALA_HOME/lib/scala-library.jar" "$FULL_JAR"
   1.100 +    jar ufe "$(jvmpath "$FULL_JAR")" isabelle.GUI_Setup isabelle scala || \
   1.101 +      fail "Failed to produce $FULL_JAR"
   1.102 +  )
   1.103 +  rm -rf classes
   1.104 +fi