Skip to content

Script to run compiler #10

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 6 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 48 additions & 0 deletions bin/dottyc
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#!/bin/bash
MY_PATH="`readlink \"$0\"`" # relative, symbolic links resolved
if [[ "$MY_PATH" == "" ]]; then
MY_PATH="$0"
fi
MY_PATH="`dirname \"$MY_PATH\"`"
MY_PATH="`( cd \"$MY_PATH\" && pwd )`/../" # absolute
SCALA_VERSION=2.11.0-M7
DOTTY_VERSION=0.1
MAIN_JAR=$MY_PATH/target/scala-$SCALA_VERSION/dotty_$SCALA_VERSION-$DOTTY_VERSION-SNAPSHOT.jar
if [ "$SCALA_LIBRARY_JAR" == "" ]
then
SCALA_LIBRARY_JAR=$HOME/.ivy2/cache/org.scala-lang/scala-library/jars/scala-library-$SCALA_VERSION.jar
fi

if [ "$SCALA_REFLECT_JAR" == "" ]
then
SCALA_REFLECT_JAR=$HOME/.ivy2/cache/org.scala-lang/scala-reflect/jars/scala-reflect-$SCALA_VERSION.jar
fi

if [ ! -f "$SCALA_LIBRARY_JAR" -o ! -f "$SCALA_REFLECT_JAR" ]
then
echo To use this script please set
echo SCALA_LIBRARY_JAR to point to scala-library-$SCALA_VERSION.jar "(currently $SCALA_LIBRARY_JAR)"
echo SCALA_REFLECT_JAR to point to scala-reflect-$SCALA_VERSION.jar "(currently $SCALA_REFLECT_JAR)"
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 $MY_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 $MAIN_JAR package

java -cp $MAIN_JAR:$SCALA_LIBRARY_JAR:$SCALA_REFLECT_JAR -Dscala.usejavacp=true dotty.tools.dotc.Main $@