Skip to content

Commit d032d1f

Browse files
authored
Merge pull request #15804 from KacperFKorban/allow-multiple-files-in-dotty-bisect
Allow for dottyCompileBisect to take multiple files
2 parents cfd91d4 + 8598882 commit d032d1f

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

project/scripts/dottyCompileBisect.scala

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Usage
2-
// > scala-cli project/scripts/dottyCompileBisect.scala -- File.scala
2+
// > scala-cli project/scripts/dottyCompileBisect.scala -- File1.scala File2.scala
33
//
44
// This script will bisect the compilation failure starting with a fast bisection on released nightly builds.
55
// Then it will bisect the commits between the last nightly that worked and the first nightly that failed.
@@ -9,19 +9,19 @@ import sys.process._
99
import scala.io.Source
1010
import Releases.Release
1111

12-
@main def dottyCompileBisect(file: String): Unit =
13-
val releaseBisect = ReleaseBisect(file)
12+
@main def dottyCompileBisect(files: String*): Unit =
13+
val releaseBisect = ReleaseBisect(files.toList)
1414
val fistBadRelease = releaseBisect.bisect(Releases.allReleases)
1515
println("\nFinished bisecting releases\n")
1616
fistBadRelease.previous match
1717
case Some(lastGoodRelease) =>
1818
println(s"Last good release: $lastGoodRelease\nFirst bad release: $fistBadRelease\n")
19-
val commitBisect = CommitBisect(file)
19+
val commitBisect = CommitBisect(files.toList)
2020
commitBisect.bisect(lastGoodRelease.hash, fistBadRelease.hash)
2121
case None =>
2222
println(s"No good release found")
2323

24-
class ReleaseBisect(file: String):
24+
class ReleaseBisect(files: List[String]):
2525

2626
def bisect(releases: Vector[Release]): Release =
2727
assert(releases.length > 1, "Need at least 2 releases to bisect")
@@ -35,7 +35,7 @@ class ReleaseBisect(file: String):
3535

3636
private def isGoodRelease(release: Release): Boolean =
3737
println(s"Testing ${release.version}")
38-
val res = s"""scala-cli compile $file -S "${release.version}"""".!
38+
val res = s"""scala-cli compile ${files.mkString(" ")} -S "${release.version}"""".!
3939
val isGood = res == 0
4040
println(s"Test result: ${release.version} is a ${if isGood then "good" else "bad"} release\n")
4141
isGood
@@ -64,10 +64,10 @@ object Releases:
6464

6565
override def toString: String = version
6666

67-
class CommitBisect(file: String):
67+
class CommitBisect(files: List[String]):
6868
def bisect(lastGoodHash: String, fistBadHash: String): Unit =
6969
println(s"Starting bisecting commits $lastGoodHash..$fistBadHash\n")
7070
"git bisect start".!
7171
s"git bisect bad $fistBadHash".!
7272
s"git bisect good $lastGoodHash".!
73-
s"git bisect run sh project/scripts/dottyCompileBisect.sh $file".!
73+
s"git bisect run sh project/scripts/dottyCompileBisect.sh ${files.mkString(" ")}".!

project/scripts/dottyCompileBisect.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@
66
#
77
# Note: Use dottyCompileBisect.scala for faster bisection over commits that spans several days
88

9-
file="$1"
9+
files=$@
1010
shift
1111

1212
rm -r out
1313
mkdir out
1414
mkdir out/bisect
1515

16-
sbt "clean; scalac -d out/bisect $file"
16+
sbt "clean; scalac -d out/bisect $files"

0 commit comments

Comments
 (0)