src/Pure/build-jars
author wenzelm
Sat May 21 00:00:14 2011 +0200 (2011-05-21)
changeset 42899 108e815fdc8e
parent 42720 caa4f1279154
child 43280 e5dd0ae1b054
permissions -rwxr-xr-x
misc tuning and update;
wenzelm@34282
     1
#!/usr/bin/env bash
wenzelm@34282
     2
#
wenzelm@34282
     3
# Author: Makarius
wenzelm@34282
     4
#
wenzelm@42899
     5
# build-jars - build Isabelle/Scala
wenzelm@34282
     6
#
wenzelm@34282
     7
# Requires proper Isabelle settings environment.
wenzelm@34282
     8
wenzelm@34282
     9
wenzelm@34282
    10
## diagnostics
wenzelm@34282
    11
wenzelm@34282
    12
function fail()
wenzelm@34282
    13
{
wenzelm@34282
    14
  echo "$1" >&2
wenzelm@34282
    15
  exit 2
wenzelm@34282
    16
}
wenzelm@34282
    17
wenzelm@42899
    18
[ -z "$ISABELLE_HOME" ] && fail "Missing Isabelle settings environment"
wenzelm@37174
    19
[ -z "$SCALA_HOME" ] && fail "Unknown SCALA_HOME -- Scala unavailable"
wenzelm@34282
    20
wenzelm@34282
    21
wenzelm@34282
    22
## dependencies
wenzelm@34282
    23
wenzelm@34282
    24
declare -a SOURCES=(
wenzelm@34282
    25
  Concurrent/future.scala
wenzelm@38636
    26
  Concurrent/simple_thread.scala
wenzelm@38840
    27
  Concurrent/volatile.scala
wenzelm@34282
    28
  General/exn.scala
wenzelm@40393
    29
  General/timing.scala
wenzelm@34282
    30
  General/linear_set.scala
wenzelm@34282
    31
  General/markup.scala
wenzelm@34282
    32
  General/position.scala
wenzelm@36683
    33
  General/pretty.scala
wenzelm@34282
    34
  General/scan.scala
wenzelm@38473
    35
  General/sha1.scala
wenzelm@34282
    36
  General/symbol.scala
wenzelm@34282
    37
  General/xml.scala
wenzelm@38267
    38
  General/xml_data.scala
wenzelm@34282
    39
  General/yxml.scala
wenzelm@36947
    40
  Isar/keyword.scala
wenzelm@34282
    41
  Isar/outer_syntax.scala
wenzelm@36948
    42
  Isar/parse.scala
wenzelm@36956
    43
  Isar/token.scala
wenzelm@36676
    44
  PIDE/command.scala
wenzelm@36676
    45
  PIDE/document.scala
wenzelm@38483
    46
  PIDE/isar_document.scala
wenzelm@38479
    47
  PIDE/markup_tree.scala
wenzelm@38425
    48
  PIDE/text.scala
wenzelm@34282
    49
  System/cygwin.scala
wenzelm@36676
    50
  System/download.scala
wenzelm@38428
    51
  System/event_bus.scala
wenzelm@34282
    52
  System/gui_setup.scala
wenzelm@34282
    53
  System/isabelle_process.scala
wenzelm@34282
    54
  System/isabelle_syntax.scala
wenzelm@34282
    55
  System/isabelle_system.scala
wenzelm@34282
    56
  System/platform.scala
wenzelm@34871
    57
  System/session.scala
wenzelm@34282
    58
  System/session_manager.scala
wenzelm@34282
    59
  System/standard_system.scala
wenzelm@36676
    60
  System/swing_thread.scala
wenzelm@34282
    61
  Thy/completion.scala
wenzelm@34282
    62
  Thy/html.scala
wenzelm@34282
    63
  Thy/thy_header.scala
wenzelm@34282
    64
  Thy/thy_syntax.scala
wenzelm@34282
    65
  library.scala
wenzelm@42720
    66
  package.scala
wenzelm@34282
    67
)
wenzelm@34282
    68
wenzelm@34284
    69
TARGET_DIR="$ISABELLE_HOME/lib/classes"
wenzelm@34284
    70
PURE_JAR="$TARGET_DIR/Pure.jar"
wenzelm@34284
    71
FULL_JAR="$TARGET_DIR/isabelle-scala.jar"
wenzelm@34284
    72
wenzelm@34284
    73
declare -a TARGETS=("$PURE_JAR" "$FULL_JAR")
wenzelm@34282
    74
wenzelm@34282
    75
wenzelm@34282
    76
## main
wenzelm@34282
    77
wenzelm@34282
    78
OUTDATED=false
wenzelm@34282
    79
wenzelm@34282
    80
for SOURCE in "${SOURCES[@]}"
wenzelm@34282
    81
do
wenzelm@34282
    82
  [ ! -e "$SOURCE" ] && fail "Missing source file: $SOURCE"
wenzelm@34284
    83
  for TARGET in "${TARGETS[@]}"
wenzelm@34282
    84
  do
wenzelm@34282
    85
    [ ! -e "$TARGET" -o "$SOURCE" -nt "$TARGET" ] && OUTDATED=true
wenzelm@34282
    86
  done
wenzelm@34282
    87
done
wenzelm@34282
    88
wenzelm@34284
    89
if [ "$OUTDATED" = true ]
wenzelm@34284
    90
then
wenzelm@34282
    91
  echo "###"
wenzelm@34876
    92
  echo "### Building Isabelle/Scala layer ..."
wenzelm@34282
    93
  echo "###"
wenzelm@34282
    94
wenzelm@34282
    95
  rm -rf classes && mkdir classes
wenzelm@36011
    96
  "$SCALA_HOME/bin/scalac" -unchecked -deprecation -d classes -target:jvm-1.5 "${SOURCES[@]}" || \
wenzelm@34282
    97
    fail "Failed to compile sources"
wenzelm@34284
    98
  mkdir -p "$TARGET_DIR" || fail "Failed to create directory $TARGET_DIR"
wenzelm@34282
    99
  (
wenzelm@34282
   100
    cd classes
wenzelm@34282
   101
    jar cfe "$(jvmpath "$PURE_JAR")" isabelle.GUI_Setup isabelle || \
wenzelm@34282
   102
      fail "Failed to produce $PURE_JAR"
wenzelm@34282
   103
wenzelm@34282
   104
    cp "$SCALA_HOME/lib/scala-swing.jar" .
wenzelm@34282
   105
    jar xf scala-swing.jar
wenzelm@34282
   106
wenzelm@34282
   107
    cp "$SCALA_HOME/lib/scala-library.jar" "$FULL_JAR"
wenzelm@34282
   108
    jar ufe "$(jvmpath "$FULL_JAR")" isabelle.GUI_Setup isabelle scala || \
wenzelm@34282
   109
      fail "Failed to produce $FULL_JAR"
wenzelm@34282
   110
  )
wenzelm@34282
   111
  rm -rf classes
wenzelm@34282
   112
fi