Skip to content

Commit cc87bd3

Browse files
authored
Merge pull request #1326 from felixmulder/topic/remove-scala-version-hardcoding
Fixes for #1327, #1328 in dotc/dotr scripts
2 parents 93599be + a12f671 commit cc87bd3

File tree

2 files changed

+28
-28
lines changed

2 files changed

+28
-28
lines changed

bin/common

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -29,33 +29,12 @@ function find_jar {
2929
local artifact="$1/$2"
3030

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

3535
echo "$artifact"
3636
}
3737

38-
# Autodetecting the scala-library location, in case it wasn't provided by an environment variable
39-
if [ "$SCALA_LIBRARY_JAR" == "" ]; then
40-
SCALA_LIBRARY_JAR=$(find_jar "$HOME/.ivy2/cache/org.scala-lang/scala-library/jars" "scala-library-$SCALA_VERSION.jar")
41-
fi
42-
43-
if [ "$SCALA_REFLECT_JAR" == "" ]; then
44-
SCALA_REFLECT_JAR=$(find_jar "$HOME/.ivy2/cache/org.scala-lang/scala-reflect/jars" "scala-reflect-$SCALA_VERSION.jar")
45-
fi
46-
47-
if [ "$SCALA_COMPILER_JAR" == "" ]; then
48-
SCALA_COMPILER_JAR=$(find_jar "$HOME/.ivy2/cache/me.d-d/scala-compiler/jars" "scala-compiler-$SCALA_COMPILER_VERSION.jar")
49-
fi
50-
51-
if [ "$JLINE_JAR" == "" ]; then
52-
JLINE_JAR=$(find_jar "$HOME/.ivy2/cache/jline/jline/jars" "jline-$JLINE_VERSION.jar")
53-
fi
54-
55-
if [ "$SBT_INTERFACE_JAR" == "" ]; then
56-
SBT_INTERFACE_JAR=$(find_jar "$HOME/.ivy2/cache/org.scala-sbt/interface/jars" "interface-$SBT_VERSION.jar")
57-
fi
58-
5938
function build_jar {
6039
# Usage:
6140
# build_jar package path/to/jar/dir ['/some/sed/command']
@@ -94,11 +73,11 @@ function build_all {
9473
printf "done\n"
9574

9675
printf "Building dotty..."
97-
MAIN_JAR=$(build_jar package target/scala-2.11)
76+
MAIN_JAR=$(build_jar package "target/scala-$SCALA_BINARY_VERSION")
9877
printf "done\n"
9978

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

10483
update_packages
@@ -115,7 +94,7 @@ else
11594
MAIN_JAR="${JARS[1]}"
11695
TEST_JAR="${JARS[2]}"
11796
else
118-
echo "Corrupted .packages file"
97+
echo "Failed to parse .packages file"
11998
build_all
12099
fi
121100
fi
@@ -134,5 +113,26 @@ function check_jar {
134113
}
135114

136115
check_jar "dotty-interfaces" $INTERFACES_JAR "interfaces" 'INTERFACES_JAR=$(build_jar dotty-interfaces/package interfaces/target)'
137-
check_jar "dotty" $MAIN_JAR "src" 'MAIN_JAR=$(build_jar package target/scala-2.11)'
138-
check_jar "dotty-tests" $TEST_JAR "test" 'TEST_JAR=$(build_jar test:package target/scala-2.11 /dotty.*-tests\.jar/p)'
116+
check_jar "dotty" $MAIN_JAR "src" 'MAIN_JAR=$(build_jar package target/scala-$SCALA_BINARY_VERSION)'
117+
check_jar "dotty-tests" $TEST_JAR "test" 'TEST_JAR=$(build_jar test:package target/scala-$SCALA_BINARY_VERSION /dotty.*-tests\.jar/p)'
118+
119+
# Autodetecting the scala-library location, in case it wasn't provided by an environment variable
120+
if [ "$SCALA_LIBRARY_JAR" == "" ]; then
121+
SCALA_LIBRARY_JAR=$(find_jar "$HOME/.ivy2/cache/org.scala-lang/scala-library/jars" "scala-library-$SCALA_VERSION.jar")
122+
fi
123+
124+
if [ "$SCALA_REFLECT_JAR" == "" ]; then
125+
SCALA_REFLECT_JAR=$(find_jar "$HOME/.ivy2/cache/org.scala-lang/scala-reflect/jars" "scala-reflect-$SCALA_VERSION.jar")
126+
fi
127+
128+
if [ "$SCALA_COMPILER_JAR" == "" ]; then
129+
SCALA_COMPILER_JAR=$(find_jar "$HOME/.ivy2/cache/me.d-d/scala-compiler/jars" "scala-compiler-$SCALA_COMPILER_VERSION.jar")
130+
fi
131+
132+
if [ "$JLINE_JAR" == "" ]; then
133+
JLINE_JAR=$(find_jar "$HOME/.ivy2/cache/jline/jline/jars" "jline-$JLINE_VERSION.jar")
134+
fi
135+
136+
if [ "$SBT_INTERFACE_JAR" == "" ]; then
137+
SBT_INTERFACE_JAR=$(find_jar "$HOME/.ivy2/cache/org.scala-sbt/interface/jars" "interface-$SBT_VERSION.jar")
138+
fi

bin/dotr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ DOTTY_ROOT="$( cd "$DOTTY_ROOT" >& /dev/null && pwd )/.." # absolute
1212
source $DOTTY_ROOT/bin/common
1313

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

1717
function runMain {
1818
local jbin=$(which "java")

0 commit comments

Comments
 (0)