lib/browser/build
author wenzelm
Sat, 22 Oct 2016 19:57:56 +0200
changeset 64348 4c253e84ae62
parent 61294 2d3d26e9b191
child 68014 9096895dc2a6
permissions -rwxr-xr-x
clarified push/pull chain: current ISABELLE_HOME may server as source for changes that are not published on isabelle_repos_source yet (e.g. isabelle-release branch);

#!/usr/bin/env bash
#
# Author: Makarius
#
# mk - build graph browser
#
# Requires proper Isabelle settings environment.


## diagnostics

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

[ -n "$ISABELLE_HOME" ] || fail "Missing Isabelle settings environment"


## dependencies

declare -a SOURCES=(
  GraphBrowser/AWTFontMetrics.java
  GraphBrowser/AbstractFontMetrics.java
  GraphBrowser/Box.java
  GraphBrowser/Console.java
  GraphBrowser/DefaultFontMetrics.java
  GraphBrowser/Directory.java
  GraphBrowser/DummyVertex.java
  GraphBrowser/Graph.java
  GraphBrowser/GraphBrowser.java
  GraphBrowser/GraphBrowserFrame.java
  GraphBrowser/GraphView.java
  GraphBrowser/NormalVertex.java
  GraphBrowser/ParseError.java
  GraphBrowser/Region.java
  GraphBrowser/Spline.java
  GraphBrowser/TreeBrowser.java
  GraphBrowser/TreeNode.java
  GraphBrowser/Vertex.java
  awtUtilities/Border.java
  awtUtilities/MessageDialog.java
  awtUtilities/TextFrame.java
)

TARGET="$ISABELLE_HOME/lib/browser/GraphBrowser.jar"


## main

OUTDATED=false

for SOURCE in "${SOURCES[@]}"
do
  [ ! -e "$SOURCE" ] && fail "Missing source file: $SOURCE"
  [ ! -e "$TARGET" -o "$SOURCE" -nt "$TARGET" ] && OUTDATED=true
done

if [ "$OUTDATED" = true ]
then
  echo "### Building graph browser ..."

  rm -rf classes && mkdir classes

  isabelle_jdk javac -d classes -source 1.4 "${SOURCES[@]}" || \
    fail "Failed to compile sources"
  isabelle_jdk jar cf "$(platform_path "$TARGET")" -C classes . ||
    fail "Failed to produce $TARGET"

  rm -rf classes
fi