build jedit as part of regular startup script (in that case depending on jedit_build component);
authorwenzelm
Wed Jun 08 20:58:51 2011 +0200 (2011-06-08)
changeset 4328404d473e883df
parent 43283 446e6621762d
child 43285 966f359dc724
build jedit as part of regular startup script (in that case depending on jedit_build component);
misc tuning and simplification;
etc/components
src/Tools/jEdit/dist-template/etc/isabelle-jedit.css
src/Tools/jEdit/dist-template/etc/settings
src/Tools/jEdit/dist-template/lib/Tools/jedit
src/Tools/jEdit/etc/isabelle-jedit.css
src/Tools/jEdit/etc/settings
src/Tools/jEdit/jedit_build/Tools/jedit
src/Tools/jEdit/lib/Tools/jedit
     1.1 --- a/etc/components	Wed Jun 08 17:49:01 2011 +0200
     1.2 +++ b/etc/components	Wed Jun 08 20:58:51 2011 +0200
     1.3 @@ -11,6 +11,7 @@
     1.4  src/Sequents
     1.5  #misc components
     1.6  src/Tools/Code
     1.7 +src/Tools/jEdit
     1.8  src/Tools/WWW_Find
     1.9  src/HOL/Tools/ATP
    1.10  src/HOL/Mirabelle
     2.1 --- a/src/Tools/jEdit/dist-template/etc/isabelle-jedit.css	Wed Jun 08 17:49:01 2011 +0200
     2.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.3 @@ -1,19 +0,0 @@
     2.4 -/* additional style file for Isabelle/jEdit output */
     2.5 -
     2.6 -.message { margin-top: 0.3ex; background-color: #F0F0F0; }
     2.7 -
     2.8 -.writeln { }
     2.9 -.tracing { background-color: #F0F8FF; }
    2.10 -.warning { background-color: #EEE8AA; }
    2.11 -.error { background-color: #FFC1C1; }
    2.12 -
    2.13 -.report { display: none; }
    2.14 -
    2.15 -.hilite { background-color: #FFCC66; }
    2.16 -
    2.17 -.keyword { font-weight: bold; color: #009966; }
    2.18 -.operator { font-weight: bold; }
    2.19 -.command { font-weight: bold; color: #006699; }
    2.20 -
    2.21 -.sendback { text-decoration: underline; }
    2.22 -.sendback:hover { background-color: #FFCC66; }
     3.1 --- a/src/Tools/jEdit/dist-template/etc/settings	Wed Jun 08 17:49:01 2011 +0200
     3.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.3 @@ -1,16 +0,0 @@
     3.4 -# -*- shell-script -*- :mode=shellscript:
     3.5 -
     3.6 -JEDIT_HOME="$COMPONENT"
     3.7 -JEDIT_SETTINGS="$ISABELLE_HOME_USER/jedit"
     3.8 -
     3.9 -JEDIT_OPTIONS="-reuseview -noserver -nobackground"
    3.10 -JEDIT_JAVA_OPTIONS="-Xms128m -Xmx1024m -Xss4m -Dactors.corePoolSize=4 -Dactors.enableForkJoin=false"
    3.11 -#JEDIT_JAVA_OPTIONS="-Xms128m -Xmx512m -Xss2m -Dactors.corePoolSize=4 -Dactors.enableForkJoin=false"
    3.12 -JEDIT_SYSTEM_OPTIONS="-Dapple.laf.useScreenMenuBar=true -Dcom.apple.mrj.application.apple.menu.about.name=Isabelle/jEdit"
    3.13 -
    3.14 -JEDIT_STYLE_SHEETS="$ISABELLE_HOME/lib/html/isabelle.css:$JEDIT_HOME/etc/isabelle-jedit.css:$ISABELLE_HOME_USER/etc/isabelle.css:$ISABELLE_HOME_USER/etc/isabelle-jedit.css"
    3.15 -
    3.16 -ISABELLE_JEDIT_OPTIONS="-m xsymbols -m no_brackets -m no_type_brackets"
    3.17 -
    3.18 -ISABELLE_TOOLS="$ISABELLE_TOOLS:$JEDIT_HOME/lib/Tools"
    3.19 -
     4.1 --- a/src/Tools/jEdit/dist-template/lib/Tools/jedit	Wed Jun 08 17:49:01 2011 +0200
     4.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.3 @@ -1,132 +0,0 @@
     4.4 -#!/usr/bin/env bash
     4.5 -#
     4.6 -# Author: Makarius
     4.7 -#
     4.8 -# DESCRIPTION: Isabelle/jEdit interface wrapper
     4.9 -
    4.10 -
    4.11 -## diagnostics
    4.12 -
    4.13 -PRG="$(basename "$0")"
    4.14 -
    4.15 -usage()
    4.16 -{
    4.17 -  echo
    4.18 -  echo "Usage: isabelle $PRG [OPTIONS] [FILES ...]"
    4.19 -  echo
    4.20 -  echo "  Options are:"
    4.21 -  echo "    -J OPTION    add JVM runtime option"
    4.22 -  echo "                 (default JEDIT_JAVA_OPTIONS=$JEDIT_JAVA_OPTIONS)"
    4.23 -  echo "    -d           enable debugger"
    4.24 -  echo "    -j OPTION    add jEdit runtime option"
    4.25 -  echo "                 (default JEDIT_OPTIONS=$JEDIT_OPTIONS)"
    4.26 -  echo "    -l NAME      logic image name (default ISABELLE_LOGIC=$ISABELLE_LOGIC)"
    4.27 -  echo "    -m MODE      add print mode for output"
    4.28 -  echo
    4.29 -  echo "Start jEdit with Isabelle plugin setup and opens theory FILES"
    4.30 -  echo
    4.31 -  exit 1
    4.32 -}
    4.33 -
    4.34 -fail()
    4.35 -{
    4.36 -  echo "$1" >&2
    4.37 -  exit 2
    4.38 -}
    4.39 -
    4.40 -
    4.41 -## process command line
    4.42 -
    4.43 -# options
    4.44 -
    4.45 -JEDIT_LOGIC="$ISABELLE_LOGIC"
    4.46 -JEDIT_PRINT_MODE=""
    4.47 -
    4.48 -getoptions()
    4.49 -{
    4.50 -  OPTIND=1
    4.51 -  while getopts "J:dj:l:m:" OPT
    4.52 -  do
    4.53 -    case "$OPT" in
    4.54 -      J)
    4.55 -        JAVA_ARGS["${#JAVA_ARGS[@]}"]="$OPTARG"
    4.56 -        ;;
    4.57 -      d)
    4.58 -        JAVA_ARGS["${#JAVA_ARGS[@]}"]="-Xdebug"
    4.59 -        JAVA_ARGS["${#JAVA_ARGS[@]}"]="-Xrunjdwp:transport=dt_socket,server=y,suspend=n"
    4.60 -        ;;
    4.61 -      j)
    4.62 -        ARGS["${#ARGS[@]}"]="$OPTARG"
    4.63 -        ;;
    4.64 -      l)
    4.65 -        JEDIT_LOGIC="$OPTARG"
    4.66 -        ;;
    4.67 -      m)
    4.68 -        if [ -z "$JEDIT_PRINT_MODE" ]; then
    4.69 -          JEDIT_PRINT_MODE="$OPTARG"
    4.70 -        else
    4.71 -          JEDIT_PRINT_MODE="$JEDIT_PRINT_MODE,$OPTARG"
    4.72 -        fi
    4.73 -        ;;
    4.74 -      \?)
    4.75 -        usage
    4.76 -        ;;
    4.77 -    esac
    4.78 -  done
    4.79 -}
    4.80 -
    4.81 -declare -a JAVA_ARGS; eval "JAVA_ARGS=($JEDIT_JAVA_OPTIONS $JEDIT_SYSTEM_OPTIONS)"
    4.82 -[ -n "$SCALA_HOME" ] && JAVA_ARGS["${#JAVA_ARGS[@]}"]="-Dscala.home=$SCALA_HOME"
    4.83 -
    4.84 -declare -a ARGS; eval "ARGS=($JEDIT_OPTIONS)"
    4.85 -
    4.86 -declare -a OPTIONS; eval "OPTIONS=($ISABELLE_JEDIT_OPTIONS)"
    4.87 -getoptions "${OPTIONS[@]}"
    4.88 -
    4.89 -getoptions "$@"
    4.90 -shift $(($OPTIND - 1))
    4.91 -
    4.92 -
    4.93 -# args
    4.94 -
    4.95 -while [ "$#" -gt 0 ]; do
    4.96 -  ARGS["${#ARGS[@]}"]="$(jvmpath "$1")"
    4.97 -  shift
    4.98 -done
    4.99 -
   4.100 -
   4.101 -## default perspective
   4.102 -
   4.103 -mkdir -p "$JEDIT_SETTINGS/DockableWindowManager"
   4.104 -
   4.105 -if [ ! -e "$JEDIT_SETTINGS/perspective.xml" ]; then
   4.106 -  cat > "$JEDIT_SETTINGS/DockableWindowManager/perspective-view0.xml" <<EOF
   4.107 -<DOCKING LEFT="" TOP="" RIGHT="" BOTTOM="isabelle-session" LEFT_POS="0" TOP_POS="0" RIGHT_POS="250" BOTTOM_POS="250" />
   4.108 -EOF
   4.109 -  cat > "$JEDIT_SETTINGS/perspective.xml" <<EOF
   4.110 -<?xml version="1.0" encoding="UTF-8" ?>
   4.111 -<!DOCTYPE PERSPECTIVE SYSTEM "perspective.dtd">
   4.112 -<PERSPECTIVE>
   4.113 -<VIEW PLAIN="FALSE">
   4.114 -<GEOMETRY X="0" Y="35" WIDTH="1072" HEIGHT="787" EXT_STATE="0" />
   4.115 -</VIEW>
   4.116 -</PERSPECTIVE>
   4.117 -EOF
   4.118 -fi
   4.119 -
   4.120 -
   4.121 -## main
   4.122 -
   4.123 -case "$JEDIT_LOGIC" in
   4.124 -  /*)
   4.125 -    ;;
   4.126 -  */*)
   4.127 -    JEDIT_LOGIC="$(pwd -P)/$JEDIT_LOGIC"
   4.128 -    ;;
   4.129 -esac
   4.130 -
   4.131 -export JEDIT_LOGIC JEDIT_PRINT_MODE
   4.132 -
   4.133 -exec "$ISABELLE_TOOL" java "${JAVA_ARGS[@]}" \
   4.134 -  -jar "$(jvmpath "$JEDIT_HOME/jedit.jar")" \
   4.135 -  "-settings=$(jvmpath "$JEDIT_SETTINGS")" "${ARGS[@]}"
     5.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.2 +++ b/src/Tools/jEdit/etc/isabelle-jedit.css	Wed Jun 08 20:58:51 2011 +0200
     5.3 @@ -0,0 +1,19 @@
     5.4 +/* additional style file for Isabelle/jEdit output */
     5.5 +
     5.6 +.message { margin-top: 0.3ex; background-color: #F0F0F0; }
     5.7 +
     5.8 +.writeln { }
     5.9 +.tracing { background-color: #F0F8FF; }
    5.10 +.warning { background-color: #EEE8AA; }
    5.11 +.error { background-color: #FFC1C1; }
    5.12 +
    5.13 +.report { display: none; }
    5.14 +
    5.15 +.hilite { background-color: #FFCC66; }
    5.16 +
    5.17 +.keyword { font-weight: bold; color: #009966; }
    5.18 +.operator { font-weight: bold; }
    5.19 +.command { font-weight: bold; color: #006699; }
    5.20 +
    5.21 +.sendback { text-decoration: underline; }
    5.22 +.sendback:hover { background-color: #FFCC66; }
     6.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.2 +++ b/src/Tools/jEdit/etc/settings	Wed Jun 08 20:58:51 2011 +0200
     6.3 @@ -0,0 +1,16 @@
     6.4 +# -*- shell-script -*- :mode=shellscript:
     6.5 +
     6.6 +JEDIT_HOME="$COMPONENT"
     6.7 +JEDIT_SETTINGS="$ISABELLE_HOME_USER/jedit"
     6.8 +
     6.9 +JEDIT_OPTIONS="-reuseview -noserver -nobackground"
    6.10 +JEDIT_JAVA_OPTIONS="-Xms128m -Xmx1024m -Xss4m -Dactors.corePoolSize=4 -Dactors.enableForkJoin=false"
    6.11 +#JEDIT_JAVA_OPTIONS="-Xms128m -Xmx512m -Xss2m -Dactors.corePoolSize=4 -Dactors.enableForkJoin=false"
    6.12 +JEDIT_SYSTEM_OPTIONS="-Dapple.laf.useScreenMenuBar=true -Dcom.apple.mrj.application.apple.menu.about.name=Isabelle/jEdit"
    6.13 +
    6.14 +JEDIT_STYLE_SHEETS="$ISABELLE_HOME/lib/html/isabelle.css:$JEDIT_HOME/etc/isabelle-jedit.css:$ISABELLE_HOME_USER/etc/isabelle.css:$ISABELLE_HOME_USER/etc/isabelle-jedit.css"
    6.15 +
    6.16 +ISABELLE_JEDIT_OPTIONS="-m xsymbols -m no_brackets -m no_type_brackets"
    6.17 +
    6.18 +ISABELLE_TOOLS="$ISABELLE_TOOLS:$JEDIT_HOME/lib/Tools"
    6.19 +
     7.1 --- a/src/Tools/jEdit/jedit_build/Tools/jedit	Wed Jun 08 17:49:01 2011 +0200
     7.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     7.3 @@ -1,148 +0,0 @@
     7.4 -#!/usr/bin/env bash
     7.5 -#
     7.6 -# Author: Makarius
     7.7 -#
     7.8 -# DESCRIPTION: build and run Isabelle/jEdit on the spot
     7.9 -
    7.10 -## diagnostics
    7.11 -
    7.12 -function fail()
    7.13 -{
    7.14 -  echo "$1" >&2
    7.15 -  exit 2
    7.16 -}
    7.17 -
    7.18 -function failed()
    7.19 -{
    7.20 -  fail "Failed!"
    7.21 -}
    7.22 -
    7.23 -
    7.24 -## dependencies
    7.25 -
    7.26 -[ -z "$ISABELLE_HOME" ] && fail "Missing Isabelle settings environment"
    7.27 -[ -z "$SCALA_HOME" ] && fail "Unknown SCALA_HOME -- Scala unavailable"
    7.28 -
    7.29 -[ -z "$ISABELLE_JEDIT_BUILD_HOME" ] && \
    7.30 -  fail "Unknown ISABELLE_JEDIT_BUILD_HOME -- missing auxiliary component"
    7.31 -
    7.32 -[ -e "$ISABELLE_HOME/Admin/build" ] && \
    7.33 -  { "$ISABELLE_HOME/Admin/build" jars || exit $?; }
    7.34 -
    7.35 -
    7.36 -# sources
    7.37 -
    7.38 -SRC_DIR="$ISABELLE_HOME/src/Tools/jEdit"
    7.39 -
    7.40 -declare -a SOURCES=(
    7.41 -  "$SRC_DIR/src/dockable.scala"
    7.42 -  "$SRC_DIR/src/document_model.scala"
    7.43 -  "$SRC_DIR/src/document_view.scala"
    7.44 -  "$SRC_DIR/src/html_panel.scala"
    7.45 -  "$SRC_DIR/src/isabelle_encoding.scala"
    7.46 -  "$SRC_DIR/src/isabelle_hyperlinks.scala"
    7.47 -  "$SRC_DIR/src/isabelle_markup.scala"
    7.48 -  "$SRC_DIR/src/isabelle_options.scala"
    7.49 -  "$SRC_DIR/src/isabelle_sidekick.scala"
    7.50 -  "$SRC_DIR/src/output_dockable.scala"
    7.51 -  "$SRC_DIR/src/plugin.scala"
    7.52 -  "$SRC_DIR/src/protocol_dockable.scala"
    7.53 -  "$SRC_DIR/src/raw_output_dockable.scala"
    7.54 -  "$SRC_DIR/src/scala_console.scala"
    7.55 -  "$SRC_DIR/src/session_dockable.scala"
    7.56 -)
    7.57 -
    7.58 -declare -a PLUGIN_FILES=(
    7.59 -  "$SRC_DIR/plugin/actions.xml"
    7.60 -  "$SRC_DIR/plugin/dockables.xml"
    7.61 -  "$SRC_DIR/plugin/Isabelle.props"
    7.62 -  "$SRC_DIR/plugin/services.xml"
    7.63 -)
    7.64 -
    7.65 -JEDIT_JAR="$ISABELLE_JEDIT_BUILD_HOME/contrib/$ISABELLE_JEDIT_BUILD_VERSION/jedit.jar"
    7.66 -
    7.67 -JEDIT_JARS=(
    7.68 -  "$ISABELLE_JEDIT_BUILD_HOME/contrib/Console.jar"
    7.69 -  "$ISABELLE_JEDIT_BUILD_HOME/contrib/ErrorList.jar"
    7.70 -  "$ISABELLE_JEDIT_BUILD_HOME/contrib/Hyperlinks.jar"
    7.71 -  "$ISABELLE_JEDIT_BUILD_HOME/contrib/SideKick.jar"
    7.72 -  "$ISABELLE_JEDIT_BUILD_HOME/contrib/cobra.jar"
    7.73 -  "$ISABELLE_JEDIT_BUILD_HOME/contrib/js.jar"
    7.74 -)
    7.75 -
    7.76 -SCALA_JARS=(
    7.77 -  "$SCALA_HOME/lib/scala-compiler.jar"
    7.78 -  "$SCALA_HOME/lib/scala-library.jar"
    7.79 -  "$SCALA_HOME/lib/scala-swing.jar"
    7.80 -)
    7.81 -
    7.82 -
    7.83 -# target
    7.84 -
    7.85 -TARGET_DIR="$ISABELLE_JEDIT_BUILD_HOME/${ISABELLE_JEDIT_BUILD_VERSION}_Isabelle-$("$ISABELLE_TOOL" version -i)"
    7.86 -TARGET="$TARGET_DIR/jars/Isabelle-jEdit.jar"
    7.87 -
    7.88 -OUTDATED=false
    7.89 -for SOURCE in "${SOURCES[@]}" "${PLUGIN_FILES[@]}" "$JEDIT_JAR" "${JEDIT_JARS[@]}"
    7.90 -do
    7.91 -  [ ! -e "$SOURCE" ] && fail "Missing file: $SOURCE"
    7.92 -  [ ! -e "$TARGET" -o "$SOURCE" -nt "$TARGET" ] && OUTDATED=true
    7.93 -done
    7.94 -
    7.95 -
    7.96 -## main
    7.97 -
    7.98 -if [ "$OUTDATED" = true ]
    7.99 -then
   7.100 -  echo "###"
   7.101 -  echo "### Building Isabelle/jEdit ..."
   7.102 -  echo "###"
   7.103 -
   7.104 -  rm -rf "$TARGET_DIR" || failed
   7.105 -  mkdir -p "$TARGET_DIR" "$TARGET_DIR/classes" || failed
   7.106 -  cp -a "$ISABELLE_JEDIT_BUILD_HOME/contrib/$ISABELLE_JEDIT_BUILD_VERSION/." "$TARGET_DIR/."
   7.107 -
   7.108 -  cp -a "${PLUGIN_FILES[@]}" "$TARGET_DIR/classes/."
   7.109 -  cp -a "$SRC_DIR/dist-template/." "$TARGET_DIR/."
   7.110 -  cp -a "$SRC_DIR/README" "$TARGET_DIR/."
   7.111 -
   7.112 -  perl -i -e 'while (<>) { if (m/NAME="javacc"/) {
   7.113 -    print qq,<MODE NAME="isabelle" FILE="isabelle.xml" FILE_NAME_GLOB="*.thy"/>\n\n,;
   7.114 -    print qq,<MODE NAME="isabelle-session" FILE="isabelle-session.xml" FILE_NAME_GLOB="session.root"/>\n\n,; }
   7.115 -    print; }' "$TARGET_DIR/modes/catalog"
   7.116 -
   7.117 -  (
   7.118 -    for JAR in "$JEDIT_JAR" "${JEDIT_JARS[@]}" "$SCALA_HOME/lib/scala-compiler.jar"
   7.119 -    do
   7.120 -      CLASSPATH="$CLASSPATH:$JAR"
   7.121 -    done
   7.122 -
   7.123 -    cp -a "${JEDIT_JARS[@]}" "${SCALA_JARS[@]}" "$ISABELLE_HOME/lib/classes/Pure.jar" \
   7.124 -      "$TARGET_DIR/jars/." || failed
   7.125 -
   7.126 -    declare -a JVM_SOURCES=()
   7.127 -    for SOURCE in "${SOURCES[@]}"
   7.128 -    do
   7.129 -      JVM_SOURCES["${#JVM_SOURCES[@]}"]="$(jvmpath "$SOURCE")"
   7.130 -    done
   7.131 -
   7.132 -    CLASSPATH="$(jvmpath "$CLASSPATH")"
   7.133 -
   7.134 -    "$SCALA_HOME/bin/scalac" -unchecked -deprecation \
   7.135 -      -d "$(jvmpath "$TARGET_DIR/classes")" -target:jvm-1.5 "${JVM_SOURCES[@]}" || \
   7.136 -      fail "Failed to compile sources"
   7.137 -
   7.138 -    cd "$TARGET_DIR/classes"
   7.139 -    jar cf "../jars/Isabelle-jEdit.jar" * || failed
   7.140 -    cd ..
   7.141 -    rm -rf classes
   7.142 -  )
   7.143 -fi
   7.144 -
   7.145 -set -o allexport
   7.146 -init_component "$TARGET_DIR"
   7.147 -[ -f "$ISABELLE_JEDIT_BUILD_HOME/etc/user-settings" ] && \
   7.148 -  source "$ISABELLE_JEDIT_BUILD_HOME/etc/user-settings"
   7.149 -set +o allexport
   7.150 -
   7.151 -exec "$TARGET_DIR/lib/Tools/jedit" "$@"
     8.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     8.2 +++ b/src/Tools/jEdit/lib/Tools/jedit	Wed Jun 08 20:58:51 2011 +0200
     8.3 @@ -0,0 +1,255 @@
     8.4 +#!/usr/bin/env bash
     8.5 +#
     8.6 +# Author: Makarius
     8.7 +#
     8.8 +# DESCRIPTION: Isabelle/jEdit interface wrapper
     8.9 +
    8.10 +
    8.11 +## diagnostics
    8.12 +
    8.13 +PRG="$(basename "$0")"
    8.14 +
    8.15 +function usage()
    8.16 +{
    8.17 +  echo
    8.18 +  echo "Usage: isabelle $PRG [OPTIONS] [FILES ...]"
    8.19 +  echo
    8.20 +  echo "  Options are:"
    8.21 +  echo "    -J OPTION    add JVM runtime option"
    8.22 +  echo "                 (default JEDIT_JAVA_OPTIONS=$JEDIT_JAVA_OPTIONS)"
    8.23 +  echo "    -d           enable debugger"
    8.24 +  echo "    -j OPTION    add jEdit runtime option"
    8.25 +  echo "                 (default JEDIT_OPTIONS=$JEDIT_OPTIONS)"
    8.26 +  echo "    -l NAME      logic image name (default ISABELLE_LOGIC=$ISABELLE_LOGIC)"
    8.27 +  echo "    -m MODE      add print mode for output"
    8.28 +  echo
    8.29 +  echo "Start jEdit with Isabelle plugin setup and opens theory FILES"
    8.30 +  echo
    8.31 +  exit 1
    8.32 +}
    8.33 +
    8.34 +function fail()
    8.35 +{
    8.36 +  echo "$1" >&2
    8.37 +  exit 2
    8.38 +}
    8.39 +
    8.40 +function failed()
    8.41 +{
    8.42 +  fail "Failed!"
    8.43 +}
    8.44 +
    8.45 +
    8.46 +## process command line
    8.47 +
    8.48 +# options
    8.49 +
    8.50 +JEDIT_LOGIC="$ISABELLE_LOGIC"
    8.51 +JEDIT_PRINT_MODE=""
    8.52 +
    8.53 +function getoptions()
    8.54 +{
    8.55 +  OPTIND=1
    8.56 +  while getopts "J:dj:l:m:" OPT
    8.57 +  do
    8.58 +    case "$OPT" in
    8.59 +      J)
    8.60 +        JAVA_ARGS["${#JAVA_ARGS[@]}"]="$OPTARG"
    8.61 +        ;;
    8.62 +      d)
    8.63 +        JAVA_ARGS["${#JAVA_ARGS[@]}"]="-Xdebug"
    8.64 +        JAVA_ARGS["${#JAVA_ARGS[@]}"]="-Xrunjdwp:transport=dt_socket,server=y,suspend=n"
    8.65 +        ;;
    8.66 +      j)
    8.67 +        ARGS["${#ARGS[@]}"]="$OPTARG"
    8.68 +        ;;
    8.69 +      l)
    8.70 +        JEDIT_LOGIC="$OPTARG"
    8.71 +        ;;
    8.72 +      m)
    8.73 +        if [ -z "$JEDIT_PRINT_MODE" ]; then
    8.74 +          JEDIT_PRINT_MODE="$OPTARG"
    8.75 +        else
    8.76 +          JEDIT_PRINT_MODE="$JEDIT_PRINT_MODE,$OPTARG"
    8.77 +        fi
    8.78 +        ;;
    8.79 +      \?)
    8.80 +        usage
    8.81 +        ;;
    8.82 +    esac
    8.83 +  done
    8.84 +}
    8.85 +
    8.86 +declare -a JAVA_ARGS; eval "JAVA_ARGS=($JEDIT_JAVA_OPTIONS $JEDIT_SYSTEM_OPTIONS)"
    8.87 +[ -n "$SCALA_HOME" ] && JAVA_ARGS["${#JAVA_ARGS[@]}"]="-Dscala.home=$SCALA_HOME"
    8.88 +
    8.89 +declare -a ARGS; eval "ARGS=($JEDIT_OPTIONS)"
    8.90 +
    8.91 +declare -a OPTIONS; eval "OPTIONS=($ISABELLE_JEDIT_OPTIONS)"
    8.92 +getoptions "${OPTIONS[@]}"
    8.93 +
    8.94 +getoptions "$@"
    8.95 +shift $(($OPTIND - 1))
    8.96 +
    8.97 +
    8.98 +# args
    8.99 +
   8.100 +while [ "$#" -gt 0 ]
   8.101 +do
   8.102 +  ARGS["${#ARGS[@]}"]="$(jvmpath "$1")"
   8.103 +  shift
   8.104 +done
   8.105 +
   8.106 +
   8.107 +## dependencies
   8.108 +
   8.109 +pushd "$JEDIT_HOME" || failed
   8.110 +
   8.111 +
   8.112 +# sources
   8.113 +
   8.114 +declare -a SOURCES=(
   8.115 +  "src/dockable.scala"
   8.116 +  "src/document_model.scala"
   8.117 +  "src/document_view.scala"
   8.118 +  "src/html_panel.scala"
   8.119 +  "src/isabelle_encoding.scala"
   8.120 +  "src/isabelle_hyperlinks.scala"
   8.121 +  "src/isabelle_markup.scala"
   8.122 +  "src/isabelle_options.scala"
   8.123 +  "src/isabelle_sidekick.scala"
   8.124 +  "src/output_dockable.scala"
   8.125 +  "src/plugin.scala"
   8.126 +  "src/protocol_dockable.scala"
   8.127 +  "src/raw_output_dockable.scala"
   8.128 +  "src/scala_console.scala"
   8.129 +  "src/session_dockable.scala"
   8.130 +)
   8.131 +
   8.132 +declare -a PLUGIN_FILES=(
   8.133 +  "plugin/actions.xml"
   8.134 +  "plugin/dockables.xml"
   8.135 +  "plugin/Isabelle.props"
   8.136 +  "plugin/services.xml"
   8.137 +)
   8.138 +
   8.139 +JEDIT_JAR="$ISABELLE_JEDIT_BUILD_HOME/contrib/$ISABELLE_JEDIT_BUILD_VERSION/jedit.jar"
   8.140 +
   8.141 +JEDIT_JARS=(
   8.142 +  "$ISABELLE_JEDIT_BUILD_HOME/contrib/Console.jar"
   8.143 +  "$ISABELLE_JEDIT_BUILD_HOME/contrib/ErrorList.jar"
   8.144 +  "$ISABELLE_JEDIT_BUILD_HOME/contrib/Hyperlinks.jar"
   8.145 +  "$ISABELLE_JEDIT_BUILD_HOME/contrib/SideKick.jar"
   8.146 +  "$ISABELLE_JEDIT_BUILD_HOME/contrib/cobra.jar"
   8.147 +  "$ISABELLE_JEDIT_BUILD_HOME/contrib/js.jar"
   8.148 +)
   8.149 +
   8.150 +SCALA_JARS=(
   8.151 +  "$SCALA_HOME/lib/scala-compiler.jar"
   8.152 +  "$SCALA_HOME/lib/scala-library.jar"
   8.153 +  "$SCALA_HOME/lib/scala-swing.jar"
   8.154 +)
   8.155 +
   8.156 +
   8.157 +# target
   8.158 +
   8.159 +TARGET="dist/jars/Isabelle-jEdit.jar"
   8.160 +
   8.161 +OUTDATED=false
   8.162 +for SOURCE in "${SOURCES[@]}" "${PLUGIN_FILES[@]}" "$JEDIT_JAR" "${JEDIT_JARS[@]}"
   8.163 +do
   8.164 +  [ ! -e "$SOURCE" ] && fail "Missing file: $SOURCE"
   8.165 +  [ ! -e "$TARGET" -o "$SOURCE" -nt "$TARGET" ] && OUTDATED=true
   8.166 +done
   8.167 +
   8.168 +
   8.169 +# build
   8.170 +
   8.171 +if [ "$OUTDATED" = true ]
   8.172 +then
   8.173 +  echo "###"
   8.174 +  echo "### Building Isabelle/jEdit ..."
   8.175 +  echo "###"
   8.176 +
   8.177 +  [ -z "$SCALA_HOME" ] && fail "Unknown SCALA_HOME -- Scala unavailable"
   8.178 +
   8.179 +  [ -z "$ISABELLE_JEDIT_BUILD_HOME" ] && \
   8.180 +    fail "Unknown ISABELLE_JEDIT_BUILD_HOME -- missing auxiliary component"
   8.181 +
   8.182 +  [ -e "$ISABELLE_HOME/Admin/build" ] && \
   8.183 +    { "$ISABELLE_HOME/Admin/build" jars || exit $?; }
   8.184 +
   8.185 +
   8.186 +  rm -rf dist || failed
   8.187 +  mkdir -p dist dist/classes || failed
   8.188 +  cp -a "$ISABELLE_JEDIT_BUILD_HOME/contrib/$ISABELLE_JEDIT_BUILD_VERSION/." dist/.
   8.189 +
   8.190 +  cp -a "${PLUGIN_FILES[@]}" dist/classes/.
   8.191 +  cp -a dist-template/. dist/.
   8.192 +  cp -a README dist/.
   8.193 +
   8.194 +  perl -i -e 'while (<>) { if (m/NAME="javacc"/) {
   8.195 +    print qq,<MODE NAME="isabelle" FILE="isabelle.xml" FILE_NAME_GLOB="*.thy"/>\n\n,;
   8.196 +    print qq,<MODE NAME="isabelle-session" FILE="isabelle-session.xml" FILE_NAME_GLOB="session.root"/>\n\n,; }
   8.197 +    print; }' dist/modes/catalog
   8.198 +
   8.199 +  cp -a "${JEDIT_JARS[@]}" "${SCALA_JARS[@]}" "$ISABELLE_HOME/lib/classes/Pure.jar" \
   8.200 +    dist/jars/. || failed
   8.201 +
   8.202 +  (
   8.203 +    for JAR in "$JEDIT_JAR" "${JEDIT_JARS[@]}" "$SCALA_HOME/lib/scala-compiler.jar"
   8.204 +    do
   8.205 +      CLASSPATH="$CLASSPATH:$JAR"
   8.206 +    done
   8.207 +    CLASSPATH="$(jvmpath "$CLASSPATH")"
   8.208 +
   8.209 +    exec "$SCALA_HOME/bin/scalac" -unchecked -deprecation \
   8.210 +      -d dist/classes -target:jvm-1.5 "${SOURCES[@]}"
   8.211 +  ) || fail "Failed to compile sources"
   8.212 +
   8.213 +  cd dist/classes
   8.214 +  jar cf "../jars/Isabelle-jEdit.jar" * || failed
   8.215 +  cd ../..
   8.216 +  rm -rf dist/classes
   8.217 +fi
   8.218 +
   8.219 +popd >/dev/null
   8.220 +
   8.221 +
   8.222 +## main
   8.223 +
   8.224 +# perspective
   8.225 +
   8.226 +mkdir -p "$JEDIT_SETTINGS/DockableWindowManager"
   8.227 +
   8.228 +if [ ! -e "$JEDIT_SETTINGS/perspective.xml" ]; then
   8.229 +  cat > "$JEDIT_SETTINGS/DockableWindowManager/perspective-view0.xml" <<EOF
   8.230 +<DOCKING LEFT="" TOP="" RIGHT="" BOTTOM="isabelle-session" LEFT_POS="0" TOP_POS="0" RIGHT_POS="250" BOTTOM_POS="250" />
   8.231 +EOF
   8.232 +  cat > "$JEDIT_SETTINGS/perspective.xml" <<EOF
   8.233 +<?xml version="1.0" encoding="UTF-8" ?>
   8.234 +<!DOCTYPE PERSPECTIVE SYSTEM "perspective.dtd">
   8.235 +<PERSPECTIVE>
   8.236 +<VIEW PLAIN="FALSE">
   8.237 +<GEOMETRY X="0" Y="35" WIDTH="1072" HEIGHT="787" EXT_STATE="0" />
   8.238 +</VIEW>
   8.239 +</PERSPECTIVE>
   8.240 +EOF
   8.241 +fi
   8.242 +
   8.243 +
   8.244 +# run
   8.245 +
   8.246 +case "$JEDIT_LOGIC" in
   8.247 +  /*)
   8.248 +    ;;
   8.249 +  */*)
   8.250 +    JEDIT_LOGIC="$(pwd -P)/$JEDIT_LOGIC"
   8.251 +    ;;
   8.252 +esac
   8.253 +
   8.254 +export JEDIT_LOGIC JEDIT_PRINT_MODE
   8.255 +
   8.256 +exec "$ISABELLE_TOOL" java "${JAVA_ARGS[@]}" \
   8.257 +  -jar "$(jvmpath "$JEDIT_HOME/dist/jedit.jar")" \
   8.258 +  "-settings=$(jvmpath "$JEDIT_SETTINGS")" "${ARGS[@]}"