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