Skip to content

Fixes for #1327, #1328 in dotc/dotr scripts #1326

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

Merged
Merged
Show file tree
Hide file tree
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
54 changes: 27 additions & 27 deletions bin/common
Original file line number Diff line number Diff line change
Expand Up @@ -29,33 +29,12 @@ function find_jar {
local artifact="$1/$2"

if [ ! -f "$artifact" ]; then
artifact=$(find "$HOME/.coursier/cache" -iname "$2")
artifact=$(find "$HOME/.coursier/cache" -iname "$2" 2> /dev/null)
fi

echo "$artifact"
}

# Autodetecting the scala-library location, in case it wasn't provided by an environment variable
if [ "$SCALA_LIBRARY_JAR" == "" ]; then
SCALA_LIBRARY_JAR=$(find_jar "$HOME/.ivy2/cache/org.scala-lang/scala-library/jars" "scala-library-$SCALA_VERSION.jar")
fi

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

if [ "$SCALA_COMPILER_JAR" == "" ]; then
SCALA_COMPILER_JAR=$(find_jar "$HOME/.ivy2/cache/me.d-d/scala-compiler/jars" "scala-compiler-$SCALA_COMPILER_VERSION.jar")
fi

if [ "$JLINE_JAR" == "" ]; then
JLINE_JAR=$(find_jar "$HOME/.ivy2/cache/jline/jline/jars" "jline-$JLINE_VERSION.jar")
fi

if [ "$SBT_INTERFACE_JAR" == "" ]; then
SBT_INTERFACE_JAR=$(find_jar "$HOME/.ivy2/cache/org.scala-sbt/interface/jars" "interface-$SBT_VERSION.jar")
fi

function build_jar {
# Usage:
# build_jar package path/to/jar/dir ['/some/sed/command']
Expand Down Expand Up @@ -94,11 +73,11 @@ function build_all {
printf "done\n"

printf "Building dotty..."
MAIN_JAR=$(build_jar package target/scala-2.11)
MAIN_JAR=$(build_jar package "target/scala-$SCALA_BINARY_VERSION")
printf "done\n"

printf "Building tests..."
TEST_JAR=$(build_jar test:package target/scala-2.11 '/dotty.*-tests\.jar/p')
TEST_JAR=$(build_jar test:package "target/scala-$SCALA_BINARY_VERSION" '/dotty.*-tests\.jar/p')
printf "done\n"

update_packages
Expand All @@ -115,7 +94,7 @@ else
MAIN_JAR="${JARS[1]}"
TEST_JAR="${JARS[2]}"
else
echo "Corrupted .packages file"
echo "Failed to parse .packages file"
build_all
fi
fi
Expand All @@ -134,5 +113,26 @@ function check_jar {
}

check_jar "dotty-interfaces" $INTERFACES_JAR "interfaces" 'INTERFACES_JAR=$(build_jar dotty-interfaces/package interfaces/target)'
check_jar "dotty" $MAIN_JAR "src" 'MAIN_JAR=$(build_jar package target/scala-2.11)'
check_jar "dotty-tests" $TEST_JAR "test" 'TEST_JAR=$(build_jar test:package target/scala-2.11 /dotty.*-tests\.jar/p)'
check_jar "dotty" $MAIN_JAR "src" 'MAIN_JAR=$(build_jar package target/scala-$SCALA_BINARY_VERSION)'
check_jar "dotty-tests" $TEST_JAR "test" 'TEST_JAR=$(build_jar test:package target/scala-$SCALA_BINARY_VERSION /dotty.*-tests\.jar/p)'

# Autodetecting the scala-library location, in case it wasn't provided by an environment variable
if [ "$SCALA_LIBRARY_JAR" == "" ]; then
SCALA_LIBRARY_JAR=$(find_jar "$HOME/.ivy2/cache/org.scala-lang/scala-library/jars" "scala-library-$SCALA_VERSION.jar")
fi

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

if [ "$SCALA_COMPILER_JAR" == "" ]; then
SCALA_COMPILER_JAR=$(find_jar "$HOME/.ivy2/cache/me.d-d/scala-compiler/jars" "scala-compiler-$SCALA_COMPILER_VERSION.jar")
fi

if [ "$JLINE_JAR" == "" ]; then
JLINE_JAR=$(find_jar "$HOME/.ivy2/cache/jline/jline/jars" "jline-$JLINE_VERSION.jar")
fi

if [ "$SBT_INTERFACE_JAR" == "" ]; then
SBT_INTERFACE_JAR=$(find_jar "$HOME/.ivy2/cache/org.scala-sbt/interface/jars" "interface-$SBT_VERSION.jar")
fi
2 changes: 1 addition & 1 deletion bin/dotr
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ DOTTY_ROOT="$( cd "$DOTTY_ROOT" >& /dev/null && pwd )/.." # absolute
source $DOTTY_ROOT/bin/common

# CLASS_PATH is derived from the DOTTY_ROOT and SCALA_LIBRARY_JAR
CLASS_PATH="-Xbootclasspath/a:.:$DOTTY_ROOT/target/scala-2.11/classes/:.:$SCALA_LIBRARY_JAR"
CLASS_PATH="-Xbootclasspath/a:.:$DOTTY_ROOT/target/scala-$SCALA_BINARY_VERSION/classes/:.:$SCALA_LIBRARY_JAR"

function runMain {
local jbin=$(which "java")
Expand Down