-
Notifications
You must be signed in to change notification settings - Fork 4
/
yacx.sh
executable file
·68 lines (60 loc) · 1.52 KB
/
yacx.sh
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#!/usr/bin/env bash
PWD="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
BUILD_DIR="build"
JAVA_BIN="${BUILD_DIR}/java/bin"
buildj() {
pushd $PWD
mkdir -p $JAVA_BIN
cp -R examples/kernels $JAVA_BIN
cp examples/java/*.java $JAVA_BIN
cmake -H. -B$BUILD_DIR
make -C $BUILD_DIR JNIExampleClasses
popd
echo 'Build finished.'
}
exej() {
if [ "$1" == "" ]; then
echo "!! parameter needed, select one of the following"
find examples/java -type f -iname "Example*.java" -exec basename '{}' \; | sed 's/\.java$//1'
else
pushd "${PWD}/${JAVA_BIN}"
java -ea -Xmx8G -Djava.library.path=../../ $1
popd
fi
}
builds() {
buildj
pushd $PWD
cp examples/scala/*.scala $JAVA_BIN
pushd $JAVA_BIN
scalac *.scala
popd
popd
echo 'Build finished.'
}
exes() {
if [ "$1" == "" ]; then
echo "!! parameter needed, select one of the following"
find examples/scala -type f -iname "Example*.scala" -exec basename '{}' \; | sed 's/\.scala$//1'
else
pushd "${PWD}/${JAVA_BIN}"
scala -J-ea -J-Xmx8G -Djava.library.path=../../ $1
popd
fi
}
if [ "$1" != "" ]; then
case $1 in
build-java) buildj;;
execute-java) exej $2;;
build-scala) builds;;
execute-scala) exes $2;;
esac
shift
else
echo 'yacx'
echo 'Options: ./yacx.sh'
echo 'build-java Builds JNI and Java Classes'
echo 'execute-java <class> Execute Java Class'
echo 'build-scala Builds JNI, Java and Scala Classes'
echo 'execute-scala <class> Execute Scala Class'
fi