From ec1011a8d8861f7b4aefe9439288cb8b90b6c4bc Mon Sep 17 00:00:00 2001 From: Olivier Blanvillain Date: Fri, 10 Feb 2017 14:38:54 +0100 Subject: Fix dotr/dotc to handle corrupted .packages --- bin/common | 3 ++- bin/test/TestScripts.scala | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) (limited to 'bin') diff --git a/bin/common b/bin/common index 5b1dd177f..0a084c8a6 100755 --- a/bin/common +++ b/bin/common @@ -122,7 +122,8 @@ function check_jar { # Usage: # check_jar "name" "path/to/package.jar" "sources/dir" 'lambda to exec on failure' local new_files="$(find "$DOTTY_ROOT/$3" \( -iname "*.scala" -o -iname "*.java" \) -newer "$2")" - if [ ! -z "$new_files" ]; then + # If the find failed, or if it found new files... + if [ "$?" -ne 0 ] || [ ! -z "$new_files" ]; then printf "New files detected in $1, rebuilding..." rm "$2" eval "$4" diff --git a/bin/test/TestScripts.scala b/bin/test/TestScripts.scala index 025ee7c90..58fecac3c 100644 --- a/bin/test/TestScripts.scala +++ b/bin/test/TestScripts.scala @@ -91,9 +91,9 @@ class TestScripts { s"Project recompiled when it didn't need to be. Status $ret, output:$lineSep$output") } - /** dotc script should work after deleting .packages */ + /** dotc script should work after corrupting .packages */ @Test def reCreatesPackagesIfNecessary = doUnlessWindows { - delete("./.packages") + executeScript("sed -i.old 's/2.1/2.X/' ./.packages") // That's going to replace 2.11 with 2.X1 val (retFirstBuild, _) = executeScript("./bin/dotc ./tests/pos/HelloWorld.scala") assert(retFirstBuild == 0, "building dotc failed") } -- cgit v1.2.3