src/Tools/jEdit/lib/Tools/jedit
author wenzelm
Wed, 08 Jun 2011 21:29:49 +0200
changeset 43285 966f359dc724
parent 43284 04d473e883df
child 43286 a319da4fbfb0
permissions -rwxr-xr-x
further jedit build option; misc tuning;
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
34333
b353b4cd9bd4 Isabelle/jEdit interface wrapper.
wenzelm
parents:
diff changeset
     1
#!/usr/bin/env bash
b353b4cd9bd4 Isabelle/jEdit interface wrapper.
wenzelm
parents:
diff changeset
     2
#
34664
8f5fbe4a80ff Isabelle component;
wenzelm
parents: 34663
diff changeset
     3
# Author: Makarius
8f5fbe4a80ff Isabelle component;
wenzelm
parents: 34663
diff changeset
     4
#
8f5fbe4a80ff Isabelle component;
wenzelm
parents: 34663
diff changeset
     5
# DESCRIPTION: Isabelle/jEdit interface wrapper
8f5fbe4a80ff Isabelle component;
wenzelm
parents: 34663
diff changeset
     6
34333
b353b4cd9bd4 Isabelle/jEdit interface wrapper.
wenzelm
parents:
diff changeset
     7
43285
966f359dc724 further jedit build option;
wenzelm
parents: 43284
diff changeset
     8
## sources
966f359dc724 further jedit build option;
wenzelm
parents: 43284
diff changeset
     9
966f359dc724 further jedit build option;
wenzelm
parents: 43284
diff changeset
    10
declare -a SOURCES=(
966f359dc724 further jedit build option;
wenzelm
parents: 43284
diff changeset
    11
  "src/dockable.scala"
966f359dc724 further jedit build option;
wenzelm
parents: 43284
diff changeset
    12
  "src/document_model.scala"
966f359dc724 further jedit build option;
wenzelm
parents: 43284
diff changeset
    13
  "src/document_view.scala"
966f359dc724 further jedit build option;
wenzelm
parents: 43284
diff changeset
    14
  "src/html_panel.scala"
966f359dc724 further jedit build option;
wenzelm
parents: 43284
diff changeset
    15
  "src/isabelle_encoding.scala"
966f359dc724 further jedit build option;
wenzelm
parents: 43284
diff changeset
    16
  "src/isabelle_hyperlinks.scala"
966f359dc724 further jedit build option;
wenzelm
parents: 43284
diff changeset
    17
  "src/isabelle_markup.scala"
966f359dc724 further jedit build option;
wenzelm
parents: 43284
diff changeset
    18
  "src/isabelle_options.scala"
966f359dc724 further jedit build option;
wenzelm
parents: 43284
diff changeset
    19
  "src/isabelle_sidekick.scala"
966f359dc724 further jedit build option;
wenzelm
parents: 43284
diff changeset
    20
  "src/output_dockable.scala"
966f359dc724 further jedit build option;
wenzelm
parents: 43284
diff changeset
    21
  "src/plugin.scala"
966f359dc724 further jedit build option;
wenzelm
parents: 43284
diff changeset
    22
  "src/protocol_dockable.scala"
966f359dc724 further jedit build option;
wenzelm
parents: 43284
diff changeset
    23
  "src/raw_output_dockable.scala"
966f359dc724 further jedit build option;
wenzelm
parents: 43284
diff changeset
    24
  "src/scala_console.scala"
966f359dc724 further jedit build option;
wenzelm
parents: 43284
diff changeset
    25
  "src/session_dockable.scala"
966f359dc724 further jedit build option;
wenzelm
parents: 43284
diff changeset
    26
)
966f359dc724 further jedit build option;
wenzelm
parents: 43284
diff changeset
    27
966f359dc724 further jedit build option;
wenzelm
parents: 43284
diff changeset
    28
declare -a PLUGIN_FILES=(
966f359dc724 further jedit build option;
wenzelm
parents: 43284
diff changeset
    29
  "plugin/actions.xml"
966f359dc724 further jedit build option;
wenzelm
parents: 43284
diff changeset
    30
  "plugin/dockables.xml"
966f359dc724 further jedit build option;
wenzelm
parents: 43284
diff changeset
    31
  "plugin/Isabelle.props"
966f359dc724 further jedit build option;
wenzelm
parents: 43284
diff changeset
    32
  "plugin/services.xml"
966f359dc724 further jedit build option;
wenzelm
parents: 43284
diff changeset
    33
)
966f359dc724 further jedit build option;
wenzelm
parents: 43284
diff changeset
    34
966f359dc724 further jedit build option;
wenzelm
parents: 43284
diff changeset
    35
34333
b353b4cd9bd4 Isabelle/jEdit interface wrapper.
wenzelm
parents:
diff changeset
    36
## diagnostics
b353b4cd9bd4 Isabelle/jEdit interface wrapper.
wenzelm
parents:
diff changeset
    37
34664
8f5fbe4a80ff Isabelle component;
wenzelm
parents: 34663
diff changeset
    38
PRG="$(basename "$0")"
8f5fbe4a80ff Isabelle component;
wenzelm
parents: 34663
diff changeset
    39
43284
04d473e883df build jedit as part of regular startup script (in that case depending on jedit_build component);
wenzelm
parents: 41380
diff changeset
    40
function usage()
34333
b353b4cd9bd4 Isabelle/jEdit interface wrapper.
wenzelm
parents:
diff changeset
    41
{
b353b4cd9bd4 Isabelle/jEdit interface wrapper.
wenzelm
parents:
diff changeset
    42
  echo
34664
8f5fbe4a80ff Isabelle component;
wenzelm
parents: 34663
diff changeset
    43
  echo "Usage: isabelle $PRG [OPTIONS] [FILES ...]"
34333
b353b4cd9bd4 Isabelle/jEdit interface wrapper.
wenzelm
parents:
diff changeset
    44
  echo
b353b4cd9bd4 Isabelle/jEdit interface wrapper.
wenzelm
parents:
diff changeset
    45
  echo "  Options are:"
b353b4cd9bd4 Isabelle/jEdit interface wrapper.
wenzelm
parents:
diff changeset
    46
  echo "    -J OPTION    add JVM runtime option"
34409
e61e2ab1f6f7 proper spelling of JEDIT_JAVA_OPTIONS;
wenzelm
parents: 34339
diff changeset
    47
  echo "                 (default JEDIT_JAVA_OPTIONS=$JEDIT_JAVA_OPTIONS)"
43285
966f359dc724 further jedit build option;
wenzelm
parents: 43284
diff changeset
    48
  echo "    -b           build only"
34691
f28c014bcbe3 option -d: enable debugger;
wenzelm
parents: 34664
diff changeset
    49
  echo "    -d           enable debugger"
43285
966f359dc724 further jedit build option;
wenzelm
parents: 43284
diff changeset
    50
  echo "    -f           fresh build"
34333
b353b4cd9bd4 Isabelle/jEdit interface wrapper.
wenzelm
parents:
diff changeset
    51
  echo "    -j OPTION    add jEdit runtime option"
b353b4cd9bd4 Isabelle/jEdit interface wrapper.
wenzelm
parents:
diff changeset
    52
  echo "                 (default JEDIT_OPTIONS=$JEDIT_OPTIONS)"
b353b4cd9bd4 Isabelle/jEdit interface wrapper.
wenzelm
parents:
diff changeset
    53
  echo "    -l NAME      logic image name (default ISABELLE_LOGIC=$ISABELLE_LOGIC)"
b353b4cd9bd4 Isabelle/jEdit interface wrapper.
wenzelm
parents:
diff changeset
    54
  echo "    -m MODE      add print mode for output"
b353b4cd9bd4 Isabelle/jEdit interface wrapper.
wenzelm
parents:
diff changeset
    55
  echo
34664
8f5fbe4a80ff Isabelle component;
wenzelm
parents: 34663
diff changeset
    56
  echo "Start jEdit with Isabelle plugin setup and opens theory FILES"
34333
b353b4cd9bd4 Isabelle/jEdit interface wrapper.
wenzelm
parents:
diff changeset
    57
  echo
b353b4cd9bd4 Isabelle/jEdit interface wrapper.
wenzelm
parents:
diff changeset
    58
  exit 1
b353b4cd9bd4 Isabelle/jEdit interface wrapper.
wenzelm
parents:
diff changeset
    59
}
b353b4cd9bd4 Isabelle/jEdit interface wrapper.
wenzelm
parents:
diff changeset
    60
43284
04d473e883df build jedit as part of regular startup script (in that case depending on jedit_build component);
wenzelm
parents: 41380
diff changeset
    61
function fail()
34333
b353b4cd9bd4 Isabelle/jEdit interface wrapper.
wenzelm
parents:
diff changeset
    62
{
b353b4cd9bd4 Isabelle/jEdit interface wrapper.
wenzelm
parents:
diff changeset
    63
  echo "$1" >&2
b353b4cd9bd4 Isabelle/jEdit interface wrapper.
wenzelm
parents:
diff changeset
    64
  exit 2
b353b4cd9bd4 Isabelle/jEdit interface wrapper.
wenzelm
parents:
diff changeset
    65
}
b353b4cd9bd4 Isabelle/jEdit interface wrapper.
wenzelm
parents:
diff changeset
    66
43284
04d473e883df build jedit as part of regular startup script (in that case depending on jedit_build component);
wenzelm
parents: 41380
diff changeset
    67
function failed()
04d473e883df build jedit as part of regular startup script (in that case depending on jedit_build component);
wenzelm
parents: 41380
diff changeset
    68
{
04d473e883df build jedit as part of regular startup script (in that case depending on jedit_build component);
wenzelm
parents: 41380
diff changeset
    69
  fail "Failed!"
04d473e883df build jedit as part of regular startup script (in that case depending on jedit_build component);
wenzelm
parents: 41380
diff changeset
    70
}
04d473e883df build jedit as part of regular startup script (in that case depending on jedit_build component);
wenzelm
parents: 41380
diff changeset
    71
34333
b353b4cd9bd4 Isabelle/jEdit interface wrapper.
wenzelm
parents:
diff changeset
    72
b353b4cd9bd4 Isabelle/jEdit interface wrapper.
wenzelm
parents:
diff changeset
    73
## process command line
b353b4cd9bd4 Isabelle/jEdit interface wrapper.
wenzelm
parents:
diff changeset
    74
b353b4cd9bd4 Isabelle/jEdit interface wrapper.
wenzelm
parents:
diff changeset
    75
# options
b353b4cd9bd4 Isabelle/jEdit interface wrapper.
wenzelm
parents:
diff changeset
    76
43285
966f359dc724 further jedit build option;
wenzelm
parents: 43284
diff changeset
    77
BUILD_ONLY=false
966f359dc724 further jedit build option;
wenzelm
parents: 43284
diff changeset
    78
BUILD_JARS="jars"
34333
b353b4cd9bd4 Isabelle/jEdit interface wrapper.
wenzelm
parents:
diff changeset
    79
JEDIT_LOGIC="$ISABELLE_LOGIC"
b353b4cd9bd4 Isabelle/jEdit interface wrapper.
wenzelm
parents:
diff changeset
    80
JEDIT_PRINT_MODE=""
b353b4cd9bd4 Isabelle/jEdit interface wrapper.
wenzelm
parents:
diff changeset
    81
43284
04d473e883df build jedit as part of regular startup script (in that case depending on jedit_build component);
wenzelm
parents: 41380
diff changeset
    82
function getoptions()
34780
d0ff1c3a91ea more serious command line handling;
wenzelm
parents: 34691
diff changeset
    83
{
d0ff1c3a91ea more serious command line handling;
wenzelm
parents: 34691
diff changeset
    84
  OPTIND=1
43285
966f359dc724 further jedit build option;
wenzelm
parents: 43284
diff changeset
    85
  while getopts "J:bdfj:l:m:" OPT
34780
d0ff1c3a91ea more serious command line handling;
wenzelm
parents: 34691
diff changeset
    86
  do
d0ff1c3a91ea more serious command line handling;
wenzelm
parents: 34691
diff changeset
    87
    case "$OPT" in
d0ff1c3a91ea more serious command line handling;
wenzelm
parents: 34691
diff changeset
    88
      J)
d0ff1c3a91ea more serious command line handling;
wenzelm
parents: 34691
diff changeset
    89
        JAVA_ARGS["${#JAVA_ARGS[@]}"]="$OPTARG"
d0ff1c3a91ea more serious command line handling;
wenzelm
parents: 34691
diff changeset
    90
        ;;
43285
966f359dc724 further jedit build option;
wenzelm
parents: 43284
diff changeset
    91
      b)
966f359dc724 further jedit build option;
wenzelm
parents: 43284
diff changeset
    92
        BUILD_ONLY=true
966f359dc724 further jedit build option;
wenzelm
parents: 43284
diff changeset
    93
        ;;
34780
d0ff1c3a91ea more serious command line handling;
wenzelm
parents: 34691
diff changeset
    94
      d)
d0ff1c3a91ea more serious command line handling;
wenzelm
parents: 34691
diff changeset
    95
        JAVA_ARGS["${#JAVA_ARGS[@]}"]="-Xdebug"
d0ff1c3a91ea more serious command line handling;
wenzelm
parents: 34691
diff changeset
    96
        JAVA_ARGS["${#JAVA_ARGS[@]}"]="-Xrunjdwp:transport=dt_socket,server=y,suspend=n"
d0ff1c3a91ea more serious command line handling;
wenzelm
parents: 34691
diff changeset
    97
        ;;
43285
966f359dc724 further jedit build option;
wenzelm
parents: 43284
diff changeset
    98
      f)
966f359dc724 further jedit build option;
wenzelm
parents: 43284
diff changeset
    99
        BUILD_JARS="jars_fresh"
966f359dc724 further jedit build option;
wenzelm
parents: 43284
diff changeset
   100
        ;;
34780
d0ff1c3a91ea more serious command line handling;
wenzelm
parents: 34691
diff changeset
   101
      j)
d0ff1c3a91ea more serious command line handling;
wenzelm
parents: 34691
diff changeset
   102
        ARGS["${#ARGS[@]}"]="$OPTARG"
d0ff1c3a91ea more serious command line handling;
wenzelm
parents: 34691
diff changeset
   103
        ;;
d0ff1c3a91ea more serious command line handling;
wenzelm
parents: 34691
diff changeset
   104
      l)
d0ff1c3a91ea more serious command line handling;
wenzelm
parents: 34691
diff changeset
   105
        JEDIT_LOGIC="$OPTARG"
d0ff1c3a91ea more serious command line handling;
wenzelm
parents: 34691
diff changeset
   106
        ;;
d0ff1c3a91ea more serious command line handling;
wenzelm
parents: 34691
diff changeset
   107
      m)
d0ff1c3a91ea more serious command line handling;
wenzelm
parents: 34691
diff changeset
   108
        if [ -z "$JEDIT_PRINT_MODE" ]; then
d0ff1c3a91ea more serious command line handling;
wenzelm
parents: 34691
diff changeset
   109
          JEDIT_PRINT_MODE="$OPTARG"
d0ff1c3a91ea more serious command line handling;
wenzelm
parents: 34691
diff changeset
   110
        else
d0ff1c3a91ea more serious command line handling;
wenzelm
parents: 34691
diff changeset
   111
          JEDIT_PRINT_MODE="$JEDIT_PRINT_MODE,$OPTARG"
d0ff1c3a91ea more serious command line handling;
wenzelm
parents: 34691
diff changeset
   112
        fi
d0ff1c3a91ea more serious command line handling;
wenzelm
parents: 34691
diff changeset
   113
        ;;
d0ff1c3a91ea more serious command line handling;
wenzelm
parents: 34691
diff changeset
   114
      \?)
d0ff1c3a91ea more serious command line handling;
wenzelm
parents: 34691
diff changeset
   115
        usage
d0ff1c3a91ea more serious command line handling;
wenzelm
parents: 34691
diff changeset
   116
        ;;
d0ff1c3a91ea more serious command line handling;
wenzelm
parents: 34691
diff changeset
   117
    esac
d0ff1c3a91ea more serious command line handling;
wenzelm
parents: 34691
diff changeset
   118
  done
d0ff1c3a91ea more serious command line handling;
wenzelm
parents: 34691
diff changeset
   119
}
34581
abab3a577e10 slightly more robust treatment of options via arrays;
wenzelm
parents: 34412
diff changeset
   120
38257
f0fd14a9c11f clarified JEDIT_JAVA_OPTIONS vs. JEDIT_SYSTEM_OPTIONS -- discontinued JEDIT_APPLE_PROPERTIES;
wenzelm
parents: 34881
diff changeset
   121
declare -a JAVA_ARGS; eval "JAVA_ARGS=($JEDIT_JAVA_OPTIONS $JEDIT_SYSTEM_OPTIONS)"
34843
eb8806a2e348 define scala.home, for more robust startup of Scala tools, notably the compiler;
wenzelm
parents: 34790
diff changeset
   122
[ -n "$SCALA_HOME" ] && JAVA_ARGS["${#JAVA_ARGS[@]}"]="-Dscala.home=$SCALA_HOME"
eb8806a2e348 define scala.home, for more robust startup of Scala tools, notably the compiler;
wenzelm
parents: 34790
diff changeset
   123
34780
d0ff1c3a91ea more serious command line handling;
wenzelm
parents: 34691
diff changeset
   124
declare -a ARGS; eval "ARGS=($JEDIT_OPTIONS)"
34333
b353b4cd9bd4 Isabelle/jEdit interface wrapper.
wenzelm
parents:
diff changeset
   125
34780
d0ff1c3a91ea more serious command line handling;
wenzelm
parents: 34691
diff changeset
   126
declare -a OPTIONS; eval "OPTIONS=($ISABELLE_JEDIT_OPTIONS)"
d0ff1c3a91ea more serious command line handling;
wenzelm
parents: 34691
diff changeset
   127
getoptions "${OPTIONS[@]}"
d0ff1c3a91ea more serious command line handling;
wenzelm
parents: 34691
diff changeset
   128
d0ff1c3a91ea more serious command line handling;
wenzelm
parents: 34691
diff changeset
   129
getoptions "$@"
34333
b353b4cd9bd4 Isabelle/jEdit interface wrapper.
wenzelm
parents:
diff changeset
   130
shift $(($OPTIND - 1))
b353b4cd9bd4 Isabelle/jEdit interface wrapper.
wenzelm
parents:
diff changeset
   131
b353b4cd9bd4 Isabelle/jEdit interface wrapper.
wenzelm
parents:
diff changeset
   132
b353b4cd9bd4 Isabelle/jEdit interface wrapper.
wenzelm
parents:
diff changeset
   133
# args
b353b4cd9bd4 Isabelle/jEdit interface wrapper.
wenzelm
parents:
diff changeset
   134
43284
04d473e883df build jedit as part of regular startup script (in that case depending on jedit_build component);
wenzelm
parents: 41380
diff changeset
   135
while [ "$#" -gt 0 ]
04d473e883df build jedit as part of regular startup script (in that case depending on jedit_build component);
wenzelm
parents: 41380
diff changeset
   136
do
40574
226563829580 refrain from opening Scratch.thy by default, to avoid bombing the editor with old/long theory text;
wenzelm
parents: 40565
diff changeset
   137
  ARGS["${#ARGS[@]}"]="$(jvmpath "$1")"
226563829580 refrain from opening Scratch.thy by default, to avoid bombing the editor with old/long theory text;
wenzelm
parents: 40565
diff changeset
   138
  shift
226563829580 refrain from opening Scratch.thy by default, to avoid bombing the editor with old/long theory text;
wenzelm
parents: 40565
diff changeset
   139
done
34333
b353b4cd9bd4 Isabelle/jEdit interface wrapper.
wenzelm
parents:
diff changeset
   140
b353b4cd9bd4 Isabelle/jEdit interface wrapper.
wenzelm
parents:
diff changeset
   141
43284
04d473e883df build jedit as part of regular startup script (in that case depending on jedit_build component);
wenzelm
parents: 41380
diff changeset
   142
## dependencies
04d473e883df build jedit as part of regular startup script (in that case depending on jedit_build component);
wenzelm
parents: 41380
diff changeset
   143
43285
966f359dc724 further jedit build option;
wenzelm
parents: 43284
diff changeset
   144
pushd "$JEDIT_HOME" >/dev/null || failed
43284
04d473e883df build jedit as part of regular startup script (in that case depending on jedit_build component);
wenzelm
parents: 41380
diff changeset
   145
04d473e883df build jedit as part of regular startup script (in that case depending on jedit_build component);
wenzelm
parents: 41380
diff changeset
   146
JEDIT_JAR="$ISABELLE_JEDIT_BUILD_HOME/contrib/$ISABELLE_JEDIT_BUILD_VERSION/jedit.jar"
04d473e883df build jedit as part of regular startup script (in that case depending on jedit_build component);
wenzelm
parents: 41380
diff changeset
   147
04d473e883df build jedit as part of regular startup script (in that case depending on jedit_build component);
wenzelm
parents: 41380
diff changeset
   148
JEDIT_JARS=(
04d473e883df build jedit as part of regular startup script (in that case depending on jedit_build component);
wenzelm
parents: 41380
diff changeset
   149
  "$ISABELLE_JEDIT_BUILD_HOME/contrib/Console.jar"
04d473e883df build jedit as part of regular startup script (in that case depending on jedit_build component);
wenzelm
parents: 41380
diff changeset
   150
  "$ISABELLE_JEDIT_BUILD_HOME/contrib/ErrorList.jar"
04d473e883df build jedit as part of regular startup script (in that case depending on jedit_build component);
wenzelm
parents: 41380
diff changeset
   151
  "$ISABELLE_JEDIT_BUILD_HOME/contrib/Hyperlinks.jar"
04d473e883df build jedit as part of regular startup script (in that case depending on jedit_build component);
wenzelm
parents: 41380
diff changeset
   152
  "$ISABELLE_JEDIT_BUILD_HOME/contrib/SideKick.jar"
04d473e883df build jedit as part of regular startup script (in that case depending on jedit_build component);
wenzelm
parents: 41380
diff changeset
   153
  "$ISABELLE_JEDIT_BUILD_HOME/contrib/cobra.jar"
04d473e883df build jedit as part of regular startup script (in that case depending on jedit_build component);
wenzelm
parents: 41380
diff changeset
   154
  "$ISABELLE_JEDIT_BUILD_HOME/contrib/js.jar"
04d473e883df build jedit as part of regular startup script (in that case depending on jedit_build component);
wenzelm
parents: 41380
diff changeset
   155
)
04d473e883df build jedit as part of regular startup script (in that case depending on jedit_build component);
wenzelm
parents: 41380
diff changeset
   156
04d473e883df build jedit as part of regular startup script (in that case depending on jedit_build component);
wenzelm
parents: 41380
diff changeset
   157
SCALA_JARS=(
04d473e883df build jedit as part of regular startup script (in that case depending on jedit_build component);
wenzelm
parents: 41380
diff changeset
   158
  "$SCALA_HOME/lib/scala-compiler.jar"
04d473e883df build jedit as part of regular startup script (in that case depending on jedit_build component);
wenzelm
parents: 41380
diff changeset
   159
  "$SCALA_HOME/lib/scala-library.jar"
04d473e883df build jedit as part of regular startup script (in that case depending on jedit_build component);
wenzelm
parents: 41380
diff changeset
   160
  "$SCALA_HOME/lib/scala-swing.jar"
04d473e883df build jedit as part of regular startup script (in that case depending on jedit_build component);
wenzelm
parents: 41380
diff changeset
   161
)
04d473e883df build jedit as part of regular startup script (in that case depending on jedit_build component);
wenzelm
parents: 41380
diff changeset
   162
04d473e883df build jedit as part of regular startup script (in that case depending on jedit_build component);
wenzelm
parents: 41380
diff changeset
   163
04d473e883df build jedit as part of regular startup script (in that case depending on jedit_build component);
wenzelm
parents: 41380
diff changeset
   164
# target
04d473e883df build jedit as part of regular startup script (in that case depending on jedit_build component);
wenzelm
parents: 41380
diff changeset
   165
04d473e883df build jedit as part of regular startup script (in that case depending on jedit_build component);
wenzelm
parents: 41380
diff changeset
   166
TARGET="dist/jars/Isabelle-jEdit.jar"
04d473e883df build jedit as part of regular startup script (in that case depending on jedit_build component);
wenzelm
parents: 41380
diff changeset
   167
43285
966f359dc724 further jedit build option;
wenzelm
parents: 43284
diff changeset
   168
if [ "$BUILD_JARS" = jars_fresh ]; then
966f359dc724 further jedit build option;
wenzelm
parents: 43284
diff changeset
   169
  OUTDATED=true
966f359dc724 further jedit build option;
wenzelm
parents: 43284
diff changeset
   170
else
966f359dc724 further jedit build option;
wenzelm
parents: 43284
diff changeset
   171
  OUTDATED=false
966f359dc724 further jedit build option;
wenzelm
parents: 43284
diff changeset
   172
  for SOURCE in "${SOURCES[@]}" "${PLUGIN_FILES[@]}" "$JEDIT_JAR" "${JEDIT_JARS[@]}"
966f359dc724 further jedit build option;
wenzelm
parents: 43284
diff changeset
   173
  do
966f359dc724 further jedit build option;
wenzelm
parents: 43284
diff changeset
   174
    [ ! -e "$SOURCE" ] && fail "Missing file: $SOURCE"
966f359dc724 further jedit build option;
wenzelm
parents: 43284
diff changeset
   175
    [ ! -e "$TARGET" -o "$SOURCE" -nt "$TARGET" ] && OUTDATED=true
966f359dc724 further jedit build option;
wenzelm
parents: 43284
diff changeset
   176
  done
966f359dc724 further jedit build option;
wenzelm
parents: 43284
diff changeset
   177
fi
43284
04d473e883df build jedit as part of regular startup script (in that case depending on jedit_build component);
wenzelm
parents: 41380
diff changeset
   178
04d473e883df build jedit as part of regular startup script (in that case depending on jedit_build component);
wenzelm
parents: 41380
diff changeset
   179
04d473e883df build jedit as part of regular startup script (in that case depending on jedit_build component);
wenzelm
parents: 41380
diff changeset
   180
# build
04d473e883df build jedit as part of regular startup script (in that case depending on jedit_build component);
wenzelm
parents: 41380
diff changeset
   181
04d473e883df build jedit as part of regular startup script (in that case depending on jedit_build component);
wenzelm
parents: 41380
diff changeset
   182
if [ "$OUTDATED" = true ]
04d473e883df build jedit as part of regular startup script (in that case depending on jedit_build component);
wenzelm
parents: 41380
diff changeset
   183
then
04d473e883df build jedit as part of regular startup script (in that case depending on jedit_build component);
wenzelm
parents: 41380
diff changeset
   184
  [ -z "$SCALA_HOME" ] && fail "Unknown SCALA_HOME -- Scala unavailable"
04d473e883df build jedit as part of regular startup script (in that case depending on jedit_build component);
wenzelm
parents: 41380
diff changeset
   185
04d473e883df build jedit as part of regular startup script (in that case depending on jedit_build component);
wenzelm
parents: 41380
diff changeset
   186
  [ -z "$ISABELLE_JEDIT_BUILD_HOME" ] && \
04d473e883df build jedit as part of regular startup script (in that case depending on jedit_build component);
wenzelm
parents: 41380
diff changeset
   187
    fail "Unknown ISABELLE_JEDIT_BUILD_HOME -- missing auxiliary component"
04d473e883df build jedit as part of regular startup script (in that case depending on jedit_build component);
wenzelm
parents: 41380
diff changeset
   188
04d473e883df build jedit as part of regular startup script (in that case depending on jedit_build component);
wenzelm
parents: 41380
diff changeset
   189
  [ -e "$ISABELLE_HOME/Admin/build" ] && \
43285
966f359dc724 further jedit build option;
wenzelm
parents: 43284
diff changeset
   190
    { "$ISABELLE_HOME/Admin/build" "$BUILD_JARS" || exit $?; }
966f359dc724 further jedit build option;
wenzelm
parents: 43284
diff changeset
   191
43284
04d473e883df build jedit as part of regular startup script (in that case depending on jedit_build component);
wenzelm
parents: 41380
diff changeset
   192
43285
966f359dc724 further jedit build option;
wenzelm
parents: 43284
diff changeset
   193
  echo "###"
966f359dc724 further jedit build option;
wenzelm
parents: 43284
diff changeset
   194
  echo "### Building Isabelle/jEdit ..."
966f359dc724 further jedit build option;
wenzelm
parents: 43284
diff changeset
   195
  echo "###"
43284
04d473e883df build jedit as part of regular startup script (in that case depending on jedit_build component);
wenzelm
parents: 41380
diff changeset
   196
04d473e883df build jedit as part of regular startup script (in that case depending on jedit_build component);
wenzelm
parents: 41380
diff changeset
   197
  rm -rf dist || failed
04d473e883df build jedit as part of regular startup script (in that case depending on jedit_build component);
wenzelm
parents: 41380
diff changeset
   198
  mkdir -p dist dist/classes || failed
04d473e883df build jedit as part of regular startup script (in that case depending on jedit_build component);
wenzelm
parents: 41380
diff changeset
   199
  cp -a "$ISABELLE_JEDIT_BUILD_HOME/contrib/$ISABELLE_JEDIT_BUILD_VERSION/." dist/.
04d473e883df build jedit as part of regular startup script (in that case depending on jedit_build component);
wenzelm
parents: 41380
diff changeset
   200
04d473e883df build jedit as part of regular startup script (in that case depending on jedit_build component);
wenzelm
parents: 41380
diff changeset
   201
  cp -a "${PLUGIN_FILES[@]}" dist/classes/.
04d473e883df build jedit as part of regular startup script (in that case depending on jedit_build component);
wenzelm
parents: 41380
diff changeset
   202
  cp -a dist-template/. dist/.
04d473e883df build jedit as part of regular startup script (in that case depending on jedit_build component);
wenzelm
parents: 41380
diff changeset
   203
  cp -a README dist/.
04d473e883df build jedit as part of regular startup script (in that case depending on jedit_build component);
wenzelm
parents: 41380
diff changeset
   204
04d473e883df build jedit as part of regular startup script (in that case depending on jedit_build component);
wenzelm
parents: 41380
diff changeset
   205
  perl -i -e 'while (<>) { if (m/NAME="javacc"/) {
04d473e883df build jedit as part of regular startup script (in that case depending on jedit_build component);
wenzelm
parents: 41380
diff changeset
   206
    print qq,<MODE NAME="isabelle" FILE="isabelle.xml" FILE_NAME_GLOB="*.thy"/>\n\n,;
04d473e883df build jedit as part of regular startup script (in that case depending on jedit_build component);
wenzelm
parents: 41380
diff changeset
   207
    print qq,<MODE NAME="isabelle-session" FILE="isabelle-session.xml" FILE_NAME_GLOB="session.root"/>\n\n,; }
04d473e883df build jedit as part of regular startup script (in that case depending on jedit_build component);
wenzelm
parents: 41380
diff changeset
   208
    print; }' dist/modes/catalog
04d473e883df build jedit as part of regular startup script (in that case depending on jedit_build component);
wenzelm
parents: 41380
diff changeset
   209
04d473e883df build jedit as part of regular startup script (in that case depending on jedit_build component);
wenzelm
parents: 41380
diff changeset
   210
  cp -a "${JEDIT_JARS[@]}" "${SCALA_JARS[@]}" "$ISABELLE_HOME/lib/classes/Pure.jar" \
04d473e883df build jedit as part of regular startup script (in that case depending on jedit_build component);
wenzelm
parents: 41380
diff changeset
   211
    dist/jars/. || failed
04d473e883df build jedit as part of regular startup script (in that case depending on jedit_build component);
wenzelm
parents: 41380
diff changeset
   212
04d473e883df build jedit as part of regular startup script (in that case depending on jedit_build component);
wenzelm
parents: 41380
diff changeset
   213
  (
04d473e883df build jedit as part of regular startup script (in that case depending on jedit_build component);
wenzelm
parents: 41380
diff changeset
   214
    for JAR in "$JEDIT_JAR" "${JEDIT_JARS[@]}" "$SCALA_HOME/lib/scala-compiler.jar"
04d473e883df build jedit as part of regular startup script (in that case depending on jedit_build component);
wenzelm
parents: 41380
diff changeset
   215
    do
04d473e883df build jedit as part of regular startup script (in that case depending on jedit_build component);
wenzelm
parents: 41380
diff changeset
   216
      CLASSPATH="$CLASSPATH:$JAR"
04d473e883df build jedit as part of regular startup script (in that case depending on jedit_build component);
wenzelm
parents: 41380
diff changeset
   217
    done
04d473e883df build jedit as part of regular startup script (in that case depending on jedit_build component);
wenzelm
parents: 41380
diff changeset
   218
    CLASSPATH="$(jvmpath "$CLASSPATH")"
04d473e883df build jedit as part of regular startup script (in that case depending on jedit_build component);
wenzelm
parents: 41380
diff changeset
   219
04d473e883df build jedit as part of regular startup script (in that case depending on jedit_build component);
wenzelm
parents: 41380
diff changeset
   220
    exec "$SCALA_HOME/bin/scalac" -unchecked -deprecation \
04d473e883df build jedit as part of regular startup script (in that case depending on jedit_build component);
wenzelm
parents: 41380
diff changeset
   221
      -d dist/classes -target:jvm-1.5 "${SOURCES[@]}"
04d473e883df build jedit as part of regular startup script (in that case depending on jedit_build component);
wenzelm
parents: 41380
diff changeset
   222
  ) || fail "Failed to compile sources"
04d473e883df build jedit as part of regular startup script (in that case depending on jedit_build component);
wenzelm
parents: 41380
diff changeset
   223
04d473e883df build jedit as part of regular startup script (in that case depending on jedit_build component);
wenzelm
parents: 41380
diff changeset
   224
  cd dist/classes
04d473e883df build jedit as part of regular startup script (in that case depending on jedit_build component);
wenzelm
parents: 41380
diff changeset
   225
  jar cf "../jars/Isabelle-jEdit.jar" * || failed
04d473e883df build jedit as part of regular startup script (in that case depending on jedit_build component);
wenzelm
parents: 41380
diff changeset
   226
  cd ../..
04d473e883df build jedit as part of regular startup script (in that case depending on jedit_build component);
wenzelm
parents: 41380
diff changeset
   227
  rm -rf dist/classes
04d473e883df build jedit as part of regular startup script (in that case depending on jedit_build component);
wenzelm
parents: 41380
diff changeset
   228
fi
04d473e883df build jedit as part of regular startup script (in that case depending on jedit_build component);
wenzelm
parents: 41380
diff changeset
   229
04d473e883df build jedit as part of regular startup script (in that case depending on jedit_build component);
wenzelm
parents: 41380
diff changeset
   230
popd >/dev/null
04d473e883df build jedit as part of regular startup script (in that case depending on jedit_build component);
wenzelm
parents: 41380
diff changeset
   231
04d473e883df build jedit as part of regular startup script (in that case depending on jedit_build component);
wenzelm
parents: 41380
diff changeset
   232
04d473e883df build jedit as part of regular startup script (in that case depending on jedit_build component);
wenzelm
parents: 41380
diff changeset
   233
## main
04d473e883df build jedit as part of regular startup script (in that case depending on jedit_build component);
wenzelm
parents: 41380
diff changeset
   234
04d473e883df build jedit as part of regular startup script (in that case depending on jedit_build component);
wenzelm
parents: 41380
diff changeset
   235
# perspective
34880
f88fc4fcab86 provide JEDIT_SETTINGS via settings;
wenzelm
parents: 34843
diff changeset
   236
f88fc4fcab86 provide JEDIT_SETTINGS via settings;
wenzelm
parents: 34843
diff changeset
   237
mkdir -p "$JEDIT_SETTINGS/DockableWindowManager"
f88fc4fcab86 provide JEDIT_SETTINGS via settings;
wenzelm
parents: 34843
diff changeset
   238
f88fc4fcab86 provide JEDIT_SETTINGS via settings;
wenzelm
parents: 34843
diff changeset
   239
if [ ! -e "$JEDIT_SETTINGS/perspective.xml" ]; then
f88fc4fcab86 provide JEDIT_SETTINGS via settings;
wenzelm
parents: 34843
diff changeset
   240
  cat > "$JEDIT_SETTINGS/DockableWindowManager/perspective-view0.xml" <<EOF
40155
0b57e3d9bc62 dock isabelle-session at bottom (again, cf. 37bdc2220cf8) to ensure that controls are fully visible;
wenzelm
parents: 39815
diff changeset
   241
<DOCKING LEFT="" TOP="" RIGHT="" BOTTOM="isabelle-session" LEFT_POS="0" TOP_POS="0" RIGHT_POS="250" BOTTOM_POS="250" />
34880
f88fc4fcab86 provide JEDIT_SETTINGS via settings;
wenzelm
parents: 34843
diff changeset
   242
EOF
f88fc4fcab86 provide JEDIT_SETTINGS via settings;
wenzelm
parents: 34843
diff changeset
   243
  cat > "$JEDIT_SETTINGS/perspective.xml" <<EOF
f88fc4fcab86 provide JEDIT_SETTINGS via settings;
wenzelm
parents: 34843
diff changeset
   244
<?xml version="1.0" encoding="UTF-8" ?>
f88fc4fcab86 provide JEDIT_SETTINGS via settings;
wenzelm
parents: 34843
diff changeset
   245
<!DOCTYPE PERSPECTIVE SYSTEM "perspective.dtd">
f88fc4fcab86 provide JEDIT_SETTINGS via settings;
wenzelm
parents: 34843
diff changeset
   246
<PERSPECTIVE>
f88fc4fcab86 provide JEDIT_SETTINGS via settings;
wenzelm
parents: 34843
diff changeset
   247
<VIEW PLAIN="FALSE">
f88fc4fcab86 provide JEDIT_SETTINGS via settings;
wenzelm
parents: 34843
diff changeset
   248
<GEOMETRY X="0" Y="35" WIDTH="1072" HEIGHT="787" EXT_STATE="0" />
f88fc4fcab86 provide JEDIT_SETTINGS via settings;
wenzelm
parents: 34843
diff changeset
   249
</VIEW>
f88fc4fcab86 provide JEDIT_SETTINGS via settings;
wenzelm
parents: 34843
diff changeset
   250
</PERSPECTIVE>
f88fc4fcab86 provide JEDIT_SETTINGS via settings;
wenzelm
parents: 34843
diff changeset
   251
EOF
f88fc4fcab86 provide JEDIT_SETTINGS via settings;
wenzelm
parents: 34843
diff changeset
   252
fi
f88fc4fcab86 provide JEDIT_SETTINGS via settings;
wenzelm
parents: 34843
diff changeset
   253
f88fc4fcab86 provide JEDIT_SETTINGS via settings;
wenzelm
parents: 34843
diff changeset
   254
43284
04d473e883df build jedit as part of regular startup script (in that case depending on jedit_build component);
wenzelm
parents: 41380
diff changeset
   255
# run
34333
b353b4cd9bd4 Isabelle/jEdit interface wrapper.
wenzelm
parents:
diff changeset
   256
43285
966f359dc724 further jedit build option;
wenzelm
parents: 43284
diff changeset
   257
[ "$BUILD_ONLY" = true ] || {
966f359dc724 further jedit build option;
wenzelm
parents: 43284
diff changeset
   258
  case "$JEDIT_LOGIC" in
966f359dc724 further jedit build option;
wenzelm
parents: 43284
diff changeset
   259
    /*)
966f359dc724 further jedit build option;
wenzelm
parents: 43284
diff changeset
   260
      ;;
966f359dc724 further jedit build option;
wenzelm
parents: 43284
diff changeset
   261
    */*)
966f359dc724 further jedit build option;
wenzelm
parents: 43284
diff changeset
   262
      JEDIT_LOGIC="$(pwd -P)/$JEDIT_LOGIC"
966f359dc724 further jedit build option;
wenzelm
parents: 43284
diff changeset
   263
      ;;
966f359dc724 further jedit build option;
wenzelm
parents: 43284
diff changeset
   264
  esac
34333
b353b4cd9bd4 Isabelle/jEdit interface wrapper.
wenzelm
parents:
diff changeset
   265
43285
966f359dc724 further jedit build option;
wenzelm
parents: 43284
diff changeset
   266
  export JEDIT_LOGIC JEDIT_PRINT_MODE
34333
b353b4cd9bd4 Isabelle/jEdit interface wrapper.
wenzelm
parents:
diff changeset
   267
43285
966f359dc724 further jedit build option;
wenzelm
parents: 43284
diff changeset
   268
  exec "$ISABELLE_TOOL" java "${JAVA_ARGS[@]}" \
966f359dc724 further jedit build option;
wenzelm
parents: 43284
diff changeset
   269
    -jar "$(jvmpath "$JEDIT_HOME/dist/jedit.jar")" \
966f359dc724 further jedit build option;
wenzelm
parents: 43284
diff changeset
   270
    "-settings=$(jvmpath "$JEDIT_SETTINGS")" "${ARGS[@]}"
966f359dc724 further jedit build option;
wenzelm
parents: 43284
diff changeset
   271
}