src/Pure/build-jars
author wenzelm
Sun Oct 16 20:19:10 2016 +0200 (2016-10-16)
changeset 64264 42138702d6ec
parent 64202 967515846691
child 64311 3d5e7719e878
permissions -rwxr-xr-x
support for Non-Uniform Memory Access of separate CPU nodes;
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@64161
    12
  Admin/build_doc.scala
wenzelm@64160
    13
  Admin/build_history.scala
wenzelm@64160
    14
  Admin/build_log.scala
wenzelm@64202
    15
  Admin/build_release.scala
wenzelm@64161
    16
  Admin/build_stats.scala
wenzelm@64161
    17
  Admin/check_sources.scala
wenzelm@64160
    18
  Admin/ci_api.scala
wenzelm@64160
    19
  Admin/ci_profile.scala
wenzelm@64148
    20
  Admin/isabelle_cronjob.scala
wenzelm@64188
    21
  Admin/other_isabelle.scala
wenzelm@64161
    22
  Admin/remote_dmg.scala
wenzelm@56695
    23
  Concurrent/consumer_thread.scala
wenzelm@43660
    24
  Concurrent/counter.scala
wenzelm@56768
    25
  Concurrent/event_timer.scala
wenzelm@43320
    26
  Concurrent/future.scala
wenzelm@56693
    27
  Concurrent/mailbox.scala
wenzelm@59136
    28
  Concurrent/par_list.scala
wenzelm@61556
    29
  Concurrent/standard_thread.scala
wenzelm@56685
    30
  Concurrent/synchronized.scala
wenzelm@57647
    31
  GUI/color_value.scala
wenzelm@57647
    32
  GUI/gui.scala
wenzelm@57647
    33
  GUI/gui_thread.scala
wenzelm@57647
    34
  GUI/html5_panel.scala
wenzelm@57908
    35
  GUI/jfx_gui.scala
wenzelm@57647
    36
  GUI/popup.scala
wenzelm@57647
    37
  GUI/wrap_panel.scala
wenzelm@55511
    38
  General/antiquote.scala
wenzelm@54439
    39
  General/bytes.scala
wenzelm@55673
    40
  General/completion.scala
wenzelm@64056
    41
  General/date.scala
wenzelm@62508
    42
  General/exn.scala
wenzelm@48411
    43
  General/file.scala
wenzelm@46611
    44
  General/graph.scala
wenzelm@59244
    45
  General/graph_display.scala
wenzelm@51098
    46
  General/graphics_file.scala
wenzelm@63823
    47
  General/http_server.scala
wenzelm@63644
    48
  General/json.scala
wenzelm@43320
    49
  General/linear_set.scala
wenzelm@56800
    50
  General/long_name.scala
wenzelm@63997
    51
  General/mercurial.scala
wenzelm@52975
    52
  General/multi_map.scala
wenzelm@56782
    53
  General/output.scala
wenzelm@43600
    54
  General/path.scala
wenzelm@43320
    55
  General/position.scala
wenzelm@43320
    56
  General/pretty.scala
wenzelm@43780
    57
  General/properties.scala
wenzelm@43320
    58
  General/scan.scala
wenzelm@43320
    59
  General/sha1.scala
wenzelm@63788
    60
  General/sql.scala
wenzelm@63788
    61
  General/sqlite.scala
wenzelm@64123
    62
  General/ssh.scala
wenzelm@43320
    63
  General/symbol.scala
wenzelm@45674
    64
  General/time.scala
wenzelm@45666
    65
  General/timing.scala
wenzelm@57647
    66
  General/untyped.scala
wenzelm@56501
    67
  General/url.scala
wenzelm@63805
    68
  General/value.scala
wenzelm@56599
    69
  General/word.scala
wenzelm@64000
    70
  General/xz.scala
wenzelm@63604
    71
  Isar/document_structure.scala
wenzelm@43320
    72
  Isar/keyword.scala
wenzelm@63603
    73
  Isar/line_structure.scala
wenzelm@43320
    74
  Isar/outer_syntax.scala
wenzelm@43320
    75
  Isar/parse.scala
wenzelm@43320
    76
  Isar/token.scala
wenzelm@55497
    77
  ML/ml_lex.scala
wenzelm@62528
    78
  ML/ml_syntax.scala
wenzelm@59362
    79
  PIDE/batch_session.scala
wenzelm@43320
    80
  PIDE/command.scala
wenzelm@57905
    81
  PIDE/command_span.scala
wenzelm@43320
    82
  PIDE/document.scala
wenzelm@52530
    83
  PIDE/document_id.scala
wenzelm@52971
    84
  PIDE/editor.scala
wenzelm@45670
    85
  PIDE/markup.scala
wenzelm@43320
    86
  PIDE/markup_tree.scala
wenzelm@45709
    87
  PIDE/protocol.scala
wenzelm@59713
    88
  PIDE/protocol_message.scala
wenzelm@56385
    89
  PIDE/prover.scala
wenzelm@52981
    90
  PIDE/query_operation.scala
wenzelm@56208
    91
  PIDE/resources.scala
wenzelm@56210
    92
  PIDE/session.scala
wenzelm@43320
    93
  PIDE/text.scala
wenzelm@44698
    94
  PIDE/xml.scala
wenzelm@44698
    95
  PIDE/yxml.scala
wenzelm@57647
    96
  ROOT.scala
wenzelm@62584
    97
  System/bash.scala
wenzelm@61925
    98
  System/command_line.scala
wenzelm@61282
    99
  System/cygwin.scala
wenzelm@62845
   100
  System/distribution.scala
wenzelm@62431
   101
  System/getopts.scala
wenzelm@43744
   102
  System/invoke_scala.scala
wenzelm@43517
   103
  System/isabelle_charset.scala
wenzelm@43320
   104
  System/isabelle_process.scala
wenzelm@43320
   105
  System/isabelle_system.scala
wenzelm@62829
   106
  System/isabelle_tool.scala
wenzelm@64264
   107
  System/numa.scala
wenzelm@48365
   108
  System/options.scala
wenzelm@43320
   109
  System/platform.scala
wenzelm@56860
   110
  System/posix_interrupt.scala
wenzelm@62400
   111
  System/process_result.scala
wenzelm@61276
   112
  System/progress.scala
wenzelm@45027
   113
  System/system_channel.scala
wenzelm@50203
   114
  System/utf8.scala
wenzelm@43320
   115
  Thy/html.scala
wenzelm@50707
   116
  Thy/present.scala
wenzelm@62631
   117
  Thy/sessions.scala
wenzelm@43320
   118
  Thy/thy_header.scala
wenzelm@43651
   119
  Thy/thy_info.scala
wenzelm@43320
   120
  Thy/thy_syntax.scala
wenzelm@58523
   121
  Tools/bibtex.scala
wenzelm@57647
   122
  Tools/build.scala
wenzelm@59891
   123
  Tools/check_keywords.scala
wenzelm@60749
   124
  Tools/debugger.scala
wenzelm@52444
   125
  Tools/doc.scala
wenzelm@50687
   126
  Tools/main.scala
wenzelm@62559
   127
  Tools/ml_console.scala
wenzelm@62586
   128
  Tools/ml_process.scala
wenzelm@50981
   129
  Tools/ml_statistics.scala
wenzelm@62114
   130
  Tools/news.scala
wenzelm@56864
   131
  Tools/print_operation.scala
wenzelm@54730
   132
  Tools/simplifier_trace.scala
wenzelm@50980
   133
  Tools/task_statistics.scala
wenzelm@58610
   134
  Tools/update_cartouches.scala
wenzelm@58872
   135
  Tools/update_header.scala
wenzelm@61216
   136
  Tools/update_then.scala
wenzelm@61337
   137
  Tools/update_theorems.scala
wenzelm@43320
   138
  library.scala
wenzelm@43730
   139
  term.scala
wenzelm@43779
   140
  term_xml.scala
wenzelm@59441
   141
  "../Tools/Graphview/graph_file.scala"
wenzelm@59202
   142
  "../Tools/Graphview/graph_panel.scala"
wenzelm@59459
   143
  "../Tools/Graphview/graphview.scala"
wenzelm@59232
   144
  "../Tools/Graphview/layout.scala"
wenzelm@59202
   145
  "../Tools/Graphview/main_panel.scala"
wenzelm@59290
   146
  "../Tools/Graphview/metrics.scala"
wenzelm@59202
   147
  "../Tools/Graphview/model.scala"
wenzelm@59392
   148
  "../Tools/Graphview/mutator.scala"
wenzelm@59202
   149
  "../Tools/Graphview/mutator_dialog.scala"
wenzelm@59202
   150
  "../Tools/Graphview/mutator_event.scala"
wenzelm@59202
   151
  "../Tools/Graphview/popups.scala"
wenzelm@59202
   152
  "../Tools/Graphview/shapes.scala"
wenzelm@59392
   153
  "../Tools/Graphview/tree_panel.scala"
wenzelm@43320
   154
)
wenzelm@43320
   155
wenzelm@34282
   156
wenzelm@34282
   157
## diagnostics
wenzelm@34282
   158
wenzelm@43280
   159
PRG="$(basename "$0")"
wenzelm@43280
   160
wenzelm@43280
   161
function usage()
wenzelm@43280
   162
{
wenzelm@43280
   163
  echo
wenzelm@43280
   164
  echo "Usage: isabelle $PRG [OPTIONS]"
wenzelm@43280
   165
  echo
wenzelm@43280
   166
  echo "  Options are:"
wenzelm@43280
   167
  echo "    -f           fresh build"
wenzelm@47408
   168
  echo "    -t           test separate compilation of PIDE"
wenzelm@43280
   169
  echo
wenzelm@43280
   170
  exit 1
wenzelm@43280
   171
}
wenzelm@43280
   172
wenzelm@34282
   173
function fail()
wenzelm@34282
   174
{
wenzelm@34282
   175
  echo "$1" >&2
wenzelm@34282
   176
  exit 2
wenzelm@34282
   177
}
wenzelm@34282
   178
wenzelm@42899
   179
[ -z "$ISABELLE_HOME" ] && fail "Missing Isabelle settings environment"
wenzelm@34282
   180
wenzelm@34282
   181
wenzelm@43280
   182
## process command line
wenzelm@43280
   183
wenzelm@43280
   184
# options
wenzelm@43280
   185
wenzelm@43280
   186
FRESH=""
wenzelm@47408
   187
TEST_PIDE=""
wenzelm@43280
   188
wenzelm@47408
   189
while getopts "ft" OPT
wenzelm@43280
   190
do
wenzelm@43280
   191
  case "$OPT" in
wenzelm@43280
   192
    f)
wenzelm@43280
   193
      FRESH=true
wenzelm@43280
   194
      ;;
wenzelm@47408
   195
    t)
wenzelm@47408
   196
      TEST_PIDE=true
wenzelm@47408
   197
      ;;
wenzelm@43280
   198
    \?)
wenzelm@43280
   199
      usage
wenzelm@43280
   200
      ;;
wenzelm@43280
   201
  esac
wenzelm@43280
   202
done
wenzelm@43280
   203
wenzelm@43280
   204
shift $(($OPTIND - 1))
wenzelm@43280
   205
wenzelm@43280
   206
wenzelm@43280
   207
# args
wenzelm@43280
   208
wenzelm@43280
   209
[ "$#" -ne 0 ] && usage
wenzelm@43280
   210
wenzelm@43280
   211
wenzelm@49558
   212
## build
wenzelm@34282
   213
wenzelm@34284
   214
TARGET_DIR="$ISABELLE_HOME/lib/classes"
wenzelm@53577
   215
TARGET="$TARGET_DIR/Pure.jar"
wenzelm@34282
   216
wenzelm@45673
   217
declare -a PIDE_SOURCES=()
wenzelm@45673
   218
declare -a PURE_SOURCES=()
wenzelm@45673
   219
wenzelm@45673
   220
for DEP in "${SOURCES[@]}"
wenzelm@45673
   221
do
wenzelm@45673
   222
  if grep "Module:.*PIDE" "$DEP" >/dev/null
wenzelm@45673
   223
  then
wenzelm@45673
   224
    PIDE_SOURCES["${#PIDE_SOURCES[@]}"]="$DEP"
wenzelm@45673
   225
  else
wenzelm@45673
   226
    PURE_SOURCES["${#PURE_SOURCES[@]}"]="$DEP"
wenzelm@45673
   227
  fi
wenzelm@45673
   228
done
wenzelm@45673
   229
wenzelm@43405
   230
declare -a UPDATED=()
wenzelm@43405
   231
wenzelm@43280
   232
if [ -n "$FRESH" ]; then
wenzelm@43280
   233
  OUTDATED=true
wenzelm@43280
   234
else
wenzelm@43280
   235
  OUTDATED=false
wenzelm@43523
   236
  if [ ! -e "$TARGET" ]; then
wenzelm@43523
   237
    OUTDATED=true
wenzelm@43523
   238
  else
wenzelm@43405
   239
    for DEP in "${SOURCES[@]}"
wenzelm@43280
   240
    do
wenzelm@43405
   241
      [ ! -e "$DEP" ] && fail "Missing file: $DEP"
wenzelm@43523
   242
      [ "$DEP" -nt "$TARGET" ] && {
wenzelm@43523
   243
        OUTDATED=true
wenzelm@43523
   244
        UPDATED["${#UPDATED[@]}"]="$DEP"
wenzelm@43523
   245
      }
wenzelm@43280
   246
    done
wenzelm@43405
   247
  fi
wenzelm@43280
   248
fi
wenzelm@34282
   249
wenzelm@34284
   250
if [ "$OUTDATED" = true ]
wenzelm@34284
   251
then
wenzelm@49173
   252
  echo "### Building Isabelle/Scala ..."
wenzelm@34282
   253
wenzelm@43405
   254
  [ "${#UPDATED[@]}" -gt 0 ] && {
wenzelm@43405
   255
    echo "Changed files:"
wenzelm@43405
   256
    for FILE in "${UPDATED[@]}"
wenzelm@43405
   257
    do
wenzelm@43405
   258
      echo "  $FILE"
wenzelm@43405
   259
    done
wenzelm@43405
   260
  }
wenzelm@43405
   261
wenzelm@34282
   262
  rm -rf classes && mkdir classes
wenzelm@45673
   263
wenzelm@47009
   264
  SCALAC_OPTIONS="$ISABELLE_SCALA_BUILD_OPTIONS -d classes"
wenzelm@45673
   265
wenzelm@50689
   266
  (
wenzelm@58791
   267
    classpath "$JAVA_HOME/lib/jfxrt.jar"
wenzelm@53576
   268
    classpath classes
wenzelm@61294
   269
    export CLASSPATH="$(platform_path "$ISABELLE_CLASSPATH")"
wenzelm@50689
   270
wenzelm@50689
   271
    if [ "$TEST_PIDE" = true ]; then
wenzelm@50689
   272
      isabelle_scala scalac $SCALAC_OPTIONS "${PIDE_SOURCES[@]}" || \
wenzelm@50689
   273
        fail "Failed to compile PIDE sources"
wenzelm@50689
   274
      isabelle_scala scalac $SCALAC_OPTIONS "${PURE_SOURCES[@]}" || \
wenzelm@50689
   275
        fail "Failed to compile Pure sources"
wenzelm@50689
   276
    else
wenzelm@50689
   277
      isabelle_scala scalac $SCALAC_OPTIONS "${PIDE_SOURCES[@]}" "${PURE_SOURCES[@]}" || \
wenzelm@50689
   278
        fail "Failed to compile sources"
wenzelm@50689
   279
    fi
wenzelm@51508
   280
  ) || exit "$?"
wenzelm@45673
   281
wenzelm@53577
   282
  mkdir -p "$TARGET_DIR" || fail "Failed to create directory $TARGET_DIR"
wenzelm@43280
   283
wenzelm@43285
   284
  pushd classes >/dev/null
wenzelm@43280
   285
wenzelm@43517
   286
  CHARSET_SERVICE="META-INF/services/java.nio.charset.spi.CharsetProvider"
wenzelm@43517
   287
  mkdir -p "$(dirname "$CHARSET_SERVICE")"
wenzelm@43517
   288
  echo isabelle.Isabelle_Charset_Provider > "$CHARSET_SERVICE"
wenzelm@43517
   289
wenzelm@54676
   290
  cp "$ISABELLE_HOME/lib/logo/isabelle_transparent-32.gif" isabelle/.
wenzelm@54709
   291
  cp "$ISABELLE_HOME/lib/logo/isabelle_transparent.gif" isabelle/.
wenzelm@53452
   292
wenzelm@61294
   293
  isabelle_jdk jar cfe "$(platform_path "$TARGET")" isabelle.Main META-INF isabelle || \
wenzelm@43523
   294
    fail "Failed to produce $TARGET"
wenzelm@34282
   295
wenzelm@43280
   296
  popd >/dev/null
wenzelm@43280
   297
wenzelm@34282
   298
  rm -rf classes
wenzelm@34282
   299
fi