-
Notifications
You must be signed in to change notification settings - Fork 17
/
mb-scala
executable file
·75 lines (64 loc) · 1.97 KB
/
mb-scala
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
69
70
71
72
73
74
75
#!/bin/bash
SCALA_VERSION=2.11
MINIBOXING_VERSION=0.4-SNAPSHOT
if [ "$1" == "-2.10" ]
then
SCALA_VERSION=2.10
SCALA_PATH=$SCALA_PATH_210
shift
fi
if [ "$1" == "-2.12" ]
then
SCALA_VERSION=2.12.0-M1 # for now, M1
SCALA_PATH=$SCALA_PATH_212
shift
fi
if [ "$MINIBOXING_PATH" == "" ]
then
MINIBOXING_PATH="`dirname \"$0\"`" # relative
MINIBOXING_PATH="`( cd \"$MINIBOXING_PATH\" && pwd )`" # absolutized and normalized
fi
if [ "$SCALA_PATH" == "" ]
then
SCALA_PATH="`dirname $(which scalac)`"
SCALA_PATH="`( cd \"$SCALA_PATH\" && pwd )`"
fi
if [ "$MINIBOXING_PATH" == "" -o "$SCALA_PATH" == "" -o ! -f $SCALA_PATH/scalac -o ! -d $MINIBOXING_PATH/components ]
then
echo To use this script please set the MINIBOXING_PATH and SCALA_PATH environment variables such that:
echo " -" '$SCALA_PATH/scalac' "(currently $SCALA_PATH/scalac)"
echo " -" '$MINIBOXING_PATH/components' "(currently $MINIBOXING_PATH/components)"
echo are accessible
exit 1
fi
PLUGIN_JAR=$MINIBOXING_PATH/components/plugin/target/scala-$SCALA_VERSION/miniboxing-plugin_$SCALA_VERSION-$MINIBOXING_VERSION.jar
RUNTIME_JAR=$MINIBOXING_PATH/components/runtime/target/scala-$SCALA_VERSION/miniboxing-runtime_$SCALA_VERSION-$MINIBOXING_VERSION.jar
me=`basename $0`
if [ "$me" == "mb-scalac" ]; then
target=scalac
elif [ "$me" == "mb-scala" ]; then
target=scala
else
echo Unrecognized script name: $0
exit 1
fi
function checkjar {
if [ ! -f "$1" ]
then
echo "The script is going to build the required jar file $1 by running \"sbt $2\" [5s until build]"
sleep 5
cd $MINIBOXING_PATH
sbt $2
cd -
if [ ! -f "$1" ]
then
echo "The required jar file has not been built by sbt. Please run \"sbt $2\""
exit 1
else
echo "The required jar file was built."
fi
fi
}
checkjar $PLUGIN_JAR miniboxing-plugin/package
checkjar $RUNTIME_JAR miniboxing-runtime/package
$SCALA_PATH/$target -bootclasspath $RUNTIME_JAR:$PLUGIN_JAR -Xplugin:$PLUGIN_JAR $@