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