Skip to content

Commit f9374e7

Browse files
committed
Remove reflect from scripts and fix incorrect bin-test
1 parent 1e9caba commit f9374e7

File tree

4 files changed

+24
-13
lines changed

4 files changed

+24
-13
lines changed

bin/common

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,11 @@ else
115115
echo "Failed to parse .packages file"
116116
build_all
117117
fi
118+
119+
if [ ! -f "$INTERFACES_JAR" -o ! -f "$MAIN_JAR" -o ! -f "$DOTTY_LIB_JAR" -o ! -f "$TEST_JAR" ]; then
120+
echo ".packages file corrupted, rebuilding"
121+
build_all
122+
fi
118123
fi
119124

120125
################# After this point, jar variables will be set #################
@@ -142,10 +147,6 @@ if [ "$SCALA_LIBRARY_JAR" == "" ]; then
142147
SCALA_LIBRARY_JAR=$(find_jar "$HOME/.ivy2/cache/org.scala-lang/scala-library/jars" "scala-library-$SCALA_VERSION.jar")
143148
fi
144149

145-
if [ "$SCALA_REFLECT_JAR" == "" ]; then
146-
SCALA_REFLECT_JAR=$(find_jar "$HOME/.ivy2/cache/org.scala-lang/scala-reflect/jars" "scala-reflect-$SCALA_VERSION.jar")
147-
fi
148-
149150
if [ "$SCALA_ASM_JAR" == "" ]; then
150151
SCALA_ASM_JAR=$(find_jar "$HOME/.ivy2/cache/org.scala-lang.modules/scala-asm/bundles" "scala-asm-$SCALA_ASM_VERSION.jar")
151152
fi

bin/dotc

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,10 @@ CompilerMain=dotty.tools.dotc.Main
2020
FromTasty=dotty.tools.dotc.FromTasty
2121
ReplMain=dotty.tools.dotc.repl.Main
2222

23-
if [ ! -f "$SCALA_LIBRARY_JAR" -o ! -f "$SCALA_REFLECT_JAR" -o ! -f "$SCALA_ASM_JAR" -o ! -f "$SBT_INTERFACE_JAR" ]
23+
if [ ! -f "$SCALA_LIBRARY_JAR" -o ! -f "$SCALA_ASM_JAR" -o ! -f "$SBT_INTERFACE_JAR" ]
2424
then
2525
echo To use this script please set
2626
echo SCALA_LIBRARY_JAR to point to scala-library-$SCALA_VERSION.jar "(currently $SCALA_LIBRARY_JAR)"
27-
echo SCALA_REFLECT_JAR to point to scala-reflect-$SCALA_VERSION.jar "(currently $SCALA_REFLECT_JAR)"
2827
echo SCALA_ASM_JAR to point to scala-asm-$SCALA_ASM_VERSION.jar "(currently $SCALA_ASM_JAR)"
2928
echo SBT_INTERFACE_JAR to point to interface-$SBT_VERSION.jar "(currently $SBT_INTERFACE_JAR)"
3029
fi
@@ -116,9 +115,9 @@ trap onExit INT
116115
classpathArgs () {
117116
if [[ "true" == "$bootstrapped" ]]; then
118117
check_jar "dotty-bootstrapped" "$DOTTY_JAR" "target" 'build_jar "test:runMain dotc.build" target' &> /dev/null
119-
toolchain="$DOTTY_JAR:$DOTTY_LIB_JAR:$SCALA_LIBRARY_JAR:$SCALA_REFLECT_JAR:$SCALA_ASM_JAR:$SBT_INTERFACE_JAR"
118+
toolchain="$DOTTY_JAR:$DOTTY_LIB_JAR:$SCALA_LIBRARY_JAR:$SCALA_ASM_JAR:$SBT_INTERFACE_JAR"
120119
else
121-
toolchain="$SCALA_LIBRARY_JAR:$DOTTY_LIB_JAR:$SCALA_REFLECT_JAR:$SCALA_ASM_JAR:$SBT_INTERFACE_JAR"
120+
toolchain="$SCALA_LIBRARY_JAR:$DOTTY_LIB_JAR:$SCALA_ASM_JAR:$SBT_INTERFACE_JAR"
122121
fi
123122
bcpJars="$INTERFACES_JAR:$MAIN_JAR:$DOTTY_LIB_JAR"
124123
cpJars="$INTERFACES_JAR:$MAIN_JAR:$DOTTY_LIB_JAR:$TEST_JAR"

bin/test/TestScripts.scala

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,8 @@ class TestScripts {
1717

1818
private def executeScript(script: String): (Int, String) = {
1919
val sb = new StringBuilder
20-
val ret = Process(script) ! ProcessLogger { line => println(line); sb.append(line) }
20+
val ret = Process(script) ! ProcessLogger { line => println(line); sb.append(line + "\n") }
2121
val output = sb.toString
22-
println(output) // For CI, otherwise "terminal inactive for 5m0s, build cancelled"
2322
(ret, output)
2423
}
2524

@@ -59,7 +58,7 @@ class TestScripts {
5958

6059
val (retDotr, dotrOutput) = executeScript("./bin/dotr HelloWorld")
6160
assert(
62-
retDotr == 0 && dotrOutput == "hello world",
61+
retDotr == 0 && dotrOutput == "hello world\n",
6362
s"Running hello world exited with status: $retDotr and output: $dotrOutput"
6463
)
6564
}
@@ -93,8 +92,19 @@ class TestScripts {
9392

9493
/** dotc script should work after corrupting .packages */
9594
@Test def reCreatesPackagesIfNecessary = doUnlessWindows {
96-
executeScript("sed -i.old 's/2.1/2.X/' ./.packages") // That's going to replace 2.11 with 2.X1
97-
val (retFirstBuild, _) = executeScript("./bin/dotc ./tests/pos/HelloWorld.scala")
95+
import java.nio.file.{Paths, Files}
96+
import java.nio.charset.StandardCharsets
97+
val contents =
98+
"""|/Users/fixel/Projects/dotty/interfaces/target/dotty-interfaces-0.1.1-bin-SNAPSHOT-X.jar
99+
|/Users/fixel/Projects/dotty/compiler/target/scala-2.11/dotty-compiler_2.1X-0.1.1-bin-SNAPSHOT.jar
100+
|/Users/fixel/Projects/dotty/library/target/scala-2.11/dotty-library_2.1X-0.1.1-bin-SNAPSHOT.jar
101+
|/Users/fixel/Projects/dotty/doc-tool/target/scala-2.11/dotty-doc_2.1X-0.1.1-bin-SNAPSHOT-tests.jar"""
102+
.stripMargin
103+
104+
Files.write(Paths.get("./.packages"), contents.getBytes(StandardCharsets.UTF_8))
105+
106+
val (retFirstBuild, output) = executeScript("./bin/dotc ./tests/pos/HelloWorld.scala")
107+
assert(output.contains(".packages file corrupted"))
98108
assert(retFirstBuild == 0, "building dotc failed")
99109
}
100110
}

project/Build.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -623,6 +623,7 @@ object Build {
623623
settings(
624624
publishArtifact := false,
625625
parallelExecution in Test := false,
626+
testOptions in Test += Tests.Argument(TestFrameworks.JUnit, "-a", "-v"),
626627
libraryDependencies +=
627628
"com.novocode" % "junit-interface" % "0.11" % "test"
628629
)

0 commit comments

Comments
 (0)