-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathejf
More file actions
executable file
·38 lines (29 loc) · 888 Bytes
/
ejf
File metadata and controls
executable file
·38 lines (29 loc) · 888 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/bin/bash
if [ $(uname) == "Darwin" ]; then
SED=gsed
else
SED=sed
fi
set -o noclobber
set -o errexit
set -o nounset
[ "$#" -lt 1 ] && { echo >&2 'usage: ejf <file1.java> <file2.java> ...'; exit 3; }
d="$(cd "$(dirname "$0")"; pwd -P)"
cat "$d/lib/sources.list" | grep -Ev '^\s*(#|$)' | while IFS= read -r url ; do
file="$d/lib/$(echo "$url" | $SED -re 's/^.*\/([^\/]+)$/\1/')"
if [ ! -f "$file" ] ; then
echo "$url"
curl -f -L -# -o "$file" "$url" || { rm "$file"; exit 1; }
fi
done
lib_classpath="$(find "$d/lib/" -name '*.jar' | tr '\n' ':')"
src="$d/src/ejf/Main.java"
bin="$d/bin"
cls="$d/bin/ejf/Main.class"
if [ "$src" -nt "$cls" ] ; then
echo "Recompiling $src ..."
javac -cp "$lib_classpath" -d "$bin" "$src"
touch -r "$src" "$cls"
fi
style="$(find "$d/lib/" -name '*.xml' | head -n 1)"
java -cp "$lib_classpath:$bin" ejf.Main "$style" "$@"