lib/Tools/build_dialog
author wenzelm
Sat, 13 Jul 2013 21:02:41 +0200
changeset 52653 0589394aaaa5
parent 52443 725916b7dee5
permissions -rwxr-xr-x
merged

#!/usr/bin/env bash
#
# Author: Makarius
#
# DESCRIPTION: build Isabelle session images via GUI dialog


## diagnostics

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

function usage()
{
  echo
  echo "Usage: isabelle $PRG [OPTIONS]"
  echo
  echo "  Options are:"
  echo "    -L OPTION    default logic via system option"
  echo "    -d DIR       include session directory"
  echo "    -l NAME      logic session name"
  echo "    -s           system build mode: produce output in ISABELLE_HOME"
  echo
  echo "  Build Isabelle logic session image via GUI dialog (default: $ISABELLE_LOGIC)."
  echo
  exit 1
}

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


## process command line

LOGIC_OPTION=""
declare -a INCLUDE_DIRS=()
LOGIC=""
SYSTEM_MODE=false

while getopts "L:d:l:s" OPT
do
  case "$OPT" in
    L)
      LOGIC_OPTION="$OPTARG"
      ;;
    d)
      INCLUDE_DIRS["${#INCLUDE_DIRS[@]}"]="$OPTARG"
      ;;
    l)
      LOGIC="$OPTARG"
      ;;
    s)
      SYSTEM_MODE="true"
      ;;
    \?)
      usage
      ;;
  esac
done

shift $(($OPTIND - 1))


# args

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


## main

isabelle_admin_build jars || exit $?

"$ISABELLE_TOOL" java isabelle.Build_Dialog \
  "$LOGIC_OPTION" "$LOGIC" "$SYSTEM_MODE" "${INCLUDE_DIRS[@]}"