src/Tools/jEdit/lib/Tools/jedit
author bulwahn
Thu, 01 Dec 2011 22:14:35 +0100
changeset 45723 75691bcc2c0f
parent 45665 129db1416717
child 46502 3d43d4d4d071
permissions -rwxr-xr-x
quickcheck-random compilation also indicates if the counterexample is potentially spurious or not
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
43320
wenzelm
parents: 43287
diff changeset
    10
declare -a SOURCES=(
43285
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_options.scala"
45665
129db1416717 renamed Isabelle_Markup to Isabelle_Rendering to emphasize its meaning and make room for Pure Isabelle_Markup module;
wenzelm
parents: 45158
diff changeset
    18
  "src/isabelle_rendering.scala"
43285
966f359dc724 further jedit build option;
wenzelm
parents: 43284
diff changeset
    19
  "src/isabelle_sidekick.scala"
44577
96b6388d06c4 separate module for jEdit primitives for loading theory files;
wenzelm
parents: 44565
diff changeset
    20
  "src/jedit_thy_load.scala"
43285
966f359dc724 further jedit build option;
wenzelm
parents: 43284
diff changeset
    21
  "src/output_dockable.scala"
966f359dc724 further jedit build option;
wenzelm
parents: 43284
diff changeset
    22
  "src/plugin.scala"
966f359dc724 further jedit build option;
wenzelm
parents: 43284
diff changeset
    23
  "src/protocol_dockable.scala"
966f359dc724 further jedit build option;
wenzelm
parents: 43284
diff changeset
    24
  "src/raw_output_dockable.scala"
966f359dc724 further jedit build option;
wenzelm
parents: 43284
diff changeset
    25
  "src/scala_console.scala"
966f359dc724 further jedit build option;
wenzelm
parents: 43284
diff changeset
    26
  "src/session_dockable.scala"
43381
806878ae2219 separate module for text area painting;
wenzelm
parents: 43369
diff changeset
    27
  "src/text_area_painter.scala"
43414
f0770743b7ec static token markup, based on outer syntax only;
wenzelm
parents: 43413
diff changeset
    28
  "src/token_markup.scala"
43285
966f359dc724 further jedit build option;
wenzelm
parents: 43284
diff changeset
    29
)
966f359dc724 further jedit build option;
wenzelm
parents: 43284
diff changeset
    30
43320
wenzelm
parents: 43287
diff changeset
    31
declare -a RESOURCES=(
43286
a319da4fbfb0 simplified directory structure;
wenzelm
parents: 43285
diff changeset
    32
  "src/actions.xml"
a319da4fbfb0 simplified directory structure;
wenzelm
parents: 43285
diff changeset
    33
  "src/dockables.xml"
a319da4fbfb0 simplified directory structure;
wenzelm
parents: 43285
diff changeset
    34
  "src/Isabelle.props"
a319da4fbfb0 simplified directory structure;
wenzelm
parents: 43285
diff changeset
    35
  "src/services.xml"
43285
966f359dc724 further jedit build option;
wenzelm
parents: 43284
diff changeset
    36
)
966f359dc724 further jedit build option;
wenzelm
parents: 43284
diff changeset
    37
966f359dc724 further jedit build option;
wenzelm
parents: 43284
diff changeset
    38
34333
b353b4cd9bd4 Isabelle/jEdit interface wrapper.
wenzelm
parents:
diff changeset
    39
## diagnostics
b353b4cd9bd4 Isabelle/jEdit interface wrapper.
wenzelm
parents:
diff changeset
    40
34664
8f5fbe4a80ff Isabelle component;
wenzelm
parents: 34663
diff changeset
    41
PRG="$(basename "$0")"
8f5fbe4a80ff Isabelle component;
wenzelm
parents: 34663
diff changeset
    42
43284
04d473e883df build jedit as part of regular startup script (in that case depending on jedit_build component);
wenzelm
parents: 41380
diff changeset
    43
function usage()
34333
b353b4cd9bd4 Isabelle/jEdit interface wrapper.
wenzelm
parents:
diff changeset
    44
{
b353b4cd9bd4 Isabelle/jEdit interface wrapper.
wenzelm
parents:
diff changeset
    45
  echo
34664
8f5fbe4a80ff Isabelle component;
wenzelm
parents: 34663
diff changeset
    46
  echo "Usage: isabelle $PRG [OPTIONS] [FILES ...]"
34333
b353b4cd9bd4 Isabelle/jEdit interface wrapper.
wenzelm
parents:
diff changeset
    47
  echo
b353b4cd9bd4 Isabelle/jEdit interface wrapper.
wenzelm
parents:
diff changeset
    48
  echo "  Options are:"
b353b4cd9bd4 Isabelle/jEdit interface wrapper.
wenzelm
parents:
diff changeset
    49
  echo "    -J OPTION    add JVM runtime option"
34409
e61e2ab1f6f7 proper spelling of JEDIT_JAVA_OPTIONS;
wenzelm
parents: 34339
diff changeset
    50
  echo "                 (default JEDIT_JAVA_OPTIONS=$JEDIT_JAVA_OPTIONS)"
43285
966f359dc724 further jedit build option;
wenzelm
parents: 43284
diff changeset
    51
  echo "    -b           build only"
34691
f28c014bcbe3 option -d: enable debugger;
wenzelm
parents: 34664
diff changeset
    52
  echo "    -d           enable debugger"
43285
966f359dc724 further jedit build option;
wenzelm
parents: 43284
diff changeset
    53
  echo "    -f           fresh build"
34333
b353b4cd9bd4 Isabelle/jEdit interface wrapper.
wenzelm
parents:
diff changeset
    54
  echo "    -j OPTION    add jEdit runtime option"
b353b4cd9bd4 Isabelle/jEdit interface wrapper.
wenzelm
parents:
diff changeset
    55
  echo "                 (default JEDIT_OPTIONS=$JEDIT_OPTIONS)"
b353b4cd9bd4 Isabelle/jEdit interface wrapper.
wenzelm
parents:
diff changeset
    56
  echo "    -l NAME      logic image name (default ISABELLE_LOGIC=$ISABELLE_LOGIC)"
b353b4cd9bd4 Isabelle/jEdit interface wrapper.
wenzelm
parents:
diff changeset
    57
  echo "    -m MODE      add print mode for output"
b353b4cd9bd4 Isabelle/jEdit interface wrapper.
wenzelm
parents:
diff changeset
    58
  echo
34664
8f5fbe4a80ff Isabelle component;
wenzelm
parents: 34663
diff changeset
    59
  echo "Start jEdit with Isabelle plugin setup and opens theory FILES"
44862
fe711df09fd9 tuned usage;
wenzelm
parents: 44577
diff changeset
    60
  echo "(default Scratch.thy)."
34333
b353b4cd9bd4 Isabelle/jEdit interface wrapper.
wenzelm
parents:
diff changeset
    61
  echo
b353b4cd9bd4 Isabelle/jEdit interface wrapper.
wenzelm
parents:
diff changeset
    62
  exit 1
b353b4cd9bd4 Isabelle/jEdit interface wrapper.
wenzelm
parents:
diff changeset
    63
}
b353b4cd9bd4 Isabelle/jEdit interface wrapper.
wenzelm
parents:
diff changeset
    64
43284
04d473e883df build jedit as part of regular startup script (in that case depending on jedit_build component);
wenzelm
parents: 41380
diff changeset
    65
function fail()
34333
b353b4cd9bd4 Isabelle/jEdit interface wrapper.
wenzelm
parents:
diff changeset
    66
{
b353b4cd9bd4 Isabelle/jEdit interface wrapper.
wenzelm
parents:
diff changeset
    67
  echo "$1" >&2
b353b4cd9bd4 Isabelle/jEdit interface wrapper.
wenzelm
parents:
diff changeset
    68
  exit 2
b353b4cd9bd4 Isabelle/jEdit interface wrapper.
wenzelm
parents:
diff changeset
    69
}
b353b4cd9bd4 Isabelle/jEdit interface wrapper.
wenzelm
parents:
diff changeset
    70
43284
04d473e883df build jedit as part of regular startup script (in that case depending on jedit_build component);
wenzelm
parents: 41380
diff changeset
    71
function failed()
04d473e883df build jedit as part of regular startup script (in that case depending on jedit_build component);
wenzelm
parents: 41380
diff changeset
    72
{
04d473e883df build jedit as part of regular startup script (in that case depending on jedit_build component);
wenzelm
parents: 41380
diff changeset
    73
  fail "Failed!"
04d473e883df build jedit as part of regular startup script (in that case depending on jedit_build component);
wenzelm
parents: 41380
diff changeset
    74
}
04d473e883df build jedit as part of regular startup script (in that case depending on jedit_build component);
wenzelm
parents: 41380
diff changeset
    75
34333
b353b4cd9bd4 Isabelle/jEdit interface wrapper.
wenzelm
parents:
diff changeset
    76
b353b4cd9bd4 Isabelle/jEdit interface wrapper.
wenzelm
parents:
diff changeset
    77
## process command line
b353b4cd9bd4 Isabelle/jEdit interface wrapper.
wenzelm
parents:
diff changeset
    78
b353b4cd9bd4 Isabelle/jEdit interface wrapper.
wenzelm
parents:
diff changeset
    79
# options
b353b4cd9bd4 Isabelle/jEdit interface wrapper.
wenzelm
parents:
diff changeset
    80
43285
966f359dc724 further jedit build option;
wenzelm
parents: 43284
diff changeset
    81
BUILD_ONLY=false
966f359dc724 further jedit build option;
wenzelm
parents: 43284
diff changeset
    82
BUILD_JARS="jars"
34333
b353b4cd9bd4 Isabelle/jEdit interface wrapper.
wenzelm
parents:
diff changeset
    83
JEDIT_LOGIC="$ISABELLE_LOGIC"
b353b4cd9bd4 Isabelle/jEdit interface wrapper.
wenzelm
parents:
diff changeset
    84
JEDIT_PRINT_MODE=""
b353b4cd9bd4 Isabelle/jEdit interface wrapper.
wenzelm
parents:
diff changeset
    85
43284
04d473e883df build jedit as part of regular startup script (in that case depending on jedit_build component);
wenzelm
parents: 41380
diff changeset
    86
function getoptions()
34780
d0ff1c3a91ea more serious command line handling;
wenzelm
parents: 34691
diff changeset
    87
{
d0ff1c3a91ea more serious command line handling;
wenzelm
parents: 34691
diff changeset
    88
  OPTIND=1
45158
db4bf4fb5492 always use sockets on Windows/Cygwin;
wenzelm
parents: 45069
diff changeset
    89
  while getopts "J:bdfj:l:m:" OPT
34780
d0ff1c3a91ea more serious command line handling;
wenzelm
parents: 34691
diff changeset
    90
  do
d0ff1c3a91ea more serious command line handling;
wenzelm
parents: 34691
diff changeset
    91
    case "$OPT" in
d0ff1c3a91ea more serious command line handling;
wenzelm
parents: 34691
diff changeset
    92
      J)
d0ff1c3a91ea more serious command line handling;
wenzelm
parents: 34691
diff changeset
    93
        JAVA_ARGS["${#JAVA_ARGS[@]}"]="$OPTARG"
d0ff1c3a91ea more serious command line handling;
wenzelm
parents: 34691
diff changeset
    94
        ;;
43285
966f359dc724 further jedit build option;
wenzelm
parents: 43284
diff changeset
    95
      b)
966f359dc724 further jedit build option;
wenzelm
parents: 43284
diff changeset
    96
        BUILD_ONLY=true
966f359dc724 further jedit build option;
wenzelm
parents: 43284
diff changeset
    97
        ;;
34780
d0ff1c3a91ea more serious command line handling;
wenzelm
parents: 34691
diff changeset
    98
      d)
d0ff1c3a91ea more serious command line handling;
wenzelm
parents: 34691
diff changeset
    99
        JAVA_ARGS["${#JAVA_ARGS[@]}"]="-Xdebug"
d0ff1c3a91ea more serious command line handling;
wenzelm
parents: 34691
diff changeset
   100
        JAVA_ARGS["${#JAVA_ARGS[@]}"]="-Xrunjdwp:transport=dt_socket,server=y,suspend=n"
d0ff1c3a91ea more serious command line handling;
wenzelm
parents: 34691
diff changeset
   101
        ;;
43285
966f359dc724 further jedit build option;
wenzelm
parents: 43284
diff changeset
   102
      f)
966f359dc724 further jedit build option;
wenzelm
parents: 43284
diff changeset
   103
        BUILD_JARS="jars_fresh"
966f359dc724 further jedit build option;
wenzelm
parents: 43284
diff changeset
   104
        ;;
34780
d0ff1c3a91ea more serious command line handling;
wenzelm
parents: 34691
diff changeset
   105
      j)
d0ff1c3a91ea more serious command line handling;
wenzelm
parents: 34691
diff changeset
   106
        ARGS["${#ARGS[@]}"]="$OPTARG"
d0ff1c3a91ea more serious command line handling;
wenzelm
parents: 34691
diff changeset
   107
        ;;
d0ff1c3a91ea more serious command line handling;
wenzelm
parents: 34691
diff changeset
   108
      l)
d0ff1c3a91ea more serious command line handling;
wenzelm
parents: 34691
diff changeset
   109
        JEDIT_LOGIC="$OPTARG"
d0ff1c3a91ea more serious command line handling;
wenzelm
parents: 34691
diff changeset
   110
        ;;
d0ff1c3a91ea more serious command line handling;
wenzelm
parents: 34691
diff changeset
   111
      m)
d0ff1c3a91ea more serious command line handling;
wenzelm
parents: 34691
diff changeset
   112
        if [ -z "$JEDIT_PRINT_MODE" ]; then
d0ff1c3a91ea more serious command line handling;
wenzelm
parents: 34691
diff changeset
   113
          JEDIT_PRINT_MODE="$OPTARG"
d0ff1c3a91ea more serious command line handling;
wenzelm
parents: 34691
diff changeset
   114
        else
d0ff1c3a91ea more serious command line handling;
wenzelm
parents: 34691
diff changeset
   115
          JEDIT_PRINT_MODE="$JEDIT_PRINT_MODE,$OPTARG"
d0ff1c3a91ea more serious command line handling;
wenzelm
parents: 34691
diff changeset
   116
        fi
d0ff1c3a91ea more serious command line handling;
wenzelm
parents: 34691
diff changeset
   117
        ;;
d0ff1c3a91ea more serious command line handling;
wenzelm
parents: 34691
diff changeset
   118
      \?)
d0ff1c3a91ea more serious command line handling;
wenzelm
parents: 34691
diff changeset
   119
        usage
d0ff1c3a91ea more serious command line handling;
wenzelm
parents: 34691
diff changeset
   120
        ;;
d0ff1c3a91ea more serious command line handling;
wenzelm
parents: 34691
diff changeset
   121
    esac
d0ff1c3a91ea more serious command line handling;
wenzelm
parents: 34691
diff changeset
   122
  done
d0ff1c3a91ea more serious command line handling;
wenzelm
parents: 34691
diff changeset
   123
}
34581
abab3a577e10 slightly more robust treatment of options via arrays;
wenzelm
parents: 34412
diff changeset
   124
38257
f0fd14a9c11f clarified JEDIT_JAVA_OPTIONS vs. JEDIT_SYSTEM_OPTIONS -- discontinued JEDIT_APPLE_PROPERTIES;
wenzelm
parents: 34881
diff changeset
   125
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
   126
[ -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
   127
34780
d0ff1c3a91ea more serious command line handling;
wenzelm
parents: 34691
diff changeset
   128
declare -a ARGS; eval "ARGS=($JEDIT_OPTIONS)"
34333
b353b4cd9bd4 Isabelle/jEdit interface wrapper.
wenzelm
parents:
diff changeset
   129
34780
d0ff1c3a91ea more serious command line handling;
wenzelm
parents: 34691
diff changeset
   130
declare -a OPTIONS; eval "OPTIONS=($ISABELLE_JEDIT_OPTIONS)"
d0ff1c3a91ea more serious command line handling;
wenzelm
parents: 34691
diff changeset
   131
getoptions "${OPTIONS[@]}"
d0ff1c3a91ea more serious command line handling;
wenzelm
parents: 34691
diff changeset
   132
d0ff1c3a91ea more serious command line handling;
wenzelm
parents: 34691
diff changeset
   133
getoptions "$@"
34333
b353b4cd9bd4 Isabelle/jEdit interface wrapper.
wenzelm
parents:
diff changeset
   134
shift $(($OPTIND - 1))
b353b4cd9bd4 Isabelle/jEdit interface wrapper.
wenzelm
parents:
diff changeset
   135
b353b4cd9bd4 Isabelle/jEdit interface wrapper.
wenzelm
parents:
diff changeset
   136
b353b4cd9bd4 Isabelle/jEdit interface wrapper.
wenzelm
parents:
diff changeset
   137
# args
b353b4cd9bd4 Isabelle/jEdit interface wrapper.
wenzelm
parents:
diff changeset
   138
44485
2f0a34fc4d2d back to tradition Scratch.thy default -- execution wrt. perspective overcomes the main problems of 226563829580;
wenzelm
parents: 43695
diff changeset
   139
if [ "$#" -eq 0 ]; then
2f0a34fc4d2d back to tradition Scratch.thy default -- execution wrt. perspective overcomes the main problems of 226563829580;
wenzelm
parents: 43695
diff changeset
   140
  ARGS["${#ARGS[@]}"]="Scratch.thy"
2f0a34fc4d2d back to tradition Scratch.thy default -- execution wrt. perspective overcomes the main problems of 226563829580;
wenzelm
parents: 43695
diff changeset
   141
else
2f0a34fc4d2d back to tradition Scratch.thy default -- execution wrt. perspective overcomes the main problems of 226563829580;
wenzelm
parents: 43695
diff changeset
   142
  while [ "$#" -gt 0 ]; do
2f0a34fc4d2d back to tradition Scratch.thy default -- execution wrt. perspective overcomes the main problems of 226563829580;
wenzelm
parents: 43695
diff changeset
   143
    ARGS["${#ARGS[@]}"]="$(jvmpath "$1")"
2f0a34fc4d2d back to tradition Scratch.thy default -- execution wrt. perspective overcomes the main problems of 226563829580;
wenzelm
parents: 43695
diff changeset
   144
    shift
2f0a34fc4d2d back to tradition Scratch.thy default -- execution wrt. perspective overcomes the main problems of 226563829580;
wenzelm
parents: 43695
diff changeset
   145
  done
2f0a34fc4d2d back to tradition Scratch.thy default -- execution wrt. perspective overcomes the main problems of 226563829580;
wenzelm
parents: 43695
diff changeset
   146
fi
34333
b353b4cd9bd4 Isabelle/jEdit interface wrapper.
wenzelm
parents:
diff changeset
   147
b353b4cd9bd4 Isabelle/jEdit interface wrapper.
wenzelm
parents:
diff changeset
   148
43284
04d473e883df build jedit as part of regular startup script (in that case depending on jedit_build component);
wenzelm
parents: 41380
diff changeset
   149
## dependencies
04d473e883df build jedit as part of regular startup script (in that case depending on jedit_build component);
wenzelm
parents: 41380
diff changeset
   150
43413
7a7604573ecd explicit dependency on Pure.jar;
wenzelm
parents: 43405
diff changeset
   151
[ -e "$ISABELLE_HOME/Admin/build" ] && \
7a7604573ecd explicit dependency on Pure.jar;
wenzelm
parents: 43405
diff changeset
   152
  { "$ISABELLE_HOME/Admin/build" "$BUILD_JARS" || exit $?; }
7a7604573ecd explicit dependency on Pure.jar;
wenzelm
parents: 43405
diff changeset
   153
43523
5aaa0fe92672 simplified arrangement of jars;
wenzelm
parents: 43521
diff changeset
   154
PURE_JAR="$ISABELLE_HOME/lib/classes/ext/Pure.jar"
43413
7a7604573ecd explicit dependency on Pure.jar;
wenzelm
parents: 43405
diff changeset
   155
43285
966f359dc724 further jedit build option;
wenzelm
parents: 43284
diff changeset
   156
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
   157
04d473e883df build jedit as part of regular startup script (in that case depending on jedit_build component);
wenzelm
parents: 41380
diff changeset
   158
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
   159
04d473e883df build jedit as part of regular startup script (in that case depending on jedit_build component);
wenzelm
parents: 41380
diff changeset
   160
JEDIT_JARS=(
04d473e883df build jedit as part of regular startup script (in that case depending on jedit_build component);
wenzelm
parents: 41380
diff changeset
   161
  "$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
   162
  "$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
   163
  "$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
   164
  "$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
   165
  "$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
   166
  "$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
   167
)
04d473e883df build jedit as part of regular startup script (in that case depending on jedit_build component);
wenzelm
parents: 41380
diff changeset
   168
04d473e883df build jedit as part of regular startup script (in that case depending on jedit_build component);
wenzelm
parents: 41380
diff changeset
   169
SCALA_JARS=(
04d473e883df build jedit as part of regular startup script (in that case depending on jedit_build component);
wenzelm
parents: 41380
diff changeset
   170
  "$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
   171
  "$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
   172
  "$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
   173
)
04d473e883df build jedit as part of regular startup script (in that case depending on jedit_build component);
wenzelm
parents: 41380
diff changeset
   174
04d473e883df build jedit as part of regular startup script (in that case depending on jedit_build component);
wenzelm
parents: 41380
diff changeset
   175
04d473e883df build jedit as part of regular startup script (in that case depending on jedit_build component);
wenzelm
parents: 41380
diff changeset
   176
# target
04d473e883df build jedit as part of regular startup script (in that case depending on jedit_build component);
wenzelm
parents: 41380
diff changeset
   177
04d473e883df build jedit as part of regular startup script (in that case depending on jedit_build component);
wenzelm
parents: 41380
diff changeset
   178
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
   179
43384
9c228b8953f2 more explicit check of dependencies;
wenzelm
parents: 43381
diff changeset
   180
declare -a UPDATED=()
9c228b8953f2 more explicit check of dependencies;
wenzelm
parents: 43381
diff changeset
   181
43285
966f359dc724 further jedit build option;
wenzelm
parents: 43284
diff changeset
   182
if [ "$BUILD_JARS" = jars_fresh ]; then
966f359dc724 further jedit build option;
wenzelm
parents: 43284
diff changeset
   183
  OUTDATED=true
966f359dc724 further jedit build option;
wenzelm
parents: 43284
diff changeset
   184
else
966f359dc724 further jedit build option;
wenzelm
parents: 43284
diff changeset
   185
  OUTDATED=false
43368
0dc67b3cf8a5 check source dependencies only if jedit_build component is available;
wenzelm
parents: 43320
diff changeset
   186
  if [ ! -e "$TARGET" ]; then
0dc67b3cf8a5 check source dependencies only if jedit_build component is available;
wenzelm
parents: 43320
diff changeset
   187
    OUTDATED=true
43384
9c228b8953f2 more explicit check of dependencies;
wenzelm
parents: 43381
diff changeset
   188
  else
9c228b8953f2 more explicit check of dependencies;
wenzelm
parents: 43381
diff changeset
   189
    if [ -n "$ISABELLE_JEDIT_BUILD_HOME" ]; then
43454
wenzelm
parents: 43414
diff changeset
   190
      declare -a DEPS=("$JEDIT_JAR" "${JEDIT_JARS[@]}" "$PURE_JAR" "${SOURCES[@]}" "${RESOURCES[@]}")
43384
9c228b8953f2 more explicit check of dependencies;
wenzelm
parents: 43381
diff changeset
   191
    else
43454
wenzelm
parents: 43414
diff changeset
   192
      declare -a DEPS=("$PURE_JAR" "${SOURCES[@]}" "${RESOURCES[@]}")
43384
9c228b8953f2 more explicit check of dependencies;
wenzelm
parents: 43381
diff changeset
   193
    fi
9c228b8953f2 more explicit check of dependencies;
wenzelm
parents: 43381
diff changeset
   194
    for DEP in "${DEPS[@]}"
43368
0dc67b3cf8a5 check source dependencies only if jedit_build component is available;
wenzelm
parents: 43320
diff changeset
   195
    do
43384
9c228b8953f2 more explicit check of dependencies;
wenzelm
parents: 43381
diff changeset
   196
      [ ! -e "$DEP" ] && fail "Missing file: $DEP"
9c228b8953f2 more explicit check of dependencies;
wenzelm
parents: 43381
diff changeset
   197
      [ "$DEP" -nt "$TARGET" ] && {
9c228b8953f2 more explicit check of dependencies;
wenzelm
parents: 43381
diff changeset
   198
        OUTDATED=true
9c228b8953f2 more explicit check of dependencies;
wenzelm
parents: 43381
diff changeset
   199
        UPDATED["${#UPDATED[@]}"]="$DEP"
9c228b8953f2 more explicit check of dependencies;
wenzelm
parents: 43381
diff changeset
   200
      }
43368
0dc67b3cf8a5 check source dependencies only if jedit_build component is available;
wenzelm
parents: 43320
diff changeset
   201
    done
0dc67b3cf8a5 check source dependencies only if jedit_build component is available;
wenzelm
parents: 43320
diff changeset
   202
  fi
43285
966f359dc724 further jedit build option;
wenzelm
parents: 43284
diff changeset
   203
fi
43284
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
04d473e883df build jedit as part of regular startup script (in that case depending on jedit_build component);
wenzelm
parents: 41380
diff changeset
   206
# build
04d473e883df build jedit as part of regular startup script (in that case depending on jedit_build component);
wenzelm
parents: 41380
diff changeset
   207
04d473e883df build jedit as part of regular startup script (in that case depending on jedit_build component);
wenzelm
parents: 41380
diff changeset
   208
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
   209
then
43405
723a8af9d3f0 tuned messages;
wenzelm
parents: 43395
diff changeset
   210
  echo "### Building Isabelle/jEdit ..."
723a8af9d3f0 tuned messages;
wenzelm
parents: 43395
diff changeset
   211
43384
9c228b8953f2 more explicit check of dependencies;
wenzelm
parents: 43381
diff changeset
   212
  [ "${#UPDATED[@]}" -gt 0 ] && {
43405
723a8af9d3f0 tuned messages;
wenzelm
parents: 43395
diff changeset
   213
    echo "Changed files:"
43384
9c228b8953f2 more explicit check of dependencies;
wenzelm
parents: 43381
diff changeset
   214
    for FILE in "${UPDATED[@]}"
9c228b8953f2 more explicit check of dependencies;
wenzelm
parents: 43381
diff changeset
   215
    do
9c228b8953f2 more explicit check of dependencies;
wenzelm
parents: 43381
diff changeset
   216
      echo "  $FILE"
9c228b8953f2 more explicit check of dependencies;
wenzelm
parents: 43381
diff changeset
   217
    done
9c228b8953f2 more explicit check of dependencies;
wenzelm
parents: 43381
diff changeset
   218
  }
9c228b8953f2 more explicit check of dependencies;
wenzelm
parents: 43381
diff changeset
   219
43284
04d473e883df build jedit as part of regular startup script (in that case depending on jedit_build component);
wenzelm
parents: 41380
diff changeset
   220
  [ -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
   221
    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
   222
04d473e883df build jedit as part of regular startup script (in that case depending on jedit_build component);
wenzelm
parents: 41380
diff changeset
   223
  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
   224
  mkdir -p dist dist/classes || failed
43287
acc680ab6204 simplified directory structure;
wenzelm
parents: 43286
diff changeset
   225
44565
dcbae90d82c9 more portable cp options, e.g. for non-GNU version on Mac OS X Leopard;
wenzelm
parents: 44485
diff changeset
   226
  cp -pR "$ISABELLE_JEDIT_BUILD_HOME/contrib/$ISABELLE_JEDIT_BUILD_VERSION/." dist/.
dcbae90d82c9 more portable cp options, e.g. for non-GNU version on Mac OS X Leopard;
wenzelm
parents: 44485
diff changeset
   227
  cp -pR "${RESOURCES[@]}" dist/classes/.
43287
acc680ab6204 simplified directory structure;
wenzelm
parents: 43286
diff changeset
   228
  cp src/jEdit.props dist/properties/.
44565
dcbae90d82c9 more portable cp options, e.g. for non-GNU version on Mac OS X Leopard;
wenzelm
parents: 44485
diff changeset
   229
  cp -pR src/modes/. dist/modes/.
dcbae90d82c9 more portable cp options, e.g. for non-GNU version on Mac OS X Leopard;
wenzelm
parents: 44485
diff changeset
   230
  cp -pR "$SCALA_HOME/misc/scala-tool-support/jedit/modes/scala.xml" dist/modes/.
43284
04d473e883df build jedit as part of regular startup script (in that case depending on jedit_build component);
wenzelm
parents: 41380
diff changeset
   231
43391
986860aa51ac include scala mode;
wenzelm
parents: 43384
diff changeset
   232
  perl -i -e 'while (<>) {
986860aa51ac include scala mode;
wenzelm
parents: 43384
diff changeset
   233
    if (m/NAME="javacc"/) {
986860aa51ac include scala mode;
wenzelm
parents: 43384
diff changeset
   234
      print qq,<MODE NAME="isabelle" FILE="isabelle.xml" FILE_NAME_GLOB="*.thy"/>\n\n,;
986860aa51ac include scala mode;
wenzelm
parents: 43384
diff changeset
   235
      print qq,<MODE NAME="isabelle-session" FILE="isabelle-session.xml" FILE_NAME_GLOB="session.root"/>\n\n,; }
986860aa51ac include scala mode;
wenzelm
parents: 43384
diff changeset
   236
    elsif (m/NAME="scheme"/) {
986860aa51ac include scala mode;
wenzelm
parents: 43384
diff changeset
   237
      print qq,<MODE NAME="scala" FILE="scala.xml" FILE_NAME_GLOB="*.scala" />\n\n,; }
43284
04d473e883df build jedit as part of regular startup script (in that case depending on jedit_build component);
wenzelm
parents: 41380
diff changeset
   238
    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
   239
44565
dcbae90d82c9 more portable cp options, e.g. for non-GNU version on Mac OS X Leopard;
wenzelm
parents: 44485
diff changeset
   240
  cp -pR "${JEDIT_JARS[@]}" "$SCALA_HOME/lib/scala-compiler.jar" dist/jars/. || failed
43284
04d473e883df build jedit as part of regular startup script (in that case depending on jedit_build component);
wenzelm
parents: 41380
diff changeset
   241
  (
43521
d477b92109b8 provide Isabelle/Scala environment as Java extension, instead of user classpath
wenzelm
parents: 43454
diff changeset
   242
    for JAR in "$JEDIT_JAR" "${JEDIT_JARS[@]}" "$PURE_JAR" "$SCALA_HOME/lib/scala-compiler.jar"
43284
04d473e883df build jedit as part of regular startup script (in that case depending on jedit_build component);
wenzelm
parents: 41380
diff changeset
   243
    do
04d473e883df build jedit as part of regular startup script (in that case depending on jedit_build component);
wenzelm
parents: 41380
diff changeset
   244
      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
   245
    done
04d473e883df build jedit as part of regular startup script (in that case depending on jedit_build component);
wenzelm
parents: 41380
diff changeset
   246
    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
   247
    exec "$SCALA_HOME/bin/scalac" -unchecked -deprecation \
43320
wenzelm
parents: 43287
diff changeset
   248
      -d dist/classes -target:jvm-1.5 "${SOURCES[@]}"
43284
04d473e883df build jedit as part of regular startup script (in that case depending on jedit_build component);
wenzelm
parents: 41380
diff changeset
   249
  ) || 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
   250
04d473e883df build jedit as part of regular startup script (in that case depending on jedit_build component);
wenzelm
parents: 41380
diff changeset
   251
  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
   252
  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
   253
  cd ../..
04d473e883df build jedit as part of regular startup script (in that case depending on jedit_build component);
wenzelm
parents: 41380
diff changeset
   254
  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
   255
fi
04d473e883df build jedit as part of regular startup script (in that case depending on jedit_build component);
wenzelm
parents: 41380
diff changeset
   256
04d473e883df build jedit as part of regular startup script (in that case depending on jedit_build component);
wenzelm
parents: 41380
diff changeset
   257
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
   258
04d473e883df build jedit as part of regular startup script (in that case depending on jedit_build component);
wenzelm
parents: 41380
diff changeset
   259
04d473e883df build jedit as part of regular startup script (in that case depending on jedit_build component);
wenzelm
parents: 41380
diff changeset
   260
## main
04d473e883df build jedit as part of regular startup script (in that case depending on jedit_build component);
wenzelm
parents: 41380
diff changeset
   261
04d473e883df build jedit as part of regular startup script (in that case depending on jedit_build component);
wenzelm
parents: 41380
diff changeset
   262
# perspective
34880
f88fc4fcab86 provide JEDIT_SETTINGS via settings;
wenzelm
parents: 34843
diff changeset
   263
f88fc4fcab86 provide JEDIT_SETTINGS via settings;
wenzelm
parents: 34843
diff changeset
   264
mkdir -p "$JEDIT_SETTINGS/DockableWindowManager"
f88fc4fcab86 provide JEDIT_SETTINGS via settings;
wenzelm
parents: 34843
diff changeset
   265
f88fc4fcab86 provide JEDIT_SETTINGS via settings;
wenzelm
parents: 34843
diff changeset
   266
if [ ! -e "$JEDIT_SETTINGS/perspective.xml" ]; then
f88fc4fcab86 provide JEDIT_SETTINGS via settings;
wenzelm
parents: 34843
diff changeset
   267
  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
   268
<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
   269
EOF
f88fc4fcab86 provide JEDIT_SETTINGS via settings;
wenzelm
parents: 34843
diff changeset
   270
  cat > "$JEDIT_SETTINGS/perspective.xml" <<EOF
f88fc4fcab86 provide JEDIT_SETTINGS via settings;
wenzelm
parents: 34843
diff changeset
   271
<?xml version="1.0" encoding="UTF-8" ?>
f88fc4fcab86 provide JEDIT_SETTINGS via settings;
wenzelm
parents: 34843
diff changeset
   272
<!DOCTYPE PERSPECTIVE SYSTEM "perspective.dtd">
f88fc4fcab86 provide JEDIT_SETTINGS via settings;
wenzelm
parents: 34843
diff changeset
   273
<PERSPECTIVE>
f88fc4fcab86 provide JEDIT_SETTINGS via settings;
wenzelm
parents: 34843
diff changeset
   274
<VIEW PLAIN="FALSE">
f88fc4fcab86 provide JEDIT_SETTINGS via settings;
wenzelm
parents: 34843
diff changeset
   275
<GEOMETRY X="0" Y="35" WIDTH="1072" HEIGHT="787" EXT_STATE="0" />
f88fc4fcab86 provide JEDIT_SETTINGS via settings;
wenzelm
parents: 34843
diff changeset
   276
</VIEW>
f88fc4fcab86 provide JEDIT_SETTINGS via settings;
wenzelm
parents: 34843
diff changeset
   277
</PERSPECTIVE>
f88fc4fcab86 provide JEDIT_SETTINGS via settings;
wenzelm
parents: 34843
diff changeset
   278
EOF
f88fc4fcab86 provide JEDIT_SETTINGS via settings;
wenzelm
parents: 34843
diff changeset
   279
fi
f88fc4fcab86 provide JEDIT_SETTINGS via settings;
wenzelm
parents: 34843
diff changeset
   280
f88fc4fcab86 provide JEDIT_SETTINGS via settings;
wenzelm
parents: 34843
diff changeset
   281
43284
04d473e883df build jedit as part of regular startup script (in that case depending on jedit_build component);
wenzelm
parents: 41380
diff changeset
   282
# run
34333
b353b4cd9bd4 Isabelle/jEdit interface wrapper.
wenzelm
parents:
diff changeset
   283
43285
966f359dc724 further jedit build option;
wenzelm
parents: 43284
diff changeset
   284
[ "$BUILD_ONLY" = true ] || {
966f359dc724 further jedit build option;
wenzelm
parents: 43284
diff changeset
   285
  case "$JEDIT_LOGIC" in
966f359dc724 further jedit build option;
wenzelm
parents: 43284
diff changeset
   286
    /*)
966f359dc724 further jedit build option;
wenzelm
parents: 43284
diff changeset
   287
      ;;
966f359dc724 further jedit build option;
wenzelm
parents: 43284
diff changeset
   288
    */*)
966f359dc724 further jedit build option;
wenzelm
parents: 43284
diff changeset
   289
      JEDIT_LOGIC="$(pwd -P)/$JEDIT_LOGIC"
966f359dc724 further jedit build option;
wenzelm
parents: 43284
diff changeset
   290
      ;;
966f359dc724 further jedit build option;
wenzelm
parents: 43284
diff changeset
   291
  esac
34333
b353b4cd9bd4 Isabelle/jEdit interface wrapper.
wenzelm
parents:
diff changeset
   292
45158
db4bf4fb5492 always use sockets on Windows/Cygwin;
wenzelm
parents: 45069
diff changeset
   293
  export JEDIT_LOGIC JEDIT_PRINT_MODE
34333
b353b4cd9bd4 Isabelle/jEdit interface wrapper.
wenzelm
parents:
diff changeset
   294
43285
966f359dc724 further jedit build option;
wenzelm
parents: 43284
diff changeset
   295
  exec "$ISABELLE_TOOL" java "${JAVA_ARGS[@]}" \
966f359dc724 further jedit build option;
wenzelm
parents: 43284
diff changeset
   296
    -jar "$(jvmpath "$JEDIT_HOME/dist/jedit.jar")" \
966f359dc724 further jedit build option;
wenzelm
parents: 43284
diff changeset
   297
    "-settings=$(jvmpath "$JEDIT_SETTINGS")" "${ARGS[@]}"
966f359dc724 further jedit build option;
wenzelm
parents: 43284
diff changeset
   298
}