src/Pure/build-jars
author wenzelm
Mon Oct 24 12:16:12 2016 +0200 (2016-10-24)
changeset 64370 865b39487b5d
parent 64369 6a9816764b37
child 64375 74a2af7c5145
permissions -rwxr-xr-x
discontinued unused / untested distinction of separate PIDE modules;
     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/build_doc.scala
    13   Admin/build_history.scala
    14   Admin/build_log.scala
    15   Admin/build_release.scala
    16   Admin/build_stats.scala
    17   Admin/check_sources.scala
    18   Admin/ci_api.scala
    19   Admin/ci_profile.scala
    20   Admin/isabelle_cronjob.scala
    21   Admin/news.scala
    22   Admin/other_isabelle.scala
    23   Admin/remote_dmg.scala
    24   Concurrent/consumer_thread.scala
    25   Concurrent/counter.scala
    26   Concurrent/event_timer.scala
    27   Concurrent/future.scala
    28   Concurrent/mailbox.scala
    29   Concurrent/par_list.scala
    30   Concurrent/standard_thread.scala
    31   Concurrent/synchronized.scala
    32   GUI/color_value.scala
    33   GUI/gui.scala
    34   GUI/gui_thread.scala
    35   GUI/html5_panel.scala
    36   GUI/jfx_gui.scala
    37   GUI/popup.scala
    38   GUI/wrap_panel.scala
    39   General/antiquote.scala
    40   General/bytes.scala
    41   General/completion.scala
    42   General/date.scala
    43   General/exn.scala
    44   General/file.scala
    45   General/graph.scala
    46   General/graph_display.scala
    47   General/graphics_file.scala
    48   General/http_server.scala
    49   General/json.scala
    50   General/linear_set.scala
    51   General/long_name.scala
    52   General/mercurial.scala
    53   General/multi_map.scala
    54   General/output.scala
    55   General/path.scala
    56   General/position.scala
    57   General/pretty.scala
    58   General/properties.scala
    59   General/scan.scala
    60   General/sha1.scala
    61   General/sql.scala
    62   General/sqlite.scala
    63   General/ssh.scala
    64   General/symbol.scala
    65   General/time.scala
    66   General/timing.scala
    67   General/untyped.scala
    68   General/url.scala
    69   General/value.scala
    70   General/word.scala
    71   General/xz.scala
    72   Isar/document_structure.scala
    73   Isar/keyword.scala
    74   Isar/line_structure.scala
    75   Isar/outer_syntax.scala
    76   Isar/parse.scala
    77   Isar/token.scala
    78   ML/ml_lex.scala
    79   ML/ml_syntax.scala
    80   PIDE/batch_session.scala
    81   PIDE/command.scala
    82   PIDE/command_span.scala
    83   PIDE/document.scala
    84   PIDE/document_id.scala
    85   PIDE/editor.scala
    86   PIDE/markup.scala
    87   PIDE/markup_tree.scala
    88   PIDE/protocol.scala
    89   PIDE/protocol_message.scala
    90   PIDE/prover.scala
    91   PIDE/query_operation.scala
    92   PIDE/resources.scala
    93   PIDE/session.scala
    94   PIDE/text.scala
    95   PIDE/xml.scala
    96   PIDE/yxml.scala
    97   ROOT.scala
    98   System/bash.scala
    99   System/command_line.scala
   100   System/cygwin.scala
   101   System/distribution.scala
   102   System/getopts.scala
   103   System/invoke_scala.scala
   104   System/isabelle_charset.scala
   105   System/isabelle_process.scala
   106   System/isabelle_system.scala
   107   System/isabelle_tool.scala
   108   System/numa.scala
   109   System/options.scala
   110   System/platform.scala
   111   System/posix_interrupt.scala
   112   System/process_result.scala
   113   System/progress.scala
   114   System/system_channel.scala
   115   System/utf8.scala
   116   Thy/html.scala
   117   Thy/present.scala
   118   Thy/sessions.scala
   119   Thy/thy_header.scala
   120   Thy/thy_info.scala
   121   Thy/thy_syntax.scala
   122   Tools/bibtex.scala
   123   Tools/build.scala
   124   Tools/check_keywords.scala
   125   Tools/debugger.scala
   126   Tools/doc.scala
   127   Tools/main.scala
   128   Tools/ml_console.scala
   129   Tools/ml_process.scala
   130   Tools/ml_statistics.scala
   131   Tools/print_operation.scala
   132   Tools/profiling_report.scala
   133   Tools/simplifier_trace.scala
   134   Tools/task_statistics.scala
   135   Tools/update_cartouches.scala
   136   Tools/update_header.scala
   137   Tools/update_then.scala
   138   Tools/update_theorems.scala
   139   library.scala
   140   term.scala
   141   term_xml.scala
   142   "../Tools/Graphview/graph_file.scala"
   143   "../Tools/Graphview/graph_panel.scala"
   144   "../Tools/Graphview/graphview.scala"
   145   "../Tools/Graphview/layout.scala"
   146   "../Tools/Graphview/main_panel.scala"
   147   "../Tools/Graphview/metrics.scala"
   148   "../Tools/Graphview/model.scala"
   149   "../Tools/Graphview/mutator.scala"
   150   "../Tools/Graphview/mutator_dialog.scala"
   151   "../Tools/Graphview/mutator_event.scala"
   152   "../Tools/Graphview/popups.scala"
   153   "../Tools/Graphview/shapes.scala"
   154   "../Tools/Graphview/tree_panel.scala"
   155 )
   156 
   157 
   158 ## diagnostics
   159 
   160 PRG="$(basename "$0")"
   161 
   162 function usage()
   163 {
   164   echo
   165   echo "Usage: isabelle $PRG [OPTIONS]"
   166   echo
   167   echo "  Options are:"
   168   echo "    -f           fresh build"
   169   echo
   170   exit 1
   171 }
   172 
   173 function fail()
   174 {
   175   echo "$1" >&2
   176   exit 2
   177 }
   178 
   179 [ -z "$ISABELLE_HOME" ] && fail "Missing Isabelle settings environment"
   180 
   181 
   182 ## process command line
   183 
   184 # options
   185 
   186 FRESH=""
   187 
   188 while getopts "f" OPT
   189 do
   190   case "$OPT" in
   191     f)
   192       FRESH=true
   193       ;;
   194     \?)
   195       usage
   196       ;;
   197   esac
   198 done
   199 
   200 shift $(($OPTIND - 1))
   201 
   202 
   203 # args
   204 
   205 [ "$#" -ne 0 ] && usage
   206 
   207 
   208 ## build
   209 
   210 TARGET_DIR="$ISABELLE_HOME/lib/classes"
   211 TARGET="$TARGET_DIR/Pure.jar"
   212 
   213 declare -a UPDATED=()
   214 
   215 if [ -n "$FRESH" ]; then
   216   OUTDATED=true
   217 else
   218   OUTDATED=false
   219   if [ ! -e "$TARGET" ]; then
   220     OUTDATED=true
   221   else
   222     for DEP in "${SOURCES[@]}"
   223     do
   224       [ ! -e "$DEP" ] && fail "Missing file: $DEP"
   225       [ "$DEP" -nt "$TARGET" ] && {
   226         OUTDATED=true
   227         UPDATED["${#UPDATED[@]}"]="$DEP"
   228       }
   229     done
   230   fi
   231 fi
   232 
   233 if [ "$OUTDATED" = true ]
   234 then
   235   echo "### Building Isabelle/Scala ..."
   236 
   237   [ "${#UPDATED[@]}" -gt 0 ] && {
   238     echo "Changed files:"
   239     for FILE in "${UPDATED[@]}"
   240     do
   241       echo "  $FILE"
   242     done
   243   }
   244 
   245   rm -rf classes && mkdir classes
   246 
   247   SCALAC_OPTIONS="$ISABELLE_SCALA_BUILD_OPTIONS -d classes"
   248 
   249   (
   250     classpath "$JAVA_HOME/lib/jfxrt.jar"
   251     classpath classes
   252     export CLASSPATH="$(platform_path "$ISABELLE_CLASSPATH")"
   253 
   254     isabelle_scala scalac $SCALAC_OPTIONS "${SOURCES[@]}" || \
   255       fail "Failed to compile sources"
   256   ) || exit "$?"
   257 
   258   mkdir -p "$TARGET_DIR" || fail "Failed to create directory $TARGET_DIR"
   259 
   260   pushd classes >/dev/null
   261 
   262   CHARSET_SERVICE="META-INF/services/java.nio.charset.spi.CharsetProvider"
   263   mkdir -p "$(dirname "$CHARSET_SERVICE")"
   264   echo isabelle.Isabelle_Charset_Provider > "$CHARSET_SERVICE"
   265 
   266   cp "$ISABELLE_HOME/lib/logo/isabelle_transparent-32.gif" isabelle/.
   267   cp "$ISABELLE_HOME/lib/logo/isabelle_transparent.gif" isabelle/.
   268 
   269   isabelle_jdk jar cfe "$(platform_path "$TARGET")" isabelle.Main META-INF isabelle || \
   270     fail "Failed to produce $TARGET"
   271 
   272   popd >/dev/null
   273 
   274   rm -rf classes
   275 fi