Admin/build
author wenzelm
Thu, 15 Jul 2021 20:11:23 +0200
changeset 73993 3868fed3c34b
parent 73987 fc363a3b690a
child 74011 1d366486a812
permissions -rwxr-xr-x
more robust;

#!/usr/bin/env bash
#
# Administrative build for Isabelle source distribution.

## directory layout

if [ -z "$ISABELLE_HOME" ]; then
  unset CDPATH
  ISABELLE_HOME="$(cd "$(dirname "$0")"; cd "$(pwd -P)"; cd ..; pwd)"
  ISABELLE_TOOL="$ISABELLE_HOME/bin/isabelle"
fi


## diagnostics

PRG="$(basename "$0")"

function usage()
{
  cat <<EOF

Usage: $PRG [MODULES]

  Produce Isabelle distribution modules from current repository sources.
  The MODULES list may contain any of the following:

    all             all modules below
    browser         graph browser
    jars            Isabelle/Scala
    jars_fresh      fresh build of jars

EOF
  exit 1
}

function fail()
{
  echo "$1" >&2
  exit 2
}


## process command line

[ "$#" -eq 0 ] && usage

MODULES="$@"; shift "$#"


## modules

function build_all ()
{
  build_browser
  build_setup build
}


function build_browser ()
{
  pushd "$ISABELLE_HOME/lib/browser" >/dev/null
  "$ISABELLE_TOOL" env ./build || exit $?
  popd >/dev/null
}


function build_setup ()
{
  rm -rf \
    "$ISABELLE_HOME/lib/classes/Pure.jar" \
    "$ISABELLE_HOME/lib/classes/Pure.shasum" \
    "$ISABELLE_HOME/src/Tools/jEdit/dist"
  env ISABELLE_SETUP_CLASSPATH_SKIP=true "$ISABELLE_TOOL" java isabelle.setup.Setup "$@"
}


## main

for MODULE in $MODULES
do
  case $MODULE in
    all) build_all;;
    browser) build_browser;;
    jars) build_setup build;;
    jars_fresh) build_setup build_fresh;;
    *) fail "Bad module $MODULE"
  esac
done