src/Pure/build-jars
author wenzelm
Fri Aug 20 11:57:43 2010 +0200 (2010-08-20)
changeset 38567 b670faa807c9
parent 38483 3d16bebee1d3
child 38636 b7647ca7de5a
permissions -rwxr-xr-x
concentrate protocol message formats in Isar_Document;
wenzelm@34282
     1
#!/usr/bin/env bash
wenzelm@34282
     2
#
wenzelm@34282
     3
# Author: Makarius
wenzelm@34282
     4
#
wenzelm@34282
     5
# mk-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@34282
    18
[ -n "$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@34282
    26
  General/exn.scala
wenzelm@34282
    27
  General/linear_set.scala
wenzelm@34282
    28
  General/markup.scala
wenzelm@34282
    29
  General/position.scala
wenzelm@36683
    30
  General/pretty.scala
wenzelm@34282
    31
  General/scan.scala
wenzelm@38473
    32
  General/sha1.scala
wenzelm@34282
    33
  General/symbol.scala
wenzelm@34282
    34
  General/xml.scala
wenzelm@38267
    35
  General/xml_data.scala
wenzelm@34282
    36
  General/yxml.scala
wenzelm@36947
    37
  Isar/keyword.scala
wenzelm@34282
    38
  Isar/outer_syntax.scala
wenzelm@36948
    39
  Isar/parse.scala
wenzelm@36956
    40
  Isar/token.scala
wenzelm@36676
    41
  PIDE/command.scala
wenzelm@36676
    42
  PIDE/document.scala
wenzelm@38483
    43
  PIDE/isar_document.scala
wenzelm@38479
    44
  PIDE/markup_tree.scala
wenzelm@38425
    45
  PIDE/text.scala
wenzelm@34282
    46
  System/cygwin.scala
wenzelm@36676
    47
  System/download.scala
wenzelm@38428
    48
  System/event_bus.scala
wenzelm@34282
    49
  System/gui_setup.scala
wenzelm@34282
    50
  System/isabelle_process.scala
wenzelm@34282
    51
  System/isabelle_syntax.scala
wenzelm@34282
    52
  System/isabelle_system.scala
wenzelm@34282
    53
  System/platform.scala
wenzelm@34871
    54
  System/session.scala
wenzelm@34282
    55
  System/session_manager.scala
wenzelm@34282
    56
  System/standard_system.scala
wenzelm@36676
    57
  System/swing_thread.scala
wenzelm@34282
    58
  Thy/completion.scala
wenzelm@34282
    59
  Thy/html.scala
wenzelm@34282
    60
  Thy/thy_header.scala
wenzelm@34282
    61
  Thy/thy_syntax.scala
wenzelm@34282
    62
  library.scala
wenzelm@34282
    63
)
wenzelm@34282
    64
wenzelm@34284
    65
TARGET_DIR="$ISABELLE_HOME/lib/classes"
wenzelm@34284
    66
PURE_JAR="$TARGET_DIR/Pure.jar"
wenzelm@34284
    67
FULL_JAR="$TARGET_DIR/isabelle-scala.jar"
wenzelm@34284
    68
wenzelm@34284
    69
declare -a TARGETS=("$PURE_JAR" "$FULL_JAR")
wenzelm@34282
    70
wenzelm@34282
    71
wenzelm@34282
    72
## main
wenzelm@34282
    73
wenzelm@34282
    74
OUTDATED=false
wenzelm@34282
    75
wenzelm@34282
    76
for SOURCE in "${SOURCES[@]}"
wenzelm@34282
    77
do
wenzelm@34282
    78
  [ ! -e "$SOURCE" ] && fail "Missing source file: $SOURCE"
wenzelm@34284
    79
  for TARGET in "${TARGETS[@]}"
wenzelm@34282
    80
  do
wenzelm@34282
    81
    [ ! -e "$TARGET" -o "$SOURCE" -nt "$TARGET" ] && OUTDATED=true
wenzelm@34282
    82
  done
wenzelm@34282
    83
done
wenzelm@34282
    84
wenzelm@34284
    85
if [ "$OUTDATED" = true ]
wenzelm@34284
    86
then
wenzelm@34282
    87
  echo "###"
wenzelm@34876
    88
  echo "### Building Isabelle/Scala layer ..."
wenzelm@34282
    89
  echo "###"
wenzelm@34282
    90
wenzelm@34282
    91
  rm -rf classes && mkdir classes
wenzelm@36011
    92
  "$SCALA_HOME/bin/scalac" -unchecked -deprecation -d classes -target:jvm-1.5 "${SOURCES[@]}" || \
wenzelm@34282
    93
    fail "Failed to compile sources"
wenzelm@34284
    94
  mkdir -p "$TARGET_DIR" || fail "Failed to create directory $TARGET_DIR"
wenzelm@34282
    95
  (
wenzelm@34282
    96
    cd classes
wenzelm@34282
    97
    jar cfe "$(jvmpath "$PURE_JAR")" isabelle.GUI_Setup isabelle || \
wenzelm@34282
    98
      fail "Failed to produce $PURE_JAR"
wenzelm@34282
    99
wenzelm@34282
   100
    cp "$SCALA_HOME/lib/scala-swing.jar" .
wenzelm@34282
   101
    jar xf scala-swing.jar
wenzelm@34282
   102
wenzelm@34282
   103
    cp "$SCALA_HOME/lib/scala-library.jar" "$FULL_JAR"
wenzelm@34282
   104
    jar ufe "$(jvmpath "$FULL_JAR")" isabelle.GUI_Setup isabelle scala || \
wenzelm@34282
   105
      fail "Failed to produce $FULL_JAR"
wenzelm@34282
   106
  )
wenzelm@34282
   107
  rm -rf classes
wenzelm@34282
   108
fi