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