src/Tools/jEdit/lib/Tools/jedit
author wenzelm
Fri, 06 Sep 2013 17:01:49 +0200
changeset 53439 5bef05f5ed58
parent 53415 9ebab8b7d73c
child 53440 b99d006afbfe
permissions -rwxr-xr-x
prefer warm start via JEdit_Main;
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=(
50450
358b6020f8b6 generalized notion of active area, where sendback is just one application;
wenzelm
parents: 50433
diff changeset
    11
  "src/active.scala"
53023
f127e949389f Completion popup based on javax.swing.PopupFactory, which has better cross-platform chances than JWindow (cf. org/gjt/jedit/gui/CompletionPopup.java);
wenzelm
parents: 52981
diff changeset
    12
  "src/completion_popup.scala"
43285
966f359dc724 further jedit build option;
wenzelm
parents: 43284
diff changeset
    13
  "src/dockable.scala"
966f359dc724 further jedit build option;
wenzelm
parents: 43284
diff changeset
    14
  "src/document_model.scala"
966f359dc724 further jedit build option;
wenzelm
parents: 43284
diff changeset
    15
  "src/document_view.scala"
52445
18a720984855 dockable window for Isabelle documentation;
wenzelm
parents: 51533
diff changeset
    16
  "src/documentation_dockable.scala"
52846
82ac963c68cb dockable window for "find" dialog (GUI only);
wenzelm
parents: 52540
diff changeset
    17
  "src/find_dockable.scala"
50542
58bd88159f8f fold handling within Pretty_Text_Area, based on formal document content, which is static here;
wenzelm
parents: 50450
diff changeset
    18
  "src/fold_handling.scala"
49570
2265456f6131 more uniform graphview terminology;
wenzelm
parents: 49566
diff changeset
    19
  "src/graphview_dockable.scala"
43285
966f359dc724 further jedit build option;
wenzelm
parents: 43284
diff changeset
    20
  "src/html_panel.scala"
49726
2074197dc274 detach tooltip as dockable window;
wenzelm
parents: 49702
diff changeset
    21
  "src/info_dockable.scala"
50208
1382ad6d4774 tuned signature;
wenzelm
parents: 50202
diff changeset
    22
  "src/isabelle.scala"
43285
966f359dc724 further jedit build option;
wenzelm
parents: 43284
diff changeset
    23
  "src/isabelle_encoding.scala"
49246
248e66e8321f more systematic JEdit_Options.make_component;
wenzelm
parents: 49245
diff changeset
    24
  "src/isabelle_logic.scala"
43285
966f359dc724 further jedit build option;
wenzelm
parents: 43284
diff changeset
    25
  "src/isabelle_options.scala"
966f359dc724 further jedit build option;
wenzelm
parents: 43284
diff changeset
    26
  "src/isabelle_sidekick.scala"
52971
31926d2c04ee tuned signature -- more abstract PIDE editor operations;
wenzelm
parents: 52934
diff changeset
    27
  "src/jedit_editor.scala"
49406
38db4832b210 somewhat more general JEdit_Lib;
wenzelm
parents: 49398
diff changeset
    28
  "src/jedit_lib.scala"
49600
2b114b9d9d34 some support for jEdit warmstart;
wenzelm
parents: 49570
diff changeset
    29
  "src/jedit_main.scala"
50202
ec0f2f8dbeb9 tuned file name;
wenzelm
parents: 50183
diff changeset
    30
  "src/jedit_options.scala"
44577
96b6388d06c4 separate module for jEdit primitives for loading theory files;
wenzelm
parents: 44565
diff changeset
    31
  "src/jedit_thy_load.scala"
50433
9131dadb2bf7 basic monitor panel, using the powerful jfreechart library;
wenzelm
parents: 50416
diff changeset
    32
  "src/monitor_dockable.scala"
51071
b7e7557e80b5 some native Mac OS X support, notably quit_handler (important for dialog on unsaved changes);
wenzelm
parents: 50795
diff changeset
    33
  "src/osx_adapter.scala"
43285
966f359dc724 further jedit build option;
wenzelm
parents: 43284
diff changeset
    34
  "src/output_dockable.scala"
966f359dc724 further jedit build option;
wenzelm
parents: 43284
diff changeset
    35
  "src/plugin.scala"
53246
8d34caf5bf82 more elementary Popup via JLayeredPane -- avoid javax.swing.PopupFactory with its many problems and dangers of accidental HeavyWeightPopup (especially on Mac OS X);
wenzelm
parents: 53023
diff changeset
    36
  "src/popup.scala"
49398
0fa4389c04f9 alternative output panel, based on Pretty_Text_Area, based on JEditEmbeddedTextArea;
wenzelm
parents: 49246
diff changeset
    37
  "src/pretty_text_area.scala"
49702
696e91c0bc80 separate module Pretty_Tooltip;
wenzelm
parents: 49611
diff changeset
    38
  "src/pretty_tooltip.scala"
52934
bfb6873df88e separate Process_Indicator -- simplified/clarified version of org.gjt.sp.jedit.gui.AnimatedIcon;
wenzelm
parents: 52908
diff changeset
    39
  "src/process_indicator.scala"
43285
966f359dc724 further jedit build option;
wenzelm
parents: 43284
diff changeset
    40
  "src/protocol_dockable.scala"
966f359dc724 further jedit build option;
wenzelm
parents: 43284
diff changeset
    41
  "src/raw_output_dockable.scala"
48014
63021e59cbf0 separate README dockable, which allows to make it more prominent first and remove it later;
wenzelm
parents: 47995
diff changeset
    42
  "src/readme_dockable.scala"
50202
ec0f2f8dbeb9 tuned file name;
wenzelm
parents: 50183
diff changeset
    43
  "src/rendering.scala"
49411
1da54e9bda68 renamed Text_Area_Painter to Rich_Text_Area;
wenzelm
parents: 49406
diff changeset
    44
  "src/rich_text_area.scala"
43285
966f359dc724 further jedit build option;
wenzelm
parents: 43284
diff changeset
    45
  "src/scala_console.scala"
52908
3461985dcbc3 dockable window for Sledgehammer, based on asynchronous/parallel query operation;
wenzelm
parents: 52865
diff changeset
    46
  "src/sledgehammer_dockable.scala"
50143
4ff5d795ed08 dockable with buttons for symbols, grouped and sorted in tabs according to ~~/etc/symbols;
immler
parents: 50120
diff changeset
    47
  "src/symbols_dockable.scala"
48021
d899be1cfe6d separate syslog dockable -- discontinued tendency of sub-window management via tabs;
wenzelm
parents: 48014
diff changeset
    48
  "src/syslog_dockable.scala"
46572
3074685ab7ed separate module for text status overview;
wenzelm
parents: 46502
diff changeset
    49
  "src/text_overview.scala"
50299
f70b3712040f renamed dockable "Prover Session" to "Theories";
wenzelm
parents: 50208
diff changeset
    50
  "src/theories_dockable.scala"
51533
3f6280aedbcc dockable window for timing information;
wenzelm
parents: 51504
diff changeset
    51
  "src/timing_dockable.scala"
43414
f0770743b7ec static token markup, based on outer syntax only;
wenzelm
parents: 43413
diff changeset
    52
  "src/token_markup.scala"
43285
966f359dc724 further jedit build option;
wenzelm
parents: 43284
diff changeset
    53
)
966f359dc724 further jedit build option;
wenzelm
parents: 43284
diff changeset
    54
43320
wenzelm
parents: 43287
diff changeset
    55
declare -a RESOURCES=(
43286
a319da4fbfb0 simplified directory structure;
wenzelm
parents: 43285
diff changeset
    56
  "src/actions.xml"
a319da4fbfb0 simplified directory structure;
wenzelm
parents: 43285
diff changeset
    57
  "src/dockables.xml"
a319da4fbfb0 simplified directory structure;
wenzelm
parents: 43285
diff changeset
    58
  "src/Isabelle.props"
50306
b655d2d0406d updated to jedit-5.0.0;
wenzelm
parents: 50299
diff changeset
    59
  "src/jEdit.props"
43286
a319da4fbfb0 simplified directory structure;
wenzelm
parents: 43285
diff changeset
    60
  "src/services.xml"
52540
c1ddd91ba515 more dependencies;
wenzelm
parents: 52539
diff changeset
    61
  "src/modes/isabelle-news.xml"
c1ddd91ba515 more dependencies;
wenzelm
parents: 52539
diff changeset
    62
  "src/modes/isabelle-options.xml"
c1ddd91ba515 more dependencies;
wenzelm
parents: 52539
diff changeset
    63
  "src/modes/isabelle-root.xml"
c1ddd91ba515 more dependencies;
wenzelm
parents: 52539
diff changeset
    64
  "src/modes/isabelle.xml"
43285
966f359dc724 further jedit build option;
wenzelm
parents: 43284
diff changeset
    65
)
966f359dc724 further jedit build option;
wenzelm
parents: 43284
diff changeset
    66
966f359dc724 further jedit build option;
wenzelm
parents: 43284
diff changeset
    67
34333
b353b4cd9bd4 Isabelle/jEdit interface wrapper.
wenzelm
parents:
diff changeset
    68
## diagnostics
b353b4cd9bd4 Isabelle/jEdit interface wrapper.
wenzelm
parents:
diff changeset
    69
34664
8f5fbe4a80ff Isabelle component;
wenzelm
parents: 34663
diff changeset
    70
PRG="$(basename "$0")"
8f5fbe4a80ff Isabelle component;
wenzelm
parents: 34663
diff changeset
    71
43284
04d473e883df build jedit as part of regular startup script (in that case depending on jedit_build component);
wenzelm
parents: 41380
diff changeset
    72
function usage()
34333
b353b4cd9bd4 Isabelle/jEdit interface wrapper.
wenzelm
parents:
diff changeset
    73
{
b353b4cd9bd4 Isabelle/jEdit interface wrapper.
wenzelm
parents:
diff changeset
    74
  echo
34664
8f5fbe4a80ff Isabelle component;
wenzelm
parents: 34663
diff changeset
    75
  echo "Usage: isabelle $PRG [OPTIONS] [FILES ...]"
34333
b353b4cd9bd4 Isabelle/jEdit interface wrapper.
wenzelm
parents:
diff changeset
    76
  echo
b353b4cd9bd4 Isabelle/jEdit interface wrapper.
wenzelm
parents:
diff changeset
    77
  echo "  Options are:"
b353b4cd9bd4 Isabelle/jEdit interface wrapper.
wenzelm
parents:
diff changeset
    78
  echo "    -J OPTION    add JVM runtime option"
34409
e61e2ab1f6f7 proper spelling of JEDIT_JAVA_OPTIONS;
wenzelm
parents: 34339
diff changeset
    79
  echo "                 (default JEDIT_JAVA_OPTIONS=$JEDIT_JAVA_OPTIONS)"
43285
966f359dc724 further jedit build option;
wenzelm
parents: 43284
diff changeset
    80
  echo "    -b           build only"
48791
9e8f30bfbdca added jedit option -d;
wenzelm
parents: 48603
diff changeset
    81
  echo "    -d DIR       include session directory"
43285
966f359dc724 further jedit build option;
wenzelm
parents: 43284
diff changeset
    82
  echo "    -f           fresh build"
34333
b353b4cd9bd4 Isabelle/jEdit interface wrapper.
wenzelm
parents:
diff changeset
    83
  echo "    -j OPTION    add jEdit runtime option"
b353b4cd9bd4 Isabelle/jEdit interface wrapper.
wenzelm
parents:
diff changeset
    84
  echo "                 (default JEDIT_OPTIONS=$JEDIT_OPTIONS)"
50403
87868964733c more uniform default logic, using settings, options, args etc.;
wenzelm
parents: 50373
diff changeset
    85
  echo "    -l NAME      logic session name"
34333
b353b4cd9bd4 Isabelle/jEdit interface wrapper.
wenzelm
parents:
diff changeset
    86
  echo "    -m MODE      add print mode for output"
50405
366c4a602500 clarified build_dialog: regular up-to-date check (extra cost of approx. 5s startup for HOL);
wenzelm
parents: 50403
diff changeset
    87
  echo "    -n           no build dialog for session image on startup"
50373
025f758fa24b implicit build_dialog for Isabelle/jEdit;
wenzelm
parents: 50306
diff changeset
    88
  echo "    -s           system build mode for session image"
34333
b353b4cd9bd4 Isabelle/jEdit interface wrapper.
wenzelm
parents:
diff changeset
    89
  echo
50550
8c3c7f158861 tuned command line;
wenzelm
parents: 50546
diff changeset
    90
  echo "Start jEdit with Isabelle plugin setup and open theory FILES"
50114
d203e98ef5c9 prefer absolute default $USER_HOME/Scratch.thy;
wenzelm
parents: 49953
diff changeset
    91
  echo "(default \"$USER_HOME/Scratch.thy\")."
34333
b353b4cd9bd4 Isabelle/jEdit interface wrapper.
wenzelm
parents:
diff changeset
    92
  echo
b353b4cd9bd4 Isabelle/jEdit interface wrapper.
wenzelm
parents:
diff changeset
    93
  exit 1
b353b4cd9bd4 Isabelle/jEdit interface wrapper.
wenzelm
parents:
diff changeset
    94
}
b353b4cd9bd4 Isabelle/jEdit interface wrapper.
wenzelm
parents:
diff changeset
    95
43284
04d473e883df build jedit as part of regular startup script (in that case depending on jedit_build component);
wenzelm
parents: 41380
diff changeset
    96
function fail()
34333
b353b4cd9bd4 Isabelle/jEdit interface wrapper.
wenzelm
parents:
diff changeset
    97
{
b353b4cd9bd4 Isabelle/jEdit interface wrapper.
wenzelm
parents:
diff changeset
    98
  echo "$1" >&2
b353b4cd9bd4 Isabelle/jEdit interface wrapper.
wenzelm
parents:
diff changeset
    99
  exit 2
b353b4cd9bd4 Isabelle/jEdit interface wrapper.
wenzelm
parents:
diff changeset
   100
}
b353b4cd9bd4 Isabelle/jEdit interface wrapper.
wenzelm
parents:
diff changeset
   101
43284
04d473e883df build jedit as part of regular startup script (in that case depending on jedit_build component);
wenzelm
parents: 41380
diff changeset
   102
function failed()
04d473e883df build jedit as part of regular startup script (in that case depending on jedit_build component);
wenzelm
parents: 41380
diff changeset
   103
{
04d473e883df build jedit as part of regular startup script (in that case depending on jedit_build component);
wenzelm
parents: 41380
diff changeset
   104
  fail "Failed!"
04d473e883df build jedit as part of regular startup script (in that case depending on jedit_build component);
wenzelm
parents: 41380
diff changeset
   105
}
04d473e883df build jedit as part of regular startup script (in that case depending on jedit_build component);
wenzelm
parents: 41380
diff changeset
   106
34333
b353b4cd9bd4 Isabelle/jEdit interface wrapper.
wenzelm
parents:
diff changeset
   107
b353b4cd9bd4 Isabelle/jEdit interface wrapper.
wenzelm
parents:
diff changeset
   108
## process command line
b353b4cd9bd4 Isabelle/jEdit interface wrapper.
wenzelm
parents:
diff changeset
   109
b353b4cd9bd4 Isabelle/jEdit interface wrapper.
wenzelm
parents:
diff changeset
   110
# options
b353b4cd9bd4 Isabelle/jEdit interface wrapper.
wenzelm
parents:
diff changeset
   111
50546
1b01a57d2749 clarified build_dialog command line;
wenzelm
parents: 50542
diff changeset
   112
declare -a BUILD_DIALOG_OPTIONS=(-L jedit_logic)
50373
025f758fa24b implicit build_dialog for Isabelle/jEdit;
wenzelm
parents: 50306
diff changeset
   113
43285
966f359dc724 further jedit build option;
wenzelm
parents: 43284
diff changeset
   114
BUILD_ONLY=false
966f359dc724 further jedit build option;
wenzelm
parents: 43284
diff changeset
   115
BUILD_JARS="jars"
48791
9e8f30bfbdca added jedit option -d;
wenzelm
parents: 48603
diff changeset
   116
JEDIT_SESSION_DIRS=""
50403
87868964733c more uniform default logic, using settings, options, args etc.;
wenzelm
parents: 50373
diff changeset
   117
JEDIT_LOGIC=""
34333
b353b4cd9bd4 Isabelle/jEdit interface wrapper.
wenzelm
parents:
diff changeset
   118
JEDIT_PRINT_MODE=""
50405
366c4a602500 clarified build_dialog: regular up-to-date check (extra cost of approx. 5s startup for HOL);
wenzelm
parents: 50403
diff changeset
   119
NO_BUILD="false"
34333
b353b4cd9bd4 Isabelle/jEdit interface wrapper.
wenzelm
parents:
diff changeset
   120
43284
04d473e883df build jedit as part of regular startup script (in that case depending on jedit_build component);
wenzelm
parents: 41380
diff changeset
   121
function getoptions()
34780
d0ff1c3a91ea more serious command line handling;
wenzelm
parents: 34691
diff changeset
   122
{
d0ff1c3a91ea more serious command line handling;
wenzelm
parents: 34691
diff changeset
   123
  OPTIND=1
50405
366c4a602500 clarified build_dialog: regular up-to-date check (extra cost of approx. 5s startup for HOL);
wenzelm
parents: 50403
diff changeset
   124
  while getopts "J:bd:fj:l:m:ns" OPT
34780
d0ff1c3a91ea more serious command line handling;
wenzelm
parents: 34691
diff changeset
   125
  do
d0ff1c3a91ea more serious command line handling;
wenzelm
parents: 34691
diff changeset
   126
    case "$OPT" in
d0ff1c3a91ea more serious command line handling;
wenzelm
parents: 34691
diff changeset
   127
      J)
d0ff1c3a91ea more serious command line handling;
wenzelm
parents: 34691
diff changeset
   128
        JAVA_ARGS["${#JAVA_ARGS[@]}"]="$OPTARG"
d0ff1c3a91ea more serious command line handling;
wenzelm
parents: 34691
diff changeset
   129
        ;;
43285
966f359dc724 further jedit build option;
wenzelm
parents: 43284
diff changeset
   130
      b)
966f359dc724 further jedit build option;
wenzelm
parents: 43284
diff changeset
   131
        BUILD_ONLY=true
966f359dc724 further jedit build option;
wenzelm
parents: 43284
diff changeset
   132
        ;;
48791
9e8f30bfbdca added jedit option -d;
wenzelm
parents: 48603
diff changeset
   133
      d)
9e8f30bfbdca added jedit option -d;
wenzelm
parents: 48603
diff changeset
   134
        if [ -z "$JEDIT_SESSION_DIRS" ]; then
9e8f30bfbdca added jedit option -d;
wenzelm
parents: 48603
diff changeset
   135
          JEDIT_SESSION_DIRS="$OPTARG"
9e8f30bfbdca added jedit option -d;
wenzelm
parents: 48603
diff changeset
   136
        else
9e8f30bfbdca added jedit option -d;
wenzelm
parents: 48603
diff changeset
   137
          JEDIT_SESSION_DIRS="$JEDIT_SESSION_DIRS:$OPTARG"
9e8f30bfbdca added jedit option -d;
wenzelm
parents: 48603
diff changeset
   138
        fi
50373
025f758fa24b implicit build_dialog for Isabelle/jEdit;
wenzelm
parents: 50306
diff changeset
   139
        BUILD_DIALOG_OPTIONS["${#BUILD_DIALOG_OPTIONS[@]}"]="-d"
025f758fa24b implicit build_dialog for Isabelle/jEdit;
wenzelm
parents: 50306
diff changeset
   140
        BUILD_DIALOG_OPTIONS["${#BUILD_DIALOG_OPTIONS[@]}"]="$OPTARG"
48791
9e8f30bfbdca added jedit option -d;
wenzelm
parents: 48603
diff changeset
   141
        ;;
43285
966f359dc724 further jedit build option;
wenzelm
parents: 43284
diff changeset
   142
      f)
966f359dc724 further jedit build option;
wenzelm
parents: 43284
diff changeset
   143
        BUILD_JARS="jars_fresh"
966f359dc724 further jedit build option;
wenzelm
parents: 43284
diff changeset
   144
        ;;
34780
d0ff1c3a91ea more serious command line handling;
wenzelm
parents: 34691
diff changeset
   145
      j)
d0ff1c3a91ea more serious command line handling;
wenzelm
parents: 34691
diff changeset
   146
        ARGS["${#ARGS[@]}"]="$OPTARG"
d0ff1c3a91ea more serious command line handling;
wenzelm
parents: 34691
diff changeset
   147
        ;;
d0ff1c3a91ea more serious command line handling;
wenzelm
parents: 34691
diff changeset
   148
      l)
50546
1b01a57d2749 clarified build_dialog command line;
wenzelm
parents: 50542
diff changeset
   149
        BUILD_DIALOG_OPTIONS["${#BUILD_DIALOG_OPTIONS[@]}"]="-l"
1b01a57d2749 clarified build_dialog command line;
wenzelm
parents: 50542
diff changeset
   150
        BUILD_DIALOG_OPTIONS["${#BUILD_DIALOG_OPTIONS[@]}"]="$OPTARG"
34780
d0ff1c3a91ea more serious command line handling;
wenzelm
parents: 34691
diff changeset
   151
        JEDIT_LOGIC="$OPTARG"
d0ff1c3a91ea more serious command line handling;
wenzelm
parents: 34691
diff changeset
   152
        ;;
d0ff1c3a91ea more serious command line handling;
wenzelm
parents: 34691
diff changeset
   153
      m)
d0ff1c3a91ea more serious command line handling;
wenzelm
parents: 34691
diff changeset
   154
        if [ -z "$JEDIT_PRINT_MODE" ]; then
d0ff1c3a91ea more serious command line handling;
wenzelm
parents: 34691
diff changeset
   155
          JEDIT_PRINT_MODE="$OPTARG"
d0ff1c3a91ea more serious command line handling;
wenzelm
parents: 34691
diff changeset
   156
        else
d0ff1c3a91ea more serious command line handling;
wenzelm
parents: 34691
diff changeset
   157
          JEDIT_PRINT_MODE="$JEDIT_PRINT_MODE,$OPTARG"
d0ff1c3a91ea more serious command line handling;
wenzelm
parents: 34691
diff changeset
   158
        fi
d0ff1c3a91ea more serious command line handling;
wenzelm
parents: 34691
diff changeset
   159
        ;;
50405
366c4a602500 clarified build_dialog: regular up-to-date check (extra cost of approx. 5s startup for HOL);
wenzelm
parents: 50403
diff changeset
   160
      n)
366c4a602500 clarified build_dialog: regular up-to-date check (extra cost of approx. 5s startup for HOL);
wenzelm
parents: 50403
diff changeset
   161
        NO_BUILD="true"
366c4a602500 clarified build_dialog: regular up-to-date check (extra cost of approx. 5s startup for HOL);
wenzelm
parents: 50403
diff changeset
   162
        ;;
50373
025f758fa24b implicit build_dialog for Isabelle/jEdit;
wenzelm
parents: 50306
diff changeset
   163
      s)
025f758fa24b implicit build_dialog for Isabelle/jEdit;
wenzelm
parents: 50306
diff changeset
   164
        BUILD_DIALOG_OPTIONS["${#BUILD_DIALOG_OPTIONS[@]}"]="-s"
025f758fa24b implicit build_dialog for Isabelle/jEdit;
wenzelm
parents: 50306
diff changeset
   165
        ;;
34780
d0ff1c3a91ea more serious command line handling;
wenzelm
parents: 34691
diff changeset
   166
      \?)
d0ff1c3a91ea more serious command line handling;
wenzelm
parents: 34691
diff changeset
   167
        usage
d0ff1c3a91ea more serious command line handling;
wenzelm
parents: 34691
diff changeset
   168
        ;;
d0ff1c3a91ea more serious command line handling;
wenzelm
parents: 34691
diff changeset
   169
    esac
d0ff1c3a91ea more serious command line handling;
wenzelm
parents: 34691
diff changeset
   170
  done
d0ff1c3a91ea more serious command line handling;
wenzelm
parents: 34691
diff changeset
   171
}
34581
abab3a577e10 slightly more robust treatment of options via arrays;
wenzelm
parents: 34412
diff changeset
   172
38257
f0fd14a9c11f clarified JEDIT_JAVA_OPTIONS vs. JEDIT_SYSTEM_OPTIONS -- discontinued JEDIT_APPLE_PROPERTIES;
wenzelm
parents: 34881
diff changeset
   173
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
   174
[ -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
   175
34780
d0ff1c3a91ea more serious command line handling;
wenzelm
parents: 34691
diff changeset
   176
declare -a ARGS; eval "ARGS=($JEDIT_OPTIONS)"
34333
b353b4cd9bd4 Isabelle/jEdit interface wrapper.
wenzelm
parents:
diff changeset
   177
34780
d0ff1c3a91ea more serious command line handling;
wenzelm
parents: 34691
diff changeset
   178
declare -a OPTIONS; eval "OPTIONS=($ISABELLE_JEDIT_OPTIONS)"
d0ff1c3a91ea more serious command line handling;
wenzelm
parents: 34691
diff changeset
   179
getoptions "${OPTIONS[@]}"
d0ff1c3a91ea more serious command line handling;
wenzelm
parents: 34691
diff changeset
   180
d0ff1c3a91ea more serious command line handling;
wenzelm
parents: 34691
diff changeset
   181
getoptions "$@"
34333
b353b4cd9bd4 Isabelle/jEdit interface wrapper.
wenzelm
parents:
diff changeset
   182
shift $(($OPTIND - 1))
b353b4cd9bd4 Isabelle/jEdit interface wrapper.
wenzelm
parents:
diff changeset
   183
b353b4cd9bd4 Isabelle/jEdit interface wrapper.
wenzelm
parents:
diff changeset
   184
b353b4cd9bd4 Isabelle/jEdit interface wrapper.
wenzelm
parents:
diff changeset
   185
# args
b353b4cd9bd4 Isabelle/jEdit interface wrapper.
wenzelm
parents:
diff changeset
   186
44485
2f0a34fc4d2d back to tradition Scratch.thy default -- execution wrt. perspective overcomes the main problems of 226563829580;
wenzelm
parents: 43695
diff changeset
   187
if [ "$#" -eq 0 ]; then
50120
245f5947233c proper jvmpath for windows;
wenzelm
parents: 50114
diff changeset
   188
  ARGS["${#ARGS[@]}"]="$(jvmpath "$USER_HOME/Scratch.thy")"
44485
2f0a34fc4d2d back to tradition Scratch.thy default -- execution wrt. perspective overcomes the main problems of 226563829580;
wenzelm
parents: 43695
diff changeset
   189
else
2f0a34fc4d2d back to tradition Scratch.thy default -- execution wrt. perspective overcomes the main problems of 226563829580;
wenzelm
parents: 43695
diff changeset
   190
  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
   191
    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
   192
    shift
2f0a34fc4d2d back to tradition Scratch.thy default -- execution wrt. perspective overcomes the main problems of 226563829580;
wenzelm
parents: 43695
diff changeset
   193
  done
2f0a34fc4d2d back to tradition Scratch.thy default -- execution wrt. perspective overcomes the main problems of 226563829580;
wenzelm
parents: 43695
diff changeset
   194
fi
34333
b353b4cd9bd4 Isabelle/jEdit interface wrapper.
wenzelm
parents:
diff changeset
   195
b353b4cd9bd4 Isabelle/jEdit interface wrapper.
wenzelm
parents:
diff changeset
   196
43284
04d473e883df build jedit as part of regular startup script (in that case depending on jedit_build component);
wenzelm
parents: 41380
diff changeset
   197
## dependencies
04d473e883df build jedit as part of regular startup script (in that case depending on jedit_build component);
wenzelm
parents: 41380
diff changeset
   198
49953
fc2e3b9d4852 avoid duplicate build of jars_fresh;
wenzelm
parents: 49726
diff changeset
   199
if [ -e "$ISABELLE_HOME/Admin/build" ]; then
50782
a26f7cf81d2f build browser more robustly before startup;
wenzelm
parents: 50729
diff changeset
   200
  "$ISABELLE_TOOL" browser -b || exit $?
49953
fc2e3b9d4852 avoid duplicate build of jars_fresh;
wenzelm
parents: 49726
diff changeset
   201
  if [ "$BUILD_JARS" = jars_fresh ]; then
fc2e3b9d4852 avoid duplicate build of jars_fresh;
wenzelm
parents: 49726
diff changeset
   202
    "$ISABELLE_TOOL" graphview -b -f || exit $?
fc2e3b9d4852 avoid duplicate build of jars_fresh;
wenzelm
parents: 49726
diff changeset
   203
  else
49566
66cbf8bb4693 basic integration of graphview into document model;
wenzelm
parents: 49494
diff changeset
   204
    "$ISABELLE_HOME/Admin/build" "$BUILD_JARS" || exit $?
49953
fc2e3b9d4852 avoid duplicate build of jars_fresh;
wenzelm
parents: 49726
diff changeset
   205
    "$ISABELLE_TOOL" graphview -b || exit $?
fc2e3b9d4852 avoid duplicate build of jars_fresh;
wenzelm
parents: 49726
diff changeset
   206
  fi
fc2e3b9d4852 avoid duplicate build of jars_fresh;
wenzelm
parents: 49726
diff changeset
   207
fi
43413
7a7604573ecd explicit dependency on Pure.jar;
wenzelm
parents: 43405
diff changeset
   208
43523
5aaa0fe92672 simplified arrangement of jars;
wenzelm
parents: 43521
diff changeset
   209
PURE_JAR="$ISABELLE_HOME/lib/classes/ext/Pure.jar"
49566
66cbf8bb4693 basic integration of graphview into document model;
wenzelm
parents: 49494
diff changeset
   210
GRAPHVIEW_JAR="$ISABELLE_HOME/lib/classes/ext/Graphview.jar"
43413
7a7604573ecd explicit dependency on Pure.jar;
wenzelm
parents: 43405
diff changeset
   211
43285
966f359dc724 further jedit build option;
wenzelm
parents: 43284
diff changeset
   212
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
   213
04d473e883df build jedit as part of regular startup script (in that case depending on jedit_build component);
wenzelm
parents: 41380
diff changeset
   214
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
   215
04d473e883df build jedit as part of regular startup script (in that case depending on jedit_build component);
wenzelm
parents: 41380
diff changeset
   216
JEDIT_JARS=(
53439
5bef05f5ed58 prefer warm start via JEdit_Main;
wenzelm
parents: 53415
diff changeset
   217
  "Console.jar"
5bef05f5ed58 prefer warm start via JEdit_Main;
wenzelm
parents: 53415
diff changeset
   218
  "ErrorList.jar"
5bef05f5ed58 prefer warm start via JEdit_Main;
wenzelm
parents: 53415
diff changeset
   219
  "Highlight.jar"
5bef05f5ed58 prefer warm start via JEdit_Main;
wenzelm
parents: 53415
diff changeset
   220
  "SideKick.jar"
5bef05f5ed58 prefer warm start via JEdit_Main;
wenzelm
parents: 53415
diff changeset
   221
  "cobra.jar"
5bef05f5ed58 prefer warm start via JEdit_Main;
wenzelm
parents: 53415
diff changeset
   222
  "js.jar"
5bef05f5ed58 prefer warm start via JEdit_Main;
wenzelm
parents: 53415
diff changeset
   223
  "idea-icons.jar"
5bef05f5ed58 prefer warm start via JEdit_Main;
wenzelm
parents: 53415
diff changeset
   224
  "jsr305-2.0.0.jar"
43284
04d473e883df build jedit as part of regular startup script (in that case depending on jedit_build component);
wenzelm
parents: 41380
diff changeset
   225
)
04d473e883df build jedit as part of regular startup script (in that case depending on jedit_build component);
wenzelm
parents: 41380
diff changeset
   226
53439
5bef05f5ed58 prefer warm start via JEdit_Main;
wenzelm
parents: 53415
diff changeset
   227
declare -a JEDIT_BUILD_JARS=()
5bef05f5ed58 prefer warm start via JEdit_Main;
wenzelm
parents: 53415
diff changeset
   228
declare -a JEDIT_STARTUP_JARS=()
5bef05f5ed58 prefer warm start via JEdit_Main;
wenzelm
parents: 53415
diff changeset
   229
for NAME in "${JEDIT_JARS[@]}"
5bef05f5ed58 prefer warm start via JEdit_Main;
wenzelm
parents: 53415
diff changeset
   230
do
5bef05f5ed58 prefer warm start via JEdit_Main;
wenzelm
parents: 53415
diff changeset
   231
  JEDIT_BUILD_JARS["${#JEDIT_BUILD_JARS[@]}"]="$ISABELLE_JEDIT_BUILD_HOME/contrib/$NAME"
5bef05f5ed58 prefer warm start via JEdit_Main;
wenzelm
parents: 53415
diff changeset
   232
  JEDIT_STARTUP_JARS["${#JEDIT_STARTUP_JARS[@]}"]="$JEDIT_HOME/dist/jars/$NAME"
5bef05f5ed58 prefer warm start via JEdit_Main;
wenzelm
parents: 53415
diff changeset
   233
done
5bef05f5ed58 prefer warm start via JEdit_Main;
wenzelm
parents: 53415
diff changeset
   234
50433
9131dadb2bf7 basic monitor panel, using the powerful jfreechart library;
wenzelm
parents: 50416
diff changeset
   235
declare -a JFREECHART_JARS=()
9131dadb2bf7 basic monitor panel, using the powerful jfreechart library;
wenzelm
parents: 50416
diff changeset
   236
for NAME in $JFREECHART_JAR_NAMES
9131dadb2bf7 basic monitor panel, using the powerful jfreechart library;
wenzelm
parents: 50416
diff changeset
   237
do
9131dadb2bf7 basic monitor panel, using the powerful jfreechart library;
wenzelm
parents: 50416
diff changeset
   238
  JFREECHART_JARS["${#JFREECHART_JARS[@]}"]="$JFREECHART_HOME/lib/$NAME"
9131dadb2bf7 basic monitor panel, using the powerful jfreechart library;
wenzelm
parents: 50416
diff changeset
   239
done
9131dadb2bf7 basic monitor panel, using the powerful jfreechart library;
wenzelm
parents: 50416
diff changeset
   240
43284
04d473e883df build jedit as part of regular startup script (in that case depending on jedit_build component);
wenzelm
parents: 41380
diff changeset
   241
04d473e883df build jedit as part of regular startup script (in that case depending on jedit_build component);
wenzelm
parents: 41380
diff changeset
   242
# target
04d473e883df build jedit as part of regular startup script (in that case depending on jedit_build component);
wenzelm
parents: 41380
diff changeset
   243
04d473e883df build jedit as part of regular startup script (in that case depending on jedit_build component);
wenzelm
parents: 41380
diff changeset
   244
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
   245
43384
9c228b8953f2 more explicit check of dependencies;
wenzelm
parents: 43381
diff changeset
   246
declare -a UPDATED=()
9c228b8953f2 more explicit check of dependencies;
wenzelm
parents: 43381
diff changeset
   247
43285
966f359dc724 further jedit build option;
wenzelm
parents: 43284
diff changeset
   248
if [ "$BUILD_JARS" = jars_fresh ]; then
966f359dc724 further jedit build option;
wenzelm
parents: 43284
diff changeset
   249
  OUTDATED=true
966f359dc724 further jedit build option;
wenzelm
parents: 43284
diff changeset
   250
else
966f359dc724 further jedit build option;
wenzelm
parents: 43284
diff changeset
   251
  OUTDATED=false
43368
0dc67b3cf8a5 check source dependencies only if jedit_build component is available;
wenzelm
parents: 43320
diff changeset
   252
  if [ ! -e "$TARGET" ]; then
0dc67b3cf8a5 check source dependencies only if jedit_build component is available;
wenzelm
parents: 43320
diff changeset
   253
    OUTDATED=true
43384
9c228b8953f2 more explicit check of dependencies;
wenzelm
parents: 43381
diff changeset
   254
  else
9c228b8953f2 more explicit check of dependencies;
wenzelm
parents: 43381
diff changeset
   255
    if [ -n "$ISABELLE_JEDIT_BUILD_HOME" ]; then
49566
66cbf8bb4693 basic integration of graphview into document model;
wenzelm
parents: 49494
diff changeset
   256
      declare -a DEPS=(
53439
5bef05f5ed58 prefer warm start via JEdit_Main;
wenzelm
parents: 53415
diff changeset
   257
        "$JEDIT_JAR" "${JEDIT_BUILD_JARS[@]}" "${JFREECHART_JARS[@]}" "$XZ_JAVA_HOME/lib/xz.jar"
49566
66cbf8bb4693 basic integration of graphview into document model;
wenzelm
parents: 49494
diff changeset
   258
        "$PURE_JAR" "$GRAPHVIEW_JAR" "${SOURCES[@]}" "${RESOURCES[@]}"
66cbf8bb4693 basic integration of graphview into document model;
wenzelm
parents: 49494
diff changeset
   259
      )
47666
cf5fe7eb6793 pretend jedit is up-to-date if this is not a repository -- avoid accidental build attempts after touching files etc.;
wenzelm
parents: 47115
diff changeset
   260
    elif [ -e "$ISABELLE_HOME/Admin/build" ]; then
49566
66cbf8bb4693 basic integration of graphview into document model;
wenzelm
parents: 49494
diff changeset
   261
      declare -a DEPS=("$PURE_JAR" "$GRAPHVIEW_JAR" "${SOURCES[@]}" "${RESOURCES[@]}")
43384
9c228b8953f2 more explicit check of dependencies;
wenzelm
parents: 43381
diff changeset
   262
    else
47666
cf5fe7eb6793 pretend jedit is up-to-date if this is not a repository -- avoid accidental build attempts after touching files etc.;
wenzelm
parents: 47115
diff changeset
   263
      declare -a DEPS=()
43384
9c228b8953f2 more explicit check of dependencies;
wenzelm
parents: 43381
diff changeset
   264
    fi
9c228b8953f2 more explicit check of dependencies;
wenzelm
parents: 43381
diff changeset
   265
    for DEP in "${DEPS[@]}"
43368
0dc67b3cf8a5 check source dependencies only if jedit_build component is available;
wenzelm
parents: 43320
diff changeset
   266
    do
43384
9c228b8953f2 more explicit check of dependencies;
wenzelm
parents: 43381
diff changeset
   267
      [ ! -e "$DEP" ] && fail "Missing file: $DEP"
9c228b8953f2 more explicit check of dependencies;
wenzelm
parents: 43381
diff changeset
   268
      [ "$DEP" -nt "$TARGET" ] && {
9c228b8953f2 more explicit check of dependencies;
wenzelm
parents: 43381
diff changeset
   269
        OUTDATED=true
9c228b8953f2 more explicit check of dependencies;
wenzelm
parents: 43381
diff changeset
   270
        UPDATED["${#UPDATED[@]}"]="$DEP"
9c228b8953f2 more explicit check of dependencies;
wenzelm
parents: 43381
diff changeset
   271
      }
43368
0dc67b3cf8a5 check source dependencies only if jedit_build component is available;
wenzelm
parents: 43320
diff changeset
   272
    done
0dc67b3cf8a5 check source dependencies only if jedit_build component is available;
wenzelm
parents: 43320
diff changeset
   273
  fi
43285
966f359dc724 further jedit build option;
wenzelm
parents: 43284
diff changeset
   274
fi
43284
04d473e883df build jedit as part of regular startup script (in that case depending on jedit_build component);
wenzelm
parents: 41380
diff changeset
   275
04d473e883df build jedit as part of regular startup script (in that case depending on jedit_build component);
wenzelm
parents: 41380
diff changeset
   276
04d473e883df build jedit as part of regular startup script (in that case depending on jedit_build component);
wenzelm
parents: 41380
diff changeset
   277
# build
04d473e883df build jedit as part of regular startup script (in that case depending on jedit_build component);
wenzelm
parents: 41380
diff changeset
   278
04d473e883df build jedit as part of regular startup script (in that case depending on jedit_build component);
wenzelm
parents: 41380
diff changeset
   279
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
   280
then
43405
723a8af9d3f0 tuned messages;
wenzelm
parents: 43395
diff changeset
   281
  echo "### Building Isabelle/jEdit ..."
723a8af9d3f0 tuned messages;
wenzelm
parents: 43395
diff changeset
   282
43384
9c228b8953f2 more explicit check of dependencies;
wenzelm
parents: 43381
diff changeset
   283
  [ "${#UPDATED[@]}" -gt 0 ] && {
43405
723a8af9d3f0 tuned messages;
wenzelm
parents: 43395
diff changeset
   284
    echo "Changed files:"
43384
9c228b8953f2 more explicit check of dependencies;
wenzelm
parents: 43381
diff changeset
   285
    for FILE in "${UPDATED[@]}"
9c228b8953f2 more explicit check of dependencies;
wenzelm
parents: 43381
diff changeset
   286
    do
9c228b8953f2 more explicit check of dependencies;
wenzelm
parents: 43381
diff changeset
   287
      echo "  $FILE"
9c228b8953f2 more explicit check of dependencies;
wenzelm
parents: 43381
diff changeset
   288
    done
9c228b8953f2 more explicit check of dependencies;
wenzelm
parents: 43381
diff changeset
   289
  }
9c228b8953f2 more explicit check of dependencies;
wenzelm
parents: 43381
diff changeset
   290
43284
04d473e883df build jedit as part of regular startup script (in that case depending on jedit_build component);
wenzelm
parents: 41380
diff changeset
   291
  [ -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
   292
    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
   293
04d473e883df build jedit as part of regular startup script (in that case depending on jedit_build component);
wenzelm
parents: 41380
diff changeset
   294
  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
   295
  mkdir -p dist dist/classes || failed
43287
acc680ab6204 simplified directory structure;
wenzelm
parents: 43286
diff changeset
   296
46502
3d43d4d4d071 more uniform / portable representation of the idea of "copy_dir" (NB: cp -f dereferences symlinks on GNU/Linux, but does not on old-school Unixen including BSD/Mac OS X);
wenzelm
parents: 45665
diff changeset
   297
  cp -p -R -f "$ISABELLE_JEDIT_BUILD_HOME/contrib/$ISABELLE_JEDIT_BUILD_VERSION/." dist/.
3d43d4d4d071 more uniform / portable representation of the idea of "copy_dir" (NB: cp -f dereferences symlinks on GNU/Linux, but does not on old-school Unixen including BSD/Mac OS X);
wenzelm
parents: 45665
diff changeset
   298
  cp -p -R -f "${RESOURCES[@]}" dist/classes/.
43287
acc680ab6204 simplified directory structure;
wenzelm
parents: 43286
diff changeset
   299
  cp src/jEdit.props dist/properties/.
46502
3d43d4d4d071 more uniform / portable representation of the idea of "copy_dir" (NB: cp -f dereferences symlinks on GNU/Linux, but does not on old-school Unixen including BSD/Mac OS X);
wenzelm
parents: 45665
diff changeset
   300
  cp -p -R -f src/modes/. 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
   301
43391
986860aa51ac include scala mode;
wenzelm
parents: 43384
diff changeset
   302
  perl -i -e 'while (<>) {
986860aa51ac include scala mode;
wenzelm
parents: 43384
diff changeset
   303
    if (m/NAME="javacc"/) {
986860aa51ac include scala mode;
wenzelm
parents: 43384
diff changeset
   304
      print qq,<MODE NAME="isabelle" FILE="isabelle.xml" FILE_NAME_GLOB="*.thy"/>\n\n,;
52539
7658f8d7b2dc minimal jedit mode for Isabelle NEWS;
wenzelm
parents: 52471
diff changeset
   305
      print qq,<MODE NAME="isabelle-news" FILE="isabelle-news.xml"/>\n\n,;
48366
7363de5c8a26 basic jEdit mode for Isabelle options;
wenzelm
parents: 48280
diff changeset
   306
      print qq,<MODE NAME="isabelle-options" FILE="isabelle-options.xml"/>\n\n,;
48575
920cf986e84f renamed isabelle-root minor mode;
wenzelm
parents: 48366
diff changeset
   307
      print qq,<MODE NAME="isabelle-root" FILE="isabelle-root.xml" FILE_NAME_GLOB="ROOT"/>\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
   308
    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
   309
53439
5bef05f5ed58 prefer warm start via JEdit_Main;
wenzelm
parents: 53415
diff changeset
   310
  cp -p -R -f "${JEDIT_BUILD_JARS[@]}" 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
   311
  (
53439
5bef05f5ed58 prefer warm start via JEdit_Main;
wenzelm
parents: 53415
diff changeset
   312
    for JAR in "$JEDIT_JAR" "${JEDIT_BUILD_JARS[@]}" "${JFREECHART_JARS[@]}" \
5bef05f5ed58 prefer warm start via JEdit_Main;
wenzelm
parents: 53415
diff changeset
   313
      "$XZ_JAVA_HOME/lib/xz.jar" "$PURE_JAR" "$GRAPHVIEW_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
   314
    do
04d473e883df build jedit as part of regular startup script (in that case depending on jedit_build component);
wenzelm
parents: 41380
diff changeset
   315
      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
   316
    done
04d473e883df build jedit as part of regular startup script (in that case depending on jedit_build component);
wenzelm
parents: 41380
diff changeset
   317
    CLASSPATH="$(jvmpath "$CLASSPATH")"
47009
97b68d61de2e less noisy Isabelle/Scala build process;
wenzelm
parents: 46996
diff changeset
   318
    exec "$SCALA_HOME/bin/scalac" $ISABELLE_SCALA_BUILD_OPTIONS -d dist/classes "${SOURCES[@]}"
43284
04d473e883df build jedit as part of regular startup script (in that case depending on jedit_build component);
wenzelm
parents: 41380
diff changeset
   319
  ) || 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
   320
04d473e883df build jedit as part of regular startup script (in that case depending on jedit_build component);
wenzelm
parents: 41380
diff changeset
   321
  cd dist/classes
47115
1a05adae1cc9 more robust command invocation via ISABELLE_JDK_HOME or SCALA_HOME (NB: bash exec requires genuine executable, not function);
wenzelm
parents: 47113
diff changeset
   322
  isabelle_jdk jar cf "../jars/Isabelle-jEdit.jar" * || failed
43284
04d473e883df build jedit as part of regular startup script (in that case depending on jedit_build component);
wenzelm
parents: 41380
diff changeset
   323
  cd ../..
04d473e883df build jedit as part of regular startup script (in that case depending on jedit_build component);
wenzelm
parents: 41380
diff changeset
   324
  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
   325
fi
04d473e883df build jedit as part of regular startup script (in that case depending on jedit_build component);
wenzelm
parents: 41380
diff changeset
   326
04d473e883df build jedit as part of regular startup script (in that case depending on jedit_build component);
wenzelm
parents: 41380
diff changeset
   327
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
   328
04d473e883df build jedit as part of regular startup script (in that case depending on jedit_build component);
wenzelm
parents: 41380
diff changeset
   329
04d473e883df build jedit as part of regular startup script (in that case depending on jedit_build component);
wenzelm
parents: 41380
diff changeset
   330
## main
04d473e883df build jedit as part of regular startup script (in that case depending on jedit_build component);
wenzelm
parents: 41380
diff changeset
   331
50795
69810ebe120f refrain from writing to JEDIT_SETTINGS in BUILD_ONLY mode -- relevant for makedist;
wenzelm
parents: 50782
diff changeset
   332
if [ "$BUILD_ONLY" = false ]; then
69810ebe120f refrain from writing to JEDIT_SETTINGS in BUILD_ONLY mode -- relevant for makedist;
wenzelm
parents: 50782
diff changeset
   333
  mkdir -p "$JEDIT_SETTINGS/DockableWindowManager"
34880
f88fc4fcab86 provide JEDIT_SETTINGS via settings;
wenzelm
parents: 34843
diff changeset
   334
50795
69810ebe120f refrain from writing to JEDIT_SETTINGS in BUILD_ONLY mode -- relevant for makedist;
wenzelm
parents: 50782
diff changeset
   335
  if [ ! -e "$JEDIT_SETTINGS/perspective.xml" ]; then
69810ebe120f refrain from writing to JEDIT_SETTINGS in BUILD_ONLY mode -- relevant for makedist;
wenzelm
parents: 50782
diff changeset
   336
    cat > "$JEDIT_SETTINGS/DockableWindowManager/perspective-view0.xml" <<EOF
48014
63021e59cbf0 separate README dockable, which allows to make it more prominent first and remove it later;
wenzelm
parents: 47995
diff changeset
   337
<DOCKING LEFT="" TOP="" RIGHT="" BOTTOM="isabelle-readme" LEFT_POS="0" TOP_POS="0" RIGHT_POS="250" BOTTOM_POS="250" />
34880
f88fc4fcab86 provide JEDIT_SETTINGS via settings;
wenzelm
parents: 34843
diff changeset
   338
EOF
f88fc4fcab86 provide JEDIT_SETTINGS via settings;
wenzelm
parents: 34843
diff changeset
   339
  cat > "$JEDIT_SETTINGS/perspective.xml" <<EOF
f88fc4fcab86 provide JEDIT_SETTINGS via settings;
wenzelm
parents: 34843
diff changeset
   340
<?xml version="1.0" encoding="UTF-8" ?>
f88fc4fcab86 provide JEDIT_SETTINGS via settings;
wenzelm
parents: 34843
diff changeset
   341
<!DOCTYPE PERSPECTIVE SYSTEM "perspective.dtd">
f88fc4fcab86 provide JEDIT_SETTINGS via settings;
wenzelm
parents: 34843
diff changeset
   342
<PERSPECTIVE>
f88fc4fcab86 provide JEDIT_SETTINGS via settings;
wenzelm
parents: 34843
diff changeset
   343
<VIEW PLAIN="FALSE">
f88fc4fcab86 provide JEDIT_SETTINGS via settings;
wenzelm
parents: 34843
diff changeset
   344
<GEOMETRY X="0" Y="35" WIDTH="1072" HEIGHT="787" EXT_STATE="0" />
f88fc4fcab86 provide JEDIT_SETTINGS via settings;
wenzelm
parents: 34843
diff changeset
   345
</VIEW>
f88fc4fcab86 provide JEDIT_SETTINGS via settings;
wenzelm
parents: 34843
diff changeset
   346
</PERSPECTIVE>
f88fc4fcab86 provide JEDIT_SETTINGS via settings;
wenzelm
parents: 34843
diff changeset
   347
EOF
50795
69810ebe120f refrain from writing to JEDIT_SETTINGS in BUILD_ONLY mode -- relevant for makedist;
wenzelm
parents: 50782
diff changeset
   348
  fi
34880
f88fc4fcab86 provide JEDIT_SETTINGS via settings;
wenzelm
parents: 34843
diff changeset
   349
50416
2e1b47e22fc6 more rigorous "build only" mode: avoid build dialog of logic image and its potential need for GUI display;
wenzelm
parents: 50405
diff changeset
   350
  if [ "$NO_BUILD" = false ]; then
50546
1b01a57d2749 clarified build_dialog command line;
wenzelm
parents: 50542
diff changeset
   351
    "$ISABELLE_TOOL" build_dialog "${BUILD_DIALOG_OPTIONS[@]}"
50416
2e1b47e22fc6 more rigorous "build only" mode: avoid build dialog of logic image and its potential need for GUI display;
wenzelm
parents: 50405
diff changeset
   352
    RC="$?"
2e1b47e22fc6 more rigorous "build only" mode: avoid build dialog of logic image and its potential need for GUI display;
wenzelm
parents: 50405
diff changeset
   353
    [ "$RC" = 0 ] || exit "$RC"
2e1b47e22fc6 more rigorous "build only" mode: avoid build dialog of logic image and its potential need for GUI display;
wenzelm
parents: 50405
diff changeset
   354
  fi
2e1b47e22fc6 more rigorous "build only" mode: avoid build dialog of logic image and its potential need for GUI display;
wenzelm
parents: 50405
diff changeset
   355
53439
5bef05f5ed58 prefer warm start via JEdit_Main;
wenzelm
parents: 53415
diff changeset
   356
  JEDIT_CLASSPATH="$JEDIT_HOME/dist/jedit.jar"
5bef05f5ed58 prefer warm start via JEdit_Main;
wenzelm
parents: 53415
diff changeset
   357
  for JAR in "$JEDIT_HOME/dist/jars/Isabelle-jEdit.jar" "${JEDIT_STARTUP_JARS[@]}" \
5bef05f5ed58 prefer warm start via JEdit_Main;
wenzelm
parents: 53415
diff changeset
   358
    "${JFREECHART_JARS[@]}"
5bef05f5ed58 prefer warm start via JEdit_Main;
wenzelm
parents: 53415
diff changeset
   359
  do
5bef05f5ed58 prefer warm start via JEdit_Main;
wenzelm
parents: 53415
diff changeset
   360
    JEDIT_CLASSPATH="$JEDIT_CLASSPATH:$JAR"
5bef05f5ed58 prefer warm start via JEdit_Main;
wenzelm
parents: 53415
diff changeset
   361
  done
5bef05f5ed58 prefer warm start via JEdit_Main;
wenzelm
parents: 53415
diff changeset
   362
  JEDIT_CLASSPATH="$(jvmpath "$JEDIT_CLASSPATH")"
5bef05f5ed58 prefer warm start via JEdit_Main;
wenzelm
parents: 53415
diff changeset
   363
48791
9e8f30bfbdca added jedit option -d;
wenzelm
parents: 48603
diff changeset
   364
  export JEDIT_SESSION_DIRS JEDIT_LOGIC JEDIT_PRINT_MODE
34333
b353b4cd9bd4 Isabelle/jEdit interface wrapper.
wenzelm
parents:
diff changeset
   365
43285
966f359dc724 further jedit build option;
wenzelm
parents: 43284
diff changeset
   366
  exec "$ISABELLE_TOOL" java "${JAVA_ARGS[@]}" \
53439
5bef05f5ed58 prefer warm start via JEdit_Main;
wenzelm
parents: 53415
diff changeset
   367
    -classpath "$JEDIT_CLASSPATH" isabelle.jedit.JEdit_Main "${ARGS[@]}"
50416
2e1b47e22fc6 more rigorous "build only" mode: avoid build dialog of logic image and its potential need for GUI display;
wenzelm
parents: 50405
diff changeset
   368
fi