forked from comprakt/comprakt
-
Notifications
You must be signed in to change notification settings - Fork 0
/
run
executable file
·37 lines (33 loc) · 1.17 KB
/
run
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
#!/usr/bin/env bash
set -e
# change to this script's directory
# credits to https://stackoverflow.com/questions/4774054/reliable-way-for-a-bash-script-to-get-the-full-path-to-itself/12197518#12197518
pushd . > /dev/null
SCRIPT_PATH="${BASH_SOURCE[0]}";
while([ -h "${SCRIPT_PATH}" ]); do
cd "`dirname "${SCRIPT_PATH}"`"
SCRIPT_PATH="$(readlink "`basename "${SCRIPT_PATH}"`")";
done
cd "`dirname "${SCRIPT_PATH}"`" > /dev/null
SCRIPT_PATH="`pwd`";
popd > /dev/null
TARGET="${TARGET:-release}"
COMPILER_CLI="$SCRIPT_PATH/target/$TARGET/compiler-cli"
# The VANILLA flag disables all additional features of our compiler that
# violate the MiniJava language specification
if [[ -z $CHOCOLATE ]]; then
export VANILLA=1
fi
if [[ $BENCH == "1" ]]; then
exec $COMPILER_CLI "$@"
else
if [[ $# == 1 ]] ; then
exec $COMPILER_CLI "--compile" "-O" "moderate" "--no-peep" "$1"
elif [[ $# == 2 ]] && [[ $1 == "--compile" ]]; then
exec $COMPILER_CLI "--compile" "-O" "moderate" "--no-peep" "$2"
elif [[ $# == 2 ]] && [[ $1 == "--compile-firm" ]]; then
exec $COMPILER_CLI "--compile-firm" "-O" "moderate" "$2"
else
exec $COMPILER_CLI "$@"
fi
fi