Skip to content

Commit ec1011a

Browse files
Fix dotr/dotc to handle corrupted .packages
1 parent c568fbd commit ec1011a

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

bin/common

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,8 @@ function check_jar {
122122
# Usage:
123123
# check_jar "name" "path/to/package.jar" "sources/dir" 'lambda to exec on failure'
124124
local new_files="$(find "$DOTTY_ROOT/$3" \( -iname "*.scala" -o -iname "*.java" \) -newer "$2")"
125-
if [ ! -z "$new_files" ]; then
125+
# If the find failed, or if it found new files...
126+
if [ "$?" -ne 0 ] || [ ! -z "$new_files" ]; then
126127
printf "New files detected in $1, rebuilding..."
127128
rm "$2"
128129
eval "$4"

bin/test/TestScripts.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,9 @@ class TestScripts {
9191
s"Project recompiled when it didn't need to be. Status $ret, output:$lineSep$output")
9292
}
9393

94-
/** dotc script should work after deleting .packages */
94+
/** dotc script should work after corrupting .packages */
9595
@Test def reCreatesPackagesIfNecessary = doUnlessWindows {
96-
delete("./.packages")
96+
executeScript("sed -i.old 's/2.1/2.X/' ./.packages") // That's going to replace 2.11 with 2.X1
9797
val (retFirstBuild, _) = executeScript("./bin/dotc ./tests/pos/HelloWorld.scala")
9898
assert(retFirstBuild == 0, "building dotc failed")
9999
}

0 commit comments

Comments
 (0)