lib/scripts/java_ext_dirs
author noschinl
Fri, 16 Sep 2011 20:02:35 +0200
changeset 44940 56fd289398a2
parent 43536 6eec653d5599
permissions -rwxr-xr-x
tune indenting
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
43518
7cad71ca9bcc augment Java extension directories;
wenzelm
parents:
diff changeset
     1
#!/usr/bin/env bash
7cad71ca9bcc augment Java extension directories;
wenzelm
parents:
diff changeset
     2
#
7cad71ca9bcc augment Java extension directories;
wenzelm
parents:
diff changeset
     3
# Author: Makarius
7cad71ca9bcc augment Java extension directories;
wenzelm
parents:
diff changeset
     4
#
7cad71ca9bcc augment Java extension directories;
wenzelm
parents:
diff changeset
     5
# Augment Java extension directories.
7cad71ca9bcc augment Java extension directories;
wenzelm
parents:
diff changeset
     6
7cad71ca9bcc augment Java extension directories;
wenzelm
parents:
diff changeset
     7
## diagnostics
7cad71ca9bcc augment Java extension directories;
wenzelm
parents:
diff changeset
     8
7cad71ca9bcc augment Java extension directories;
wenzelm
parents:
diff changeset
     9
function fail()
7cad71ca9bcc augment Java extension directories;
wenzelm
parents:
diff changeset
    10
{
7cad71ca9bcc augment Java extension directories;
wenzelm
parents:
diff changeset
    11
  echo "$1" >&2
7cad71ca9bcc augment Java extension directories;
wenzelm
parents:
diff changeset
    12
  exit 2
7cad71ca9bcc augment Java extension directories;
wenzelm
parents:
diff changeset
    13
}
7cad71ca9bcc augment Java extension directories;
wenzelm
parents:
diff changeset
    14
7cad71ca9bcc augment Java extension directories;
wenzelm
parents:
diff changeset
    15
7cad71ca9bcc augment Java extension directories;
wenzelm
parents:
diff changeset
    16
## dependencies
7cad71ca9bcc augment Java extension directories;
wenzelm
parents:
diff changeset
    17
7cad71ca9bcc augment Java extension directories;
wenzelm
parents:
diff changeset
    18
SOURCE="$ISABELLE_HOME/src/Pure/System/Java_Ext_Dirs.java"
7cad71ca9bcc augment Java extension directories;
wenzelm
parents:
diff changeset
    19
7cad71ca9bcc augment Java extension directories;
wenzelm
parents:
diff changeset
    20
TARGET_DIR="$ISABELLE_HOME/lib/classes"
7cad71ca9bcc augment Java extension directories;
wenzelm
parents:
diff changeset
    21
TARGET="$TARGET_DIR/java_ext_dirs.jar"
7cad71ca9bcc augment Java extension directories;
wenzelm
parents:
diff changeset
    22
7cad71ca9bcc augment Java extension directories;
wenzelm
parents:
diff changeset
    23
if [ ! -e "$TARGET" -o "$SOURCE" -nt "$TARGET" ]; then
7cad71ca9bcc augment Java extension directories;
wenzelm
parents:
diff changeset
    24
  mkdir -p "$TARGET_DIR" || fail "Bad directory: \"$TARGET_DIR\""
7cad71ca9bcc augment Java extension directories;
wenzelm
parents:
diff changeset
    25
  pushd "$TARGET_DIR" >/dev/null
7cad71ca9bcc augment Java extension directories;
wenzelm
parents:
diff changeset
    26
43536
6eec653d5599 more robust concurrent builds;
wenzelm
parents: 43522
diff changeset
    27
  BUILD="build$$"
6eec653d5599 more robust concurrent builds;
wenzelm
parents: 43522
diff changeset
    28
  TMP_JAR="java_ext_dirs$$.jar"
6eec653d5599 more robust concurrent builds;
wenzelm
parents: 43522
diff changeset
    29
6eec653d5599 more robust concurrent builds;
wenzelm
parents: 43522
diff changeset
    30
  rm -rf "$BUILD" && mkdir "$BUILD"
6eec653d5599 more robust concurrent builds;
wenzelm
parents: 43522
diff changeset
    31
  javac -d "$BUILD" -source 1.5 "$(jvmpath "$SOURCE")" || fail "Failed to compile sources"
6eec653d5599 more robust concurrent builds;
wenzelm
parents: 43522
diff changeset
    32
  jar cf "$TMP_JAR" -C "$BUILD" . || fail "Failed to produce $TMP_JAR"
6eec653d5599 more robust concurrent builds;
wenzelm
parents: 43522
diff changeset
    33
  mv "$TMP_JAR" "$TARGET"
6eec653d5599 more robust concurrent builds;
wenzelm
parents: 43522
diff changeset
    34
  rm -rf "$BUILD"
43518
7cad71ca9bcc augment Java extension directories;
wenzelm
parents:
diff changeset
    35
7cad71ca9bcc augment Java extension directories;
wenzelm
parents:
diff changeset
    36
  popd >/dev/null
7cad71ca9bcc augment Java extension directories;
wenzelm
parents:
diff changeset
    37
fi
7cad71ca9bcc augment Java extension directories;
wenzelm
parents:
diff changeset
    38
7cad71ca9bcc augment Java extension directories;
wenzelm
parents:
diff changeset
    39
7cad71ca9bcc augment Java extension directories;
wenzelm
parents:
diff changeset
    40
## main
7cad71ca9bcc augment Java extension directories;
wenzelm
parents:
diff changeset
    41
7cad71ca9bcc augment Java extension directories;
wenzelm
parents:
diff changeset
    42
JAVA_EXE="${THIS_JAVA:-$ISABELLE_JAVA}"
43521
d477b92109b8 provide Isabelle/Scala environment as Java extension, instead of user classpath
wenzelm
parents: 43518
diff changeset
    43
exec "$JAVA_EXE" -classpath "$(jvmpath "$TARGET")" isabelle.Java_Ext_Dirs \
d477b92109b8 provide Isabelle/Scala environment as Java extension, instead of user classpath
wenzelm
parents: 43518
diff changeset
    44
  "$(jvmpath "$ISABELLE_HOME/lib/classes/ext")"
43518
7cad71ca9bcc augment Java extension directories;
wenzelm
parents:
diff changeset
    45