src/Pure/build-jars
author wenzelm
Thu Nov 22 23:11:12 2018 +0100 (19 months ago)
changeset 69330 6a33b12f8573
parent 69328 4646fcb59121
child 69338 0e3e66197a18
permissions -rwxr-xr-x
support for construction of Isabelle fonts;
     1 #!/usr/bin/env bash
     2 #
     3 # Author: Makarius
     4 #
     5 # build-jars - build Isabelle/Scala
     6 #
     7 # Requires proper Isabelle settings environment.
     8 
     9 ## sources
    10 
    11 declare -a SOURCES=(
    12   Admin/afp.scala
    13   Admin/build_cygwin.scala
    14   Admin/build_doc.scala
    15   Admin/build_history.scala
    16   Admin/build_jdk.scala
    17   Admin/build_log.scala
    18   Admin/build_polyml.scala
    19   Admin/build_release.scala
    20   Admin/build_status.scala
    21   Admin/check_sources.scala
    22   Admin/ci_profile.scala
    23   Admin/isabelle_cronjob.scala
    24   Admin/isabelle_devel.scala
    25   Admin/jenkins.scala
    26   Admin/other_isabelle.scala
    27   Admin/remote_dmg.scala
    28   Concurrent/consumer_thread.scala
    29   Concurrent/counter.scala
    30   Concurrent/event_timer.scala
    31   Concurrent/future.scala
    32   Concurrent/mailbox.scala
    33   Concurrent/par_list.scala
    34   Concurrent/standard_thread.scala
    35   Concurrent/synchronized.scala
    36   GUI/color_value.scala
    37   GUI/gui.scala
    38   GUI/gui_thread.scala
    39   GUI/popup.scala
    40   GUI/wrap_panel.scala
    41   General/antiquote.scala
    42   General/bytes.scala
    43   General/cache.scala
    44   General/codepoint.scala
    45   General/comment.scala
    46   General/completion.scala
    47   General/csv.scala
    48   General/date.scala
    49   General/exn.scala
    50   General/file.scala
    51   General/file_watcher.scala
    52   General/graph.scala
    53   General/graph_display.scala
    54   General/graphics_file.scala
    55   General/http.scala
    56   General/json.scala
    57   General/linear_set.scala
    58   General/logger.scala
    59   General/long_name.scala
    60   General/mercurial.scala
    61   General/multi_map.scala
    62   General/output.scala
    63   General/path.scala
    64   General/position.scala
    65   General/pretty.scala
    66   General/properties.scala
    67   General/scan.scala
    68   General/sha1.scala
    69   General/sql.scala
    70   General/ssh.scala
    71   General/symbol.scala
    72   General/time.scala
    73   General/timing.scala
    74   General/untyped.scala
    75   General/url.scala
    76   General/utf8.scala
    77   General/value.scala
    78   General/word.scala
    79   General/xz.scala
    80   Isar/document_structure.scala
    81   Isar/keyword.scala
    82   Isar/line_structure.scala
    83   Isar/outer_syntax.scala
    84   Isar/parse.scala
    85   Isar/token.scala
    86   ML/ml_console.scala
    87   ML/ml_lex.scala
    88   ML/ml_process.scala
    89   ML/ml_statistics.scala
    90   ML/ml_syntax.scala
    91   PIDE/command.scala
    92   PIDE/command_span.scala
    93   PIDE/document.scala
    94   PIDE/document_id.scala
    95   PIDE/document_status.scala
    96   PIDE/editor.scala
    97   PIDE/headless.scala
    98   PIDE/line.scala
    99   PIDE/markup.scala
   100   PIDE/markup_tree.scala
   101   PIDE/protocol.scala
   102   PIDE/protocol_handlers.scala
   103   PIDE/protocol_message.scala
   104   PIDE/prover.scala
   105   PIDE/query_operation.scala
   106   PIDE/rendering.scala
   107   PIDE/resources.scala
   108   PIDE/session.scala
   109   PIDE/text.scala
   110   PIDE/xml.scala
   111   PIDE/yxml.scala
   112   ROOT.scala
   113   System/bash.scala
   114   System/command_line.scala
   115   System/cygwin.scala
   116   System/distribution.scala
   117   System/getopts.scala
   118   System/invoke_scala.scala
   119   System/isabelle_charset.scala
   120   System/isabelle_process.scala
   121   System/isabelle_system.scala
   122   System/isabelle_tool.scala
   123   System/numa.scala
   124   System/options.scala
   125   System/platform.scala
   126   System/posix_interrupt.scala
   127   System/process_result.scala
   128   System/progress.scala
   129   System/system_channel.scala
   130   System/tty_loop.scala
   131   Thy/bibtex.scala
   132   Thy/export.scala
   133   Thy/export_theory.scala
   134   Thy/file_format.scala
   135   Thy/html.scala
   136   Thy/latex.scala
   137   Thy/present.scala
   138   Thy/sessions.scala
   139   Thy/thy_element.scala
   140   Thy/thy_header.scala
   141   Thy/thy_syntax.scala
   142   Tools/build.scala
   143   Tools/build_docker.scala
   144   Tools/check_keywords.scala
   145   Tools/debugger.scala
   146   Tools/doc.scala
   147   Tools/dump.scala
   148   Tools/fontforge.scala
   149   Tools/imports.scala
   150   Tools/isabelle_fonts.scala
   151   Tools/main.scala
   152   Tools/mkroot.scala
   153   Tools/print_operation.scala
   154   Tools/profiling_report.scala
   155   Tools/server.scala
   156   Tools/server_commands.scala
   157   Tools/simplifier_trace.scala
   158   Tools/spell_checker.scala
   159   Tools/task_statistics.scala
   160   Tools/update_cartouches.scala
   161   Tools/update_comments.scala
   162   Tools/update_header.scala
   163   Tools/update_then.scala
   164   Tools/update_theorems.scala
   165   library.scala
   166   pure_thy.scala
   167   term.scala
   168   term_xml.scala
   169   ../Tools/Graphview/graph_file.scala
   170   ../Tools/Graphview/graph_panel.scala
   171   ../Tools/Graphview/graphview.scala
   172   ../Tools/Graphview/layout.scala
   173   ../Tools/Graphview/main_panel.scala
   174   ../Tools/Graphview/metrics.scala
   175   ../Tools/Graphview/model.scala
   176   ../Tools/Graphview/mutator.scala
   177   ../Tools/Graphview/mutator_dialog.scala
   178   ../Tools/Graphview/mutator_event.scala
   179   ../Tools/Graphview/popups.scala
   180   ../Tools/Graphview/shapes.scala
   181   ../Tools/Graphview/tree_panel.scala
   182   ../Tools/VSCode/src/build_vscode.scala
   183   ../Tools/VSCode/src/channel.scala
   184   ../Tools/VSCode/src/document_model.scala
   185   ../Tools/VSCode/src/dynamic_output.scala
   186   ../Tools/VSCode/src/grammar.scala
   187   ../Tools/VSCode/src/preview_panel.scala
   188   ../Tools/VSCode/src/protocol.scala
   189   ../Tools/VSCode/src/server.scala
   190   ../Tools/VSCode/src/state_panel.scala
   191   ../Tools/VSCode/src/vscode_javascript.scala
   192   ../Tools/VSCode/src/vscode_rendering.scala
   193   ../Tools/VSCode/src/vscode_resources.scala
   194   ../Tools/VSCode/src/vscode_spell_checker.scala
   195 )
   196 
   197 
   198 ## diagnostics
   199 
   200 PRG="$(basename "$0")"
   201 
   202 function usage()
   203 {
   204   echo
   205   echo "Usage: isabelle $PRG [OPTIONS]"
   206   echo
   207   echo "  Options are:"
   208   echo "    -f           fresh build"
   209   echo
   210   exit 1
   211 }
   212 
   213 function fail()
   214 {
   215   echo "$1" >&2
   216   exit 2
   217 }
   218 
   219 [ -z "$ISABELLE_HOME" ] && fail "Missing Isabelle settings environment"
   220 
   221 
   222 ## process command line
   223 
   224 # options
   225 
   226 FRESH=""
   227 
   228 while getopts "f" OPT
   229 do
   230   case "$OPT" in
   231     f)
   232       FRESH=true
   233       ;;
   234     \?)
   235       usage
   236       ;;
   237   esac
   238 done
   239 
   240 shift $(($OPTIND - 1))
   241 
   242 
   243 # args
   244 
   245 [ "$#" -ne 0 ] && usage
   246 
   247 
   248 ## build
   249 
   250 TARGET_DIR="$ISABELLE_HOME/lib/classes"
   251 TARGET="$TARGET_DIR/Pure.jar"
   252 
   253 declare -a UPDATED=()
   254 
   255 if [ -n "$FRESH" ]; then
   256   OUTDATED=true
   257 else
   258   OUTDATED=false
   259   if [ ! -e "$TARGET" ]; then
   260     OUTDATED=true
   261   else
   262     for DEP in "${SOURCES[@]}"
   263     do
   264       [ ! -e "$DEP" ] && fail "Missing file: $DEP"
   265       [ "$DEP" -nt "$TARGET" ] && {
   266         OUTDATED=true
   267         UPDATED["${#UPDATED[@]}"]="$DEP"
   268       }
   269     done
   270   fi
   271 fi
   272 
   273 if [ "$OUTDATED" = true ]
   274 then
   275   echo "### Building Isabelle/Scala ..."
   276 
   277   [ "${#UPDATED[@]}" -gt 0 ] && {
   278     echo "Changed files:"
   279     for FILE in "${UPDATED[@]}"
   280     do
   281       echo "  $FILE"
   282     done
   283   }
   284 
   285   rm -f "$TARGET"
   286   rm -rf classes && mkdir classes
   287 
   288   SCALAC_OPTIONS="$ISABELLE_SCALAC_OPTIONS -d classes"
   289 
   290   (
   291     classpath classes
   292     export CLASSPATH="$(platform_path "$ISABELLE_CLASSPATH")"
   293 
   294     isabelle_scala scalac $SCALAC_OPTIONS "${SOURCES[@]}" || \
   295       fail "Failed to compile sources"
   296   ) || exit "$?"
   297 
   298   mkdir -p "$TARGET_DIR" || fail "Failed to create directory $TARGET_DIR"
   299 
   300   pushd classes >/dev/null
   301 
   302   CHARSET_SERVICE="META-INF/services/java.nio.charset.spi.CharsetProvider"
   303   mkdir -p "$(dirname "$CHARSET_SERVICE")"
   304   echo isabelle.Isabelle_Charset_Provider > "$CHARSET_SERVICE"
   305 
   306   cp "$ISABELLE_HOME/lib/logo/isabelle_transparent-32.gif" isabelle/.
   307   cp "$ISABELLE_HOME/lib/logo/isabelle_transparent.gif" isabelle/.
   308 
   309   isabelle_jdk jar cfe "$(platform_path "$TARGET")" isabelle.Main META-INF isabelle || \
   310     fail "Failed to produce $TARGET"
   311 
   312   popd >/dev/null
   313 
   314   rm -rf classes
   315 fi