src/Pure/build-jars
author wenzelm
Sun Oct 21 18:32:33 2018 +0200 (21 months ago)
changeset 69168 68816d1c73a7
parent 69012 c91d14ab065f
child 69255 800b1ce96fce
permissions -rwxr-xr-x
eliminated "isabelle makedist" -- prefer Scala over bash/perl scripting;
eliminated "isabelle news";
roper title in NEWS.html;
more robust build of documentation, using proper Other_Isabelle settings: avoid conflict with enclosing ISABELLE_OCAML / ISABELLE_GHC;
misc tuning and clarification;
wenzelm@34282
     1
#!/usr/bin/env bash
wenzelm@34282
     2
#
wenzelm@34282
     3
# Author: Makarius
wenzelm@34282
     4
#
wenzelm@42899
     5
# build-jars - build Isabelle/Scala
wenzelm@34282
     6
#
wenzelm@34282
     7
# Requires proper Isabelle settings environment.
wenzelm@34282
     8
wenzelm@43320
     9
## sources
wenzelm@43320
    10
wenzelm@43320
    11
declare -a SOURCES=(
wenzelm@66820
    12
  Admin/afp.scala
wenzelm@65071
    13
  Admin/build_cygwin.scala
wenzelm@64161
    14
  Admin/build_doc.scala
wenzelm@64160
    15
  Admin/build_history.scala
wenzelm@64929
    16
  Admin/build_jdk.scala
wenzelm@64160
    17
  Admin/build_log.scala
wenzelm@64483
    18
  Admin/build_polyml.scala
wenzelm@64202
    19
  Admin/build_release.scala
wenzelm@65743
    20
  Admin/build_status.scala
wenzelm@64161
    21
  Admin/check_sources.scala
wenzelm@64160
    22
  Admin/ci_profile.scala
wenzelm@64148
    23
  Admin/isabelle_cronjob.scala
wenzelm@65770
    24
  Admin/isabelle_devel.scala
wenzelm@65650
    25
  Admin/jenkins.scala
wenzelm@64188
    26
  Admin/other_isabelle.scala
wenzelm@64161
    27
  Admin/remote_dmg.scala
wenzelm@56695
    28
  Concurrent/consumer_thread.scala
wenzelm@43660
    29
  Concurrent/counter.scala
wenzelm@56768
    30
  Concurrent/event_timer.scala
wenzelm@43320
    31
  Concurrent/future.scala
wenzelm@56693
    32
  Concurrent/mailbox.scala
wenzelm@59136
    33
  Concurrent/par_list.scala
wenzelm@61556
    34
  Concurrent/standard_thread.scala
wenzelm@56685
    35
  Concurrent/synchronized.scala
wenzelm@57647
    36
  GUI/color_value.scala
wenzelm@57647
    37
  GUI/gui.scala
wenzelm@57647
    38
  GUI/gui_thread.scala
wenzelm@57647
    39
  GUI/popup.scala
wenzelm@57647
    40
  GUI/wrap_panel.scala
wenzelm@55511
    41
  General/antiquote.scala
wenzelm@54439
    42
  General/bytes.scala
wenzelm@68265
    43
  General/cache.scala
wenzelm@64610
    44
  General/codepoint.scala
wenzelm@67438
    45
  General/comment.scala
wenzelm@55673
    46
  General/completion.scala
wenzelm@67737
    47
  General/csv.scala
wenzelm@64056
    48
  General/date.scala
wenzelm@62508
    49
  General/exn.scala
wenzelm@48411
    50
  General/file.scala
wenzelm@64699
    51
  General/file_watcher.scala
wenzelm@46611
    52
  General/graph.scala
wenzelm@59244
    53
  General/graph_display.scala
wenzelm@51098
    54
  General/graphics_file.scala
wenzelm@65077
    55
  General/http.scala
wenzelm@63644
    56
  General/json.scala
wenzelm@43320
    57
  General/linear_set.scala
wenzelm@64606
    58
  General/logger.scala
wenzelm@56800
    59
  General/long_name.scala
wenzelm@63997
    60
  General/mercurial.scala
wenzelm@52975
    61
  General/multi_map.scala
wenzelm@56782
    62
  General/output.scala
wenzelm@43600
    63
  General/path.scala
wenzelm@43320
    64
  General/position.scala
wenzelm@43320
    65
  General/pretty.scala
wenzelm@43780
    66
  General/properties.scala
wenzelm@43320
    67
  General/scan.scala
wenzelm@43320
    68
  General/sha1.scala
wenzelm@63788
    69
  General/sql.scala
wenzelm@64123
    70
  General/ssh.scala
wenzelm@43320
    71
  General/symbol.scala
wenzelm@45674
    72
  General/time.scala
wenzelm@45666
    73
  General/timing.scala
wenzelm@57647
    74
  General/untyped.scala
wenzelm@56501
    75
  General/url.scala
wenzelm@64639
    76
  General/utf8.scala
wenzelm@63805
    77
  General/value.scala
wenzelm@56599
    78
  General/word.scala
wenzelm@64000
    79
  General/xz.scala
wenzelm@63604
    80
  Isar/document_structure.scala
wenzelm@43320
    81
  Isar/keyword.scala
wenzelm@63603
    82
  Isar/line_structure.scala
wenzelm@43320
    83
  Isar/outer_syntax.scala
wenzelm@43320
    84
  Isar/parse.scala
wenzelm@43320
    85
  Isar/token.scala
wenzelm@65477
    86
  ML/ml_console.scala
wenzelm@55497
    87
  ML/ml_lex.scala
wenzelm@65477
    88
  ML/ml_process.scala
wenzelm@65477
    89
  ML/ml_statistics.scala
wenzelm@62528
    90
  ML/ml_syntax.scala
wenzelm@43320
    91
  PIDE/command.scala
wenzelm@57905
    92
  PIDE/command_span.scala
wenzelm@43320
    93
  PIDE/document.scala
wenzelm@52530
    94
  PIDE/document_id.scala
wenzelm@68758
    95
  PIDE/document_status.scala
wenzelm@52971
    96
  PIDE/editor.scala
wenzelm@69012
    97
  PIDE/headless.scala
wenzelm@64611
    98
  PIDE/line.scala
wenzelm@45670
    99
  PIDE/markup.scala
wenzelm@43320
   100
  PIDE/markup_tree.scala
wenzelm@45709
   101
  PIDE/protocol.scala
wenzelm@65214
   102
  PIDE/protocol_handlers.scala
wenzelm@59713
   103
  PIDE/protocol_message.scala
wenzelm@56385
   104
  PIDE/prover.scala
wenzelm@52981
   105
  PIDE/query_operation.scala
wenzelm@64622
   106
  PIDE/rendering.scala
wenzelm@56208
   107
  PIDE/resources.scala
wenzelm@56210
   108
  PIDE/session.scala
wenzelm@43320
   109
  PIDE/text.scala
wenzelm@44698
   110
  PIDE/xml.scala
wenzelm@44698
   111
  PIDE/yxml.scala
wenzelm@57647
   112
  ROOT.scala
wenzelm@62584
   113
  System/bash.scala
wenzelm@61925
   114
  System/command_line.scala
wenzelm@61282
   115
  System/cygwin.scala
wenzelm@62845
   116
  System/distribution.scala
wenzelm@62431
   117
  System/getopts.scala
wenzelm@43744
   118
  System/invoke_scala.scala
wenzelm@43517
   119
  System/isabelle_charset.scala
wenzelm@43320
   120
  System/isabelle_process.scala
wenzelm@43320
   121
  System/isabelle_system.scala
wenzelm@62829
   122
  System/isabelle_tool.scala
wenzelm@64264
   123
  System/numa.scala
wenzelm@48365
   124
  System/options.scala
wenzelm@43320
   125
  System/platform.scala
wenzelm@56860
   126
  System/posix_interrupt.scala
wenzelm@62400
   127
  System/process_result.scala
wenzelm@61276
   128
  System/progress.scala
wenzelm@45027
   129
  System/system_channel.scala
wenzelm@67802
   130
  System/tty_loop.scala
wenzelm@67274
   131
  Thy/bibtex.scala
wenzelm@68092
   132
  Thy/export.scala
wenzelm@68171
   133
  Thy/export_theory.scala
wenzelm@43320
   134
  Thy/html.scala
wenzelm@67172
   135
  Thy/latex.scala
wenzelm@50707
   136
  Thy/present.scala
wenzelm@62631
   137
  Thy/sessions.scala
wenzelm@68845
   138
  Thy/thy_element.scala
wenzelm@43320
   139
  Thy/thy_header.scala
wenzelm@43320
   140
  Thy/thy_syntax.scala
wenzelm@68308
   141
  Tools/dump.scala
wenzelm@57647
   142
  Tools/build.scala
wenzelm@66790
   143
  Tools/build_docker.scala
wenzelm@59891
   144
  Tools/check_keywords.scala
wenzelm@60749
   145
  Tools/debugger.scala
wenzelm@52444
   146
  Tools/doc.scala
wenzelm@65557
   147
  Tools/imports.scala
wenzelm@50687
   148
  Tools/main.scala
wenzelm@67041
   149
  Tools/mkroot.scala
wenzelm@56864
   150
  Tools/print_operation.scala
wenzelm@64342
   151
  Tools/profiling_report.scala
wenzelm@66347
   152
  Tools/server.scala
wenzelm@67848
   153
  Tools/server_commands.scala
wenzelm@54730
   154
  Tools/simplifier_trace.scala
wenzelm@65139
   155
  Tools/spell_checker.scala
wenzelm@50980
   156
  Tools/task_statistics.scala
wenzelm@58610
   157
  Tools/update_cartouches.scala
wenzelm@67433
   158
  Tools/update_comments.scala
wenzelm@58872
   159
  Tools/update_header.scala
wenzelm@61216
   160
  Tools/update_then.scala
wenzelm@61337
   161
  Tools/update_theorems.scala
wenzelm@43320
   162
  library.scala
wenzelm@68713
   163
  pure_thy.scala
wenzelm@43730
   164
  term.scala
wenzelm@43779
   165
  term_xml.scala
wenzelm@64609
   166
  ../Tools/Graphview/graph_file.scala
wenzelm@64609
   167
  ../Tools/Graphview/graph_panel.scala
wenzelm@64609
   168
  ../Tools/Graphview/graphview.scala
wenzelm@64609
   169
  ../Tools/Graphview/layout.scala
wenzelm@64609
   170
  ../Tools/Graphview/main_panel.scala
wenzelm@64609
   171
  ../Tools/Graphview/metrics.scala
wenzelm@64609
   172
  ../Tools/Graphview/model.scala
wenzelm@64609
   173
  ../Tools/Graphview/mutator.scala
wenzelm@64609
   174
  ../Tools/Graphview/mutator_dialog.scala
wenzelm@64609
   175
  ../Tools/Graphview/mutator_event.scala
wenzelm@64609
   176
  ../Tools/Graphview/popups.scala
wenzelm@64609
   177
  ../Tools/Graphview/shapes.scala
wenzelm@64609
   178
  ../Tools/Graphview/tree_panel.scala
wenzelm@65138
   179
  ../Tools/VSCode/src/build_vscode.scala
wenzelm@64609
   180
  ../Tools/VSCode/src/channel.scala
wenzelm@64609
   181
  ../Tools/VSCode/src/document_model.scala
wenzelm@65191
   182
  ../Tools/VSCode/src/dynamic_output.scala
wenzelm@64738
   183
  ../Tools/VSCode/src/grammar.scala
wenzelm@66098
   184
  ../Tools/VSCode/src/preview_panel.scala
wenzelm@64609
   185
  ../Tools/VSCode/src/protocol.scala
wenzelm@64609
   186
  ../Tools/VSCode/src/server.scala
wenzelm@66098
   187
  ../Tools/VSCode/src/state_panel.scala
wenzelm@66211
   188
  ../Tools/VSCode/src/vscode_javascript.scala
wenzelm@64622
   189
  ../Tools/VSCode/src/vscode_rendering.scala
wenzelm@64623
   190
  ../Tools/VSCode/src/vscode_resources.scala
wenzelm@66141
   191
  ../Tools/VSCode/src/vscode_spell_checker.scala
wenzelm@43320
   192
)
wenzelm@43320
   193
wenzelm@34282
   194
wenzelm@34282
   195
## diagnostics
wenzelm@34282
   196
wenzelm@43280
   197
PRG="$(basename "$0")"
wenzelm@43280
   198
wenzelm@43280
   199
function usage()
wenzelm@43280
   200
{
wenzelm@43280
   201
  echo
wenzelm@43280
   202
  echo "Usage: isabelle $PRG [OPTIONS]"
wenzelm@43280
   203
  echo
wenzelm@43280
   204
  echo "  Options are:"
wenzelm@43280
   205
  echo "    -f           fresh build"
wenzelm@43280
   206
  echo
wenzelm@43280
   207
  exit 1
wenzelm@43280
   208
}
wenzelm@43280
   209
wenzelm@34282
   210
function fail()
wenzelm@34282
   211
{
wenzelm@34282
   212
  echo "$1" >&2
wenzelm@34282
   213
  exit 2
wenzelm@34282
   214
}
wenzelm@34282
   215
wenzelm@42899
   216
[ -z "$ISABELLE_HOME" ] && fail "Missing Isabelle settings environment"
wenzelm@34282
   217
wenzelm@34282
   218
wenzelm@43280
   219
## process command line
wenzelm@43280
   220
wenzelm@43280
   221
# options
wenzelm@43280
   222
wenzelm@43280
   223
FRESH=""
wenzelm@43280
   224
wenzelm@64370
   225
while getopts "f" OPT
wenzelm@43280
   226
do
wenzelm@43280
   227
  case "$OPT" in
wenzelm@43280
   228
    f)
wenzelm@43280
   229
      FRESH=true
wenzelm@43280
   230
      ;;
wenzelm@43280
   231
    \?)
wenzelm@43280
   232
      usage
wenzelm@43280
   233
      ;;
wenzelm@43280
   234
  esac
wenzelm@43280
   235
done
wenzelm@43280
   236
wenzelm@43280
   237
shift $(($OPTIND - 1))
wenzelm@43280
   238
wenzelm@43280
   239
wenzelm@43280
   240
# args
wenzelm@43280
   241
wenzelm@43280
   242
[ "$#" -ne 0 ] && usage
wenzelm@43280
   243
wenzelm@43280
   244
wenzelm@49558
   245
## build
wenzelm@34282
   246
wenzelm@34284
   247
TARGET_DIR="$ISABELLE_HOME/lib/classes"
wenzelm@53577
   248
TARGET="$TARGET_DIR/Pure.jar"
wenzelm@34282
   249
wenzelm@43405
   250
declare -a UPDATED=()
wenzelm@43405
   251
wenzelm@43280
   252
if [ -n "$FRESH" ]; then
wenzelm@43280
   253
  OUTDATED=true
wenzelm@43280
   254
else
wenzelm@43280
   255
  OUTDATED=false
wenzelm@43523
   256
  if [ ! -e "$TARGET" ]; then
wenzelm@43523
   257
    OUTDATED=true
wenzelm@43523
   258
  else
wenzelm@43405
   259
    for DEP in "${SOURCES[@]}"
wenzelm@43280
   260
    do
wenzelm@43405
   261
      [ ! -e "$DEP" ] && fail "Missing file: $DEP"
wenzelm@43523
   262
      [ "$DEP" -nt "$TARGET" ] && {
wenzelm@43523
   263
        OUTDATED=true
wenzelm@43523
   264
        UPDATED["${#UPDATED[@]}"]="$DEP"
wenzelm@43523
   265
      }
wenzelm@43280
   266
    done
wenzelm@43405
   267
  fi
wenzelm@43280
   268
fi
wenzelm@34282
   269
wenzelm@34284
   270
if [ "$OUTDATED" = true ]
wenzelm@34284
   271
then
wenzelm@49173
   272
  echo "### Building Isabelle/Scala ..."
wenzelm@34282
   273
wenzelm@43405
   274
  [ "${#UPDATED[@]}" -gt 0 ] && {
wenzelm@43405
   275
    echo "Changed files:"
wenzelm@43405
   276
    for FILE in "${UPDATED[@]}"
wenzelm@43405
   277
    do
wenzelm@43405
   278
      echo "  $FILE"
wenzelm@43405
   279
    done
wenzelm@43405
   280
  }
wenzelm@43405
   281
wenzelm@64375
   282
  rm -f "$TARGET"
wenzelm@34282
   283
  rm -rf classes && mkdir classes
wenzelm@45673
   284
wenzelm@64900
   285
  SCALAC_OPTIONS="$ISABELLE_SCALAC_OPTIONS -d classes"
wenzelm@45673
   286
wenzelm@50689
   287
  (
wenzelm@58791
   288
    classpath "$JAVA_HOME/lib/jfxrt.jar"
wenzelm@53576
   289
    classpath classes
wenzelm@61294
   290
    export CLASSPATH="$(platform_path "$ISABELLE_CLASSPATH")"
wenzelm@50689
   291
wenzelm@64370
   292
    isabelle_scala scalac $SCALAC_OPTIONS "${SOURCES[@]}" || \
wenzelm@64370
   293
      fail "Failed to compile sources"
wenzelm@51508
   294
  ) || exit "$?"
wenzelm@45673
   295
wenzelm@53577
   296
  mkdir -p "$TARGET_DIR" || fail "Failed to create directory $TARGET_DIR"
wenzelm@43280
   297
wenzelm@43285
   298
  pushd classes >/dev/null
wenzelm@43280
   299
wenzelm@43517
   300
  CHARSET_SERVICE="META-INF/services/java.nio.charset.spi.CharsetProvider"
wenzelm@43517
   301
  mkdir -p "$(dirname "$CHARSET_SERVICE")"
wenzelm@43517
   302
  echo isabelle.Isabelle_Charset_Provider > "$CHARSET_SERVICE"
wenzelm@43517
   303
wenzelm@54676
   304
  cp "$ISABELLE_HOME/lib/logo/isabelle_transparent-32.gif" isabelle/.
wenzelm@54709
   305
  cp "$ISABELLE_HOME/lib/logo/isabelle_transparent.gif" isabelle/.
wenzelm@53452
   306
wenzelm@61294
   307
  isabelle_jdk jar cfe "$(platform_path "$TARGET")" isabelle.Main META-INF isabelle || \
wenzelm@43523
   308
    fail "Failed to produce $TARGET"
wenzelm@34282
   309
wenzelm@43280
   310
  popd >/dev/null
wenzelm@43280
   311
wenzelm@34282
   312
  rm -rf classes
wenzelm@34282
   313
fi