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