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