src/Pure/build-jars
author wenzelm
Fri Aug 03 14:08:33 2018 +0200 (23 months ago)
changeset 68713 fb44580680c4
parent 68308 119fc05f6b00
child 68758 a110e7e24e55
permissions -rwxr-xr-x
Pure theory content;
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@64369
    26
  Admin/news.scala
wenzelm@64188
    27
  Admin/other_isabelle.scala
wenzelm@64161
    28
  Admin/remote_dmg.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@52971
    96
  PIDE/editor.scala
wenzelm@64611
    97
  PIDE/line.scala
wenzelm@45670
    98
  PIDE/markup.scala
wenzelm@43320
    99
  PIDE/markup_tree.scala
wenzelm@45709
   100
  PIDE/protocol.scala
wenzelm@65214
   101
  PIDE/protocol_handlers.scala
wenzelm@59713
   102
  PIDE/protocol_message.scala
wenzelm@56385
   103
  PIDE/prover.scala
wenzelm@52981
   104
  PIDE/query_operation.scala
wenzelm@64622
   105
  PIDE/rendering.scala
wenzelm@56208
   106
  PIDE/resources.scala
wenzelm@56210
   107
  PIDE/session.scala
wenzelm@43320
   108
  PIDE/text.scala
wenzelm@44698
   109
  PIDE/xml.scala
wenzelm@44698
   110
  PIDE/yxml.scala
wenzelm@57647
   111
  ROOT.scala
wenzelm@62584
   112
  System/bash.scala
wenzelm@61925
   113
  System/command_line.scala
wenzelm@61282
   114
  System/cygwin.scala
wenzelm@62845
   115
  System/distribution.scala
wenzelm@62431
   116
  System/getopts.scala
wenzelm@43744
   117
  System/invoke_scala.scala
wenzelm@43517
   118
  System/isabelle_charset.scala
wenzelm@43320
   119
  System/isabelle_process.scala
wenzelm@43320
   120
  System/isabelle_system.scala
wenzelm@62829
   121
  System/isabelle_tool.scala
wenzelm@64264
   122
  System/numa.scala
wenzelm@48365
   123
  System/options.scala
wenzelm@43320
   124
  System/platform.scala
wenzelm@56860
   125
  System/posix_interrupt.scala
wenzelm@62400
   126
  System/process_result.scala
wenzelm@61276
   127
  System/progress.scala
wenzelm@45027
   128
  System/system_channel.scala
wenzelm@67802
   129
  System/tty_loop.scala
wenzelm@67274
   130
  Thy/bibtex.scala
wenzelm@68092
   131
  Thy/export.scala
wenzelm@68171
   132
  Thy/export_theory.scala
wenzelm@43320
   133
  Thy/html.scala
wenzelm@67172
   134
  Thy/latex.scala
wenzelm@50707
   135
  Thy/present.scala
wenzelm@62631
   136
  Thy/sessions.scala
wenzelm@43320
   137
  Thy/thy_header.scala
wenzelm@67054
   138
  Thy/thy_resources.scala
wenzelm@43320
   139
  Thy/thy_syntax.scala
wenzelm@68308
   140
  Tools/dump.scala
wenzelm@57647
   141
  Tools/build.scala
wenzelm@66790
   142
  Tools/build_docker.scala
wenzelm@59891
   143
  Tools/check_keywords.scala
wenzelm@60749
   144
  Tools/debugger.scala
wenzelm@52444
   145
  Tools/doc.scala
wenzelm@65557
   146
  Tools/imports.scala
wenzelm@50687
   147
  Tools/main.scala
wenzelm@67041
   148
  Tools/mkroot.scala
wenzelm@56864
   149
  Tools/print_operation.scala
wenzelm@64342
   150
  Tools/profiling_report.scala
wenzelm@66347
   151
  Tools/server.scala
wenzelm@67848
   152
  Tools/server_commands.scala
wenzelm@54730
   153
  Tools/simplifier_trace.scala
wenzelm@65139
   154
  Tools/spell_checker.scala
wenzelm@50980
   155
  Tools/task_statistics.scala
wenzelm@58610
   156
  Tools/update_cartouches.scala
wenzelm@67433
   157
  Tools/update_comments.scala
wenzelm@58872
   158
  Tools/update_header.scala
wenzelm@61216
   159
  Tools/update_then.scala
wenzelm@61337
   160
  Tools/update_theorems.scala
wenzelm@43320
   161
  library.scala
wenzelm@68713
   162
  pure_thy.scala
wenzelm@43730
   163
  term.scala
wenzelm@43779
   164
  term_xml.scala
wenzelm@64609
   165
  ../Tools/Graphview/graph_file.scala
wenzelm@64609
   166
  ../Tools/Graphview/graph_panel.scala
wenzelm@64609
   167
  ../Tools/Graphview/graphview.scala
wenzelm@64609
   168
  ../Tools/Graphview/layout.scala
wenzelm@64609
   169
  ../Tools/Graphview/main_panel.scala
wenzelm@64609
   170
  ../Tools/Graphview/metrics.scala
wenzelm@64609
   171
  ../Tools/Graphview/model.scala
wenzelm@64609
   172
  ../Tools/Graphview/mutator.scala
wenzelm@64609
   173
  ../Tools/Graphview/mutator_dialog.scala
wenzelm@64609
   174
  ../Tools/Graphview/mutator_event.scala
wenzelm@64609
   175
  ../Tools/Graphview/popups.scala
wenzelm@64609
   176
  ../Tools/Graphview/shapes.scala
wenzelm@64609
   177
  ../Tools/Graphview/tree_panel.scala
wenzelm@65138
   178
  ../Tools/VSCode/src/build_vscode.scala
wenzelm@64609
   179
  ../Tools/VSCode/src/channel.scala
wenzelm@64609
   180
  ../Tools/VSCode/src/document_model.scala
wenzelm@65191
   181
  ../Tools/VSCode/src/dynamic_output.scala
wenzelm@64738
   182
  ../Tools/VSCode/src/grammar.scala
wenzelm@66098
   183
  ../Tools/VSCode/src/preview_panel.scala
wenzelm@64609
   184
  ../Tools/VSCode/src/protocol.scala
wenzelm@64609
   185
  ../Tools/VSCode/src/server.scala
wenzelm@66098
   186
  ../Tools/VSCode/src/state_panel.scala
wenzelm@66211
   187
  ../Tools/VSCode/src/vscode_javascript.scala
wenzelm@64622
   188
  ../Tools/VSCode/src/vscode_rendering.scala
wenzelm@64623
   189
  ../Tools/VSCode/src/vscode_resources.scala
wenzelm@66141
   190
  ../Tools/VSCode/src/vscode_spell_checker.scala
wenzelm@43320
   191
)
wenzelm@43320
   192
wenzelm@34282
   193
wenzelm@34282
   194
## diagnostics
wenzelm@34282
   195
wenzelm@43280
   196
PRG="$(basename "$0")"
wenzelm@43280
   197
wenzelm@43280
   198
function usage()
wenzelm@43280
   199
{
wenzelm@43280
   200
  echo
wenzelm@43280
   201
  echo "Usage: isabelle $PRG [OPTIONS]"
wenzelm@43280
   202
  echo
wenzelm@43280
   203
  echo "  Options are:"
wenzelm@43280
   204
  echo "    -f           fresh build"
wenzelm@43280
   205
  echo
wenzelm@43280
   206
  exit 1
wenzelm@43280
   207
}
wenzelm@43280
   208
wenzelm@34282
   209
function fail()
wenzelm@34282
   210
{
wenzelm@34282
   211
  echo "$1" >&2
wenzelm@34282
   212
  exit 2
wenzelm@34282
   213
}
wenzelm@34282
   214
wenzelm@42899
   215
[ -z "$ISABELLE_HOME" ] && fail "Missing Isabelle settings environment"
wenzelm@34282
   216
wenzelm@34282
   217
wenzelm@43280
   218
## process command line
wenzelm@43280
   219
wenzelm@43280
   220
# options
wenzelm@43280
   221
wenzelm@43280
   222
FRESH=""
wenzelm@43280
   223
wenzelm@64370
   224
while getopts "f" OPT
wenzelm@43280
   225
do
wenzelm@43280
   226
  case "$OPT" in
wenzelm@43280
   227
    f)
wenzelm@43280
   228
      FRESH=true
wenzelm@43280
   229
      ;;
wenzelm@43280
   230
    \?)
wenzelm@43280
   231
      usage
wenzelm@43280
   232
      ;;
wenzelm@43280
   233
  esac
wenzelm@43280
   234
done
wenzelm@43280
   235
wenzelm@43280
   236
shift $(($OPTIND - 1))
wenzelm@43280
   237
wenzelm@43280
   238
wenzelm@43280
   239
# args
wenzelm@43280
   240
wenzelm@43280
   241
[ "$#" -ne 0 ] && usage
wenzelm@43280
   242
wenzelm@43280
   243
wenzelm@49558
   244
## build
wenzelm@34282
   245
wenzelm@34284
   246
TARGET_DIR="$ISABELLE_HOME/lib/classes"
wenzelm@53577
   247
TARGET="$TARGET_DIR/Pure.jar"
wenzelm@34282
   248
wenzelm@43405
   249
declare -a UPDATED=()
wenzelm@43405
   250
wenzelm@43280
   251
if [ -n "$FRESH" ]; then
wenzelm@43280
   252
  OUTDATED=true
wenzelm@43280
   253
else
wenzelm@43280
   254
  OUTDATED=false
wenzelm@43523
   255
  if [ ! -e "$TARGET" ]; then
wenzelm@43523
   256
    OUTDATED=true
wenzelm@43523
   257
  else
wenzelm@43405
   258
    for DEP in "${SOURCES[@]}"
wenzelm@43280
   259
    do
wenzelm@43405
   260
      [ ! -e "$DEP" ] && fail "Missing file: $DEP"
wenzelm@43523
   261
      [ "$DEP" -nt "$TARGET" ] && {
wenzelm@43523
   262
        OUTDATED=true
wenzelm@43523
   263
        UPDATED["${#UPDATED[@]}"]="$DEP"
wenzelm@43523
   264
      }
wenzelm@43280
   265
    done
wenzelm@43405
   266
  fi
wenzelm@43280
   267
fi
wenzelm@34282
   268
wenzelm@34284
   269
if [ "$OUTDATED" = true ]
wenzelm@34284
   270
then
wenzelm@49173
   271
  echo "### Building Isabelle/Scala ..."
wenzelm@34282
   272
wenzelm@43405
   273
  [ "${#UPDATED[@]}" -gt 0 ] && {
wenzelm@43405
   274
    echo "Changed files:"
wenzelm@43405
   275
    for FILE in "${UPDATED[@]}"
wenzelm@43405
   276
    do
wenzelm@43405
   277
      echo "  $FILE"
wenzelm@43405
   278
    done
wenzelm@43405
   279
  }
wenzelm@43405
   280
wenzelm@64375
   281
  rm -f "$TARGET"
wenzelm@34282
   282
  rm -rf classes && mkdir classes
wenzelm@45673
   283
wenzelm@64900
   284
  SCALAC_OPTIONS="$ISABELLE_SCALAC_OPTIONS -d classes"
wenzelm@45673
   285
wenzelm@50689
   286
  (
wenzelm@58791
   287
    classpath "$JAVA_HOME/lib/jfxrt.jar"
wenzelm@53576
   288
    classpath classes
wenzelm@61294
   289
    export CLASSPATH="$(platform_path "$ISABELLE_CLASSPATH")"
wenzelm@50689
   290
wenzelm@64370
   291
    isabelle_scala scalac $SCALAC_OPTIONS "${SOURCES[@]}" || \
wenzelm@64370
   292
      fail "Failed to compile sources"
wenzelm@51508
   293
  ) || exit "$?"
wenzelm@45673
   294
wenzelm@53577
   295
  mkdir -p "$TARGET_DIR" || fail "Failed to create directory $TARGET_DIR"
wenzelm@43280
   296
wenzelm@43285
   297
  pushd classes >/dev/null
wenzelm@43280
   298
wenzelm@43517
   299
  CHARSET_SERVICE="META-INF/services/java.nio.charset.spi.CharsetProvider"
wenzelm@43517
   300
  mkdir -p "$(dirname "$CHARSET_SERVICE")"
wenzelm@43517
   301
  echo isabelle.Isabelle_Charset_Provider > "$CHARSET_SERVICE"
wenzelm@43517
   302
wenzelm@54676
   303
  cp "$ISABELLE_HOME/lib/logo/isabelle_transparent-32.gif" isabelle/.
wenzelm@54709
   304
  cp "$ISABELLE_HOME/lib/logo/isabelle_transparent.gif" isabelle/.
wenzelm@53452
   305
wenzelm@61294
   306
  isabelle_jdk jar cfe "$(platform_path "$TARGET")" isabelle.Main META-INF isabelle || \
wenzelm@43523
   307
    fail "Failed to produce $TARGET"
wenzelm@34282
   308
wenzelm@43280
   309
  popd >/dev/null
wenzelm@43280
   310
wenzelm@34282
   311
  rm -rf classes
wenzelm@34282
   312
fi