lib/Tools/build
changeset 48425 0d95980e9aae
parent 48340 6f4fc030882a
child 48447 ef600ce4559c
     1.1 --- a/lib/Tools/build	Sun Jul 22 21:59:14 2012 +0200
     1.2 +++ b/lib/Tools/build	Sun Jul 22 23:31:57 2012 +0200
     1.3 @@ -18,8 +18,10 @@
     1.4    echo "    -a           all sessions"
     1.5    echo "    -b           build target images"
     1.6    echo "    -d DIR       additional session directory with ROOT file"
     1.7 +  echo "    -j INT       maximum number of jobs (default 1)"
     1.8    echo "    -l           list sessions only"
     1.9    echo "    -o OPTION    override session configuration OPTION (via NAME=VAL or NAME)"
    1.10 +  echo "    -v           verbose"
    1.11    echo
    1.12    echo "  Build and manage Isabelle sessions, depending on implicit"
    1.13    echo "  ISABELLE_BUILD_OPTIONS=\"$ISABELLE_BUILD_OPTIONS\""
    1.14 @@ -38,17 +40,24 @@
    1.15    exit 2
    1.16  }
    1.17  
    1.18 +function check_number()
    1.19 +{
    1.20 +  [ -n "$1" -a -z "$(echo "$1" | tr -d '[0-9]')" ] || fail "Bad number: \"$1\""
    1.21 +}
    1.22 +
    1.23  
    1.24  ## process command line
    1.25  
    1.26  ALL_SESSIONS=false
    1.27  BUILD_IMAGES=false
    1.28 +MAX_JOBS=1
    1.29  LIST_ONLY=false
    1.30 +VERBOSE=false
    1.31  
    1.32  declare -a MORE_DIRS=()
    1.33  eval "declare -a BUILD_OPTIONS=($ISABELLE_BUILD_OPTIONS)"
    1.34  
    1.35 -while getopts "abd:lo:" OPT
    1.36 +while getopts "abd:j:lo:v" OPT
    1.37  do
    1.38    case "$OPT" in
    1.39      a)
    1.40 @@ -60,12 +69,19 @@
    1.41      d)
    1.42        MORE_DIRS["${#MORE_DIRS[@]}"]="$OPTARG"
    1.43        ;;
    1.44 +    j)
    1.45 +      check_number "$OPTARG"
    1.46 +      MAX_JOBS="$OPTARG"
    1.47 +      ;;
    1.48      l)
    1.49        LIST_ONLY="true"
    1.50        ;;
    1.51      o)
    1.52        BUILD_OPTIONS["${#BUILD_OPTIONS[@]}"]="$OPTARG"
    1.53        ;;
    1.54 +    v)
    1.55 +      VERBOSE="true"
    1.56 +      ;;
    1.57      \?)
    1.58        usage
    1.59        ;;
    1.60 @@ -80,5 +96,5 @@
    1.61  [ -e "$ISABELLE_HOME/Admin/build" ] && { "$ISABELLE_HOME/Admin/build" jars || exit $?; }
    1.62  
    1.63  exec "$ISABELLE_TOOL" java isabelle.Build \
    1.64 -  "$ALL_SESSIONS" "$BUILD_IMAGES" "$LIST_ONLY" \
    1.65 +  "$ALL_SESSIONS" "$BUILD_IMAGES" "$MAX_JOBS" "$LIST_ONLY" "$VERBOSE" \
    1.66    "${MORE_DIRS[@]}" $'\n' "${BUILD_OPTIONS[@]}" $'\n' "$@"