|
- #!/bin/bash
- #
- # Run JVCL on a spec
- #
- # Usage:
- #
- # jvcl [-f spec-file] [-t temp-dir]
- #
- # If the `-f` option is omitted and no spec-file is provided, then jvcl will try to read
- # a spec from stdin.
- #
- # Every run of JVCL will create a temp directory. You can either specify the name of the directory
- # with `-t` (it will be created if it does not exist), or let jvcl create a temp directory for you.
- #
- # Note: this command will build the jvcl jar file if needed. The first time you run it, it might
- # take a long time to start up.
- #
- function die () {
- echo 1>&2 "${1}"
- exit 1
- }
-
- JVCL_DIR="$(cd "$(dirname "${0}")"/.. && pwd)"
- JVCL_JAR="$(find "${JVCL_DIR}"/target -type f -name "jvcl-*.jar" | head -1)"
- if [[ -z "${JVCL_JAR}" ]] ; then
- mvn -DskipTests=true clean package || die "Error building JVCL jar"
- JVCL_JAR="$(find "${JVCL_DIR}"/target -type f -name "jvcl-*.jar" | head -1)"
- if [[ -z "${JVCL_JAR}" ]] ; then
- die "No JVCL jar file found after successful build"
- fi
- fi
-
- java -cp "${JVCL_JAR}" jvcl.main.Jvcl "${@}"
|