lib/Tools/scala_build
author wenzelm
Fri, 08 Dec 2023 13:36:47 +0100
changeset 79199 8b77c95ed36a
parent 78591 b1e0fb71435d
permissions -rwxr-xr-x
more operations;
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
74038
b4f57bfe82e7 more robust "isabelle build_scala" as separate tool;
wenzelm
parents:
diff changeset
     1
#!/usr/bin/env bash
b4f57bfe82e7 more robust "isabelle build_scala" as separate tool;
wenzelm
parents:
diff changeset
     2
#
b4f57bfe82e7 more robust "isabelle build_scala" as separate tool;
wenzelm
parents:
diff changeset
     3
# Author: Makarius
b4f57bfe82e7 more robust "isabelle build_scala" as separate tool;
wenzelm
parents:
diff changeset
     4
#
b4f57bfe82e7 more robust "isabelle build_scala" as separate tool;
wenzelm
parents:
diff changeset
     5
# DESCRIPTION: build Isabelle/Scala/Java components
b4f57bfe82e7 more robust "isabelle build_scala" as separate tool;
wenzelm
parents:
diff changeset
     6
b4f57bfe82e7 more robust "isabelle build_scala" as separate tool;
wenzelm
parents:
diff changeset
     7
## diagnostics
b4f57bfe82e7 more robust "isabelle build_scala" as separate tool;
wenzelm
parents:
diff changeset
     8
b4f57bfe82e7 more robust "isabelle build_scala" as separate tool;
wenzelm
parents:
diff changeset
     9
PRG="$(basename "$0")"
b4f57bfe82e7 more robust "isabelle build_scala" as separate tool;
wenzelm
parents:
diff changeset
    10
b4f57bfe82e7 more robust "isabelle build_scala" as separate tool;
wenzelm
parents:
diff changeset
    11
function usage()
b4f57bfe82e7 more robust "isabelle build_scala" as separate tool;
wenzelm
parents:
diff changeset
    12
{
b4f57bfe82e7 more robust "isabelle build_scala" as separate tool;
wenzelm
parents:
diff changeset
    13
  echo
b4f57bfe82e7 more robust "isabelle build_scala" as separate tool;
wenzelm
parents:
diff changeset
    14
  echo "Usage: isabelle $PRG [OPTIONS]"
b4f57bfe82e7 more robust "isabelle build_scala" as separate tool;
wenzelm
parents:
diff changeset
    15
  echo
b4f57bfe82e7 more robust "isabelle build_scala" as separate tool;
wenzelm
parents:
diff changeset
    16
  echo "  Options are:"
b4f57bfe82e7 more robust "isabelle build_scala" as separate tool;
wenzelm
parents:
diff changeset
    17
  echo "    -f           force fresh build"
b4f57bfe82e7 more robust "isabelle build_scala" as separate tool;
wenzelm
parents:
diff changeset
    18
  echo "    -q           quiet mode: suppress stdout/stderr"
b4f57bfe82e7 more robust "isabelle build_scala" as separate tool;
wenzelm
parents:
diff changeset
    19
  echo
74041
6bf9f94198a7 updated documentation on Isabelle/Scala;
wenzelm
parents: 74038
diff changeset
    20
  echo "  Build Isabelle/Scala/Java modules of all registered components"
6bf9f94198a7 updated documentation on Isabelle/Scala;
wenzelm
parents: 74038
diff changeset
    21
  echo "  (if required)."
6bf9f94198a7 updated documentation on Isabelle/Scala;
wenzelm
parents: 74038
diff changeset
    22
  echo
74038
b4f57bfe82e7 more robust "isabelle build_scala" as separate tool;
wenzelm
parents:
diff changeset
    23
  exit 1
b4f57bfe82e7 more robust "isabelle build_scala" as separate tool;
wenzelm
parents:
diff changeset
    24
}
b4f57bfe82e7 more robust "isabelle build_scala" as separate tool;
wenzelm
parents:
diff changeset
    25
b4f57bfe82e7 more robust "isabelle build_scala" as separate tool;
wenzelm
parents:
diff changeset
    26
b4f57bfe82e7 more robust "isabelle build_scala" as separate tool;
wenzelm
parents:
diff changeset
    27
## process command line
b4f57bfe82e7 more robust "isabelle build_scala" as separate tool;
wenzelm
parents:
diff changeset
    28
b4f57bfe82e7 more robust "isabelle build_scala" as separate tool;
wenzelm
parents:
diff changeset
    29
COMMAND="build"
b4f57bfe82e7 more robust "isabelle build_scala" as separate tool;
wenzelm
parents:
diff changeset
    30
QUIET=""
b4f57bfe82e7 more robust "isabelle build_scala" as separate tool;
wenzelm
parents:
diff changeset
    31
b4f57bfe82e7 more robust "isabelle build_scala" as separate tool;
wenzelm
parents:
diff changeset
    32
while getopts "fq" OPT
b4f57bfe82e7 more robust "isabelle build_scala" as separate tool;
wenzelm
parents:
diff changeset
    33
do
b4f57bfe82e7 more robust "isabelle build_scala" as separate tool;
wenzelm
parents:
diff changeset
    34
  case "$OPT" in
b4f57bfe82e7 more robust "isabelle build_scala" as separate tool;
wenzelm
parents:
diff changeset
    35
    f)
b4f57bfe82e7 more robust "isabelle build_scala" as separate tool;
wenzelm
parents:
diff changeset
    36
      COMMAND="build_fresh"
b4f57bfe82e7 more robust "isabelle build_scala" as separate tool;
wenzelm
parents:
diff changeset
    37
      ;;
b4f57bfe82e7 more robust "isabelle build_scala" as separate tool;
wenzelm
parents:
diff changeset
    38
    q)
b4f57bfe82e7 more robust "isabelle build_scala" as separate tool;
wenzelm
parents:
diff changeset
    39
      QUIET="true"
b4f57bfe82e7 more robust "isabelle build_scala" as separate tool;
wenzelm
parents:
diff changeset
    40
      ;;
b4f57bfe82e7 more robust "isabelle build_scala" as separate tool;
wenzelm
parents:
diff changeset
    41
    \?)
b4f57bfe82e7 more robust "isabelle build_scala" as separate tool;
wenzelm
parents:
diff changeset
    42
      usage
b4f57bfe82e7 more robust "isabelle build_scala" as separate tool;
wenzelm
parents:
diff changeset
    43
      ;;
b4f57bfe82e7 more robust "isabelle build_scala" as separate tool;
wenzelm
parents:
diff changeset
    44
  esac
b4f57bfe82e7 more robust "isabelle build_scala" as separate tool;
wenzelm
parents:
diff changeset
    45
done
b4f57bfe82e7 more robust "isabelle build_scala" as separate tool;
wenzelm
parents:
diff changeset
    46
b4f57bfe82e7 more robust "isabelle build_scala" as separate tool;
wenzelm
parents:
diff changeset
    47
shift $(($OPTIND - 1))
b4f57bfe82e7 more robust "isabelle build_scala" as separate tool;
wenzelm
parents:
diff changeset
    48
b4f57bfe82e7 more robust "isabelle build_scala" as separate tool;
wenzelm
parents:
diff changeset
    49
[ "$#" -ne 0 ] && usage
b4f57bfe82e7 more robust "isabelle build_scala" as separate tool;
wenzelm
parents:
diff changeset
    50
b4f57bfe82e7 more robust "isabelle build_scala" as separate tool;
wenzelm
parents:
diff changeset
    51
b4f57bfe82e7 more robust "isabelle build_scala" as separate tool;
wenzelm
parents:
diff changeset
    52
## main
b4f57bfe82e7 more robust "isabelle build_scala" as separate tool;
wenzelm
parents:
diff changeset
    53
76343
6a6f650cc5a2 more robust reset of CLASSPATH: unset variable means "." in certain situations, e.g. scalac;
wenzelm
parents: 74041
diff changeset
    54
classpath "$CLASSPATH"; export CLASSPATH=""
74038
b4f57bfe82e7 more robust "isabelle build_scala" as separate tool;
wenzelm
parents:
diff changeset
    55
b4f57bfe82e7 more robust "isabelle build_scala" as separate tool;
wenzelm
parents:
diff changeset
    56
eval "declare -a JAVA_ARGS=($ISABELLE_TOOL_JAVA_OPTIONS)"
b4f57bfe82e7 more robust "isabelle build_scala" as separate tool;
wenzelm
parents:
diff changeset
    57
b4f57bfe82e7 more robust "isabelle build_scala" as separate tool;
wenzelm
parents:
diff changeset
    58
JAVA_ARGS["${#JAVA_ARGS[@]}"]="-classpath"
b4f57bfe82e7 more robust "isabelle build_scala" as separate tool;
wenzelm
parents:
diff changeset
    59
JAVA_ARGS["${#JAVA_ARGS[@]}"]="$(platform_path "$ISABELLE_CLASSPATH")"
b4f57bfe82e7 more robust "isabelle build_scala" as separate tool;
wenzelm
parents:
diff changeset
    60
JAVA_ARGS["${#JAVA_ARGS[@]}"]="isabelle.setup.Setup"
b4f57bfe82e7 more robust "isabelle build_scala" as separate tool;
wenzelm
parents:
diff changeset
    61
JAVA_ARGS["${#JAVA_ARGS[@]}"]="$COMMAND"
b4f57bfe82e7 more robust "isabelle build_scala" as separate tool;
wenzelm
parents:
diff changeset
    62
b4f57bfe82e7 more robust "isabelle build_scala" as separate tool;
wenzelm
parents:
diff changeset
    63
if [ -z "$QUIET" ]; then
b4f57bfe82e7 more robust "isabelle build_scala" as separate tool;
wenzelm
parents:
diff changeset
    64
  isabelle_java java "${JAVA_ARGS[@]}"
b4f57bfe82e7 more robust "isabelle build_scala" as separate tool;
wenzelm
parents:
diff changeset
    65
else
b4f57bfe82e7 more robust "isabelle build_scala" as separate tool;
wenzelm
parents:
diff changeset
    66
  isabelle_java java "${JAVA_ARGS[@]}" > /dev/null 2> /dev/null
b4f57bfe82e7 more robust "isabelle build_scala" as separate tool;
wenzelm
parents:
diff changeset
    67
fi