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